Fix the sheep command somewhat.. it works at least, doesnt have reasonable messages though

This commit is contained in:
mcmonkey4eva 2015-03-23 20:08:37 -07:00
parent 7065a95b35
commit 6d4cf835b2
2 changed files with 9 additions and 3 deletions

View File

@ -1200,10 +1200,12 @@ public class NPCCommands {
max = 1,
permission = "citizens.npc.sheep")
@Requirements(selected = true, ownership = true, types = { EntityType.SHEEP })
public void sheep(CommandContext args, CommandSender sender, NPC npc) {
public void sheep(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
SheepTrait trait = npc.getTrait(SheepTrait.class);
boolean hasArg = false;
if (args.hasValueFlag("sheared")) {
trait.setSheared(Boolean.valueOf(args.getFlag("sheared")));
hasArg = true;
}
if (args.hasValueFlag("color")) {
DyeColor color = Util.matchEnum(DyeColor.values(), args.getFlag("color"));
@ -1213,6 +1215,10 @@ public class NPCCommands {
} else {
Messaging.sendErrorTr(sender, Messages.INVALID_SHEEP_COLOR, Util.listValuesPretty(DyeColor.values()));
}
hasArg = true;
}
if (!hasArg) {
throw new CommandException();
}
}

View File

@ -11,9 +11,9 @@ import org.bukkit.event.player.PlayerShearEntityEvent;
public class SheepTrait extends Trait {
@Persist("color")
private DyeColor color;
private DyeColor color = DyeColor.WHITE;
@Persist("sheared")
private boolean sheared;
private boolean sheared = false;
public SheepTrait() {
super("sheeptrait");