Fix the wolf colour command messages

This commit is contained in:
sanjay900 2014-12-19 00:27:15 +13:00
parent 6c17804653
commit a174631d6f
3 changed files with 8 additions and 2 deletions

View File

@ -1586,11 +1586,15 @@ public class NPCCommands {
try {
color = DyeColor.valueOf(unparsed.toUpperCase().replace(' ', '_'));
} catch (IllegalArgumentException e) {
try {
int rgb = Integer.parseInt(unparsed.replace("#", ""), 16);
color = DyeColor.getByColor(org.bukkit.Color.fromRGB(rgb));
} catch (NumberFormatException ex) {
throw new CommandException(Messages.COLLAR_COLOUR_NOT_RECOGNISED,unparsed);
}
}
if (color == null)
throw new CommandException(Messages.COLLAR_COLOUR_NOT_RECOGNISED);
throw new CommandException(Messages.COLLAR_COLOUR_NOT_SUPPORTED,unparsed);
trait.setCollarColor(color);
}
Messaging.sendTr(sender, Messages.WOLF_TRAIT_UPDATED, npc.getName(), args.hasFlag('a'), args.hasFlag('s'), args.hasFlag('t'),trait.getCollarColor().name());

View File

@ -30,6 +30,7 @@ public class Messages {
public static final String CITIZENS_SAVED = "citizens.notifications.saved";
public static final String CITIZENS_SAVING = "citizens.notifications.saving";
public static final String COLLAR_COLOUR_NOT_RECOGNISED = "citizens.commands.npc.wolf.unknown-collar-color";
public static final String COLLAR_COLOUR_NOT_SUPPORTED = "citizens.commands.npc.wolf.collar-color-unsupported";
public static final String COMMAND_AGE_HELP = "citizens.commands.npc.age.help";
public static final String COMMAND_HELP_HEADER = "citizens.commands.help.header";
public static final String COMMAND_INVALID_MOBTYPE = "citizens.commands.invalid-mobtype";

View File

@ -122,7 +122,8 @@ citizens.commands.npc.type.set=[[{0}]]''s type set to [[{1}]].
citizens.commands.npc.type.invalid=[[{0}]] is not a valid type.
citizens.commands.npc.vulnerable.set=[[{0}]] is now vulnerable.
citizens.commands.npc.vulnerable.stopped=[[{0}]] is no longer vulnerable.
citizens.commands.npc.wolf.unknown-collar-color=[[{0}]] is not an RGB-formatted collar color.
citizens.commands.npc.wolf.unknown-collar-color=[[{0}]] is not an RGB-formatted collar color or the name of a DyeColor.
citizens.commands.npc.wolf.collar-color-unsupported=[[{0}]] is not a recognized RGB-formatted collar color.
citizens.commands.npc.zombiemod.villager-set=[[{0}]] is now a villager.
citizens.commands.npc.zombiemod.villager-unset=[[{0}]] is no longer a villager.
citizens.commands.npc.zombiemod.baby-set=[[{0}]] is now a baby.