use of org.bukkit.entity.Parrot.Variant in project Citizens2 by CitizensDev.
the class Commands method parrot.
@Command(aliases = { "npc" }, usage = "parrot (--variant variant)", desc = "Sets parrot modifiers", modifiers = { "parrot" }, min = 1, max = 1, permission = "citizens.npc.parrot")
@Requirements(selected = true, ownership = true, types = EntityType.PARROT)
public void parrot(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
ParrotTrait trait = npc.getTrait(ParrotTrait.class);
String output = "";
if (args.hasValueFlag("variant")) {
String variantRaw = args.getFlag("variant");
Variant variant = Util.matchEnum(Variant.values(), variantRaw);
if (variant == null) {
String valid = Util.listValuesPretty(Variant.values());
throw new CommandException(Messages.INVALID_PARROT_VARIANT, valid);
}
trait.setVariant(variant);
output += Messaging.tr(Messages.PARROT_VARIANT_SET, Util.prettyEnum(variant));
}
if (!output.isEmpty()) {
Messaging.send(sender, output);
}
}
Aggregations