studio.magemonkey.blueprint.commands.SurveySubCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of blueprint Show documentation
Show all versions of blueprint Show documentation
Let NPCs build your schematics and structures block by block with Citizens
The newest version!
package studio.magemonkey.blueprint.commands;
import studio.magemonkey.blueprint.Blueprint;
import studio.magemonkey.blueprint.hooks.citizens.BuilderTrait;
import studio.magemonkey.blueprint.util.Util;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public class SurveySubCommand extends AbstractCommand {
public SurveySubCommand(@Nullable SchematicBuilderCommand parent) {
super("survey",
"View the list of materials required to build the loaded schematic at the current origin with the specified options",
parent);
this.permission = "schematicbuilder.survey";
addAllowedSender(Player.class);
registerHyphenArgument(new HyphenArgument("excavate", "true", "false"));
}
@Override
public void execute(@NotNull CommandSender sender,
@NotNull Command command,
@NotNull String label,
@NotNull List args) {
BuilderTrait builder = getSelectedBuilder(sender);
if (builder == null) {
return;
}
NPC npc = builder.getNPC();
if (builder.getState() != BuilderTrait.BuilderState.COLLECTING) {
sender.sendMessage(npc.getName() + ChatColor.GREEN + " is not collecting any materials");
return;
}
sender.sendMessage(Blueprint.format(Blueprint.getInstance().config().getSurveyMessage(),
npc,
builder.getSchematic(),
sender,
null,
"0"));
sender.sendMessage(Util.printMaterials(builder.getMissingMaterials()));
}
}