Fix /npc wolf collar parsing

This commit is contained in:
fullwall 2013-05-08 21:08:12 +08:00
parent 684d1e0ff0
commit 0e4a85bc4a

View File

@ -1151,7 +1151,7 @@ public class NPCCommands {
@Command( @Command(
aliases = { "npc" }, aliases = { "npc" },
usage = "wolf (-s(itting) a(ngry) t(amed)) --collar [rgb color]", usage = "wolf (-s(itting) a(ngry) t(amed)) --collar [hex rgb color|name]",
desc = "Sets wolf modifiers", desc = "Sets wolf modifiers",
modifiers = { "wolf" }, modifiers = { "wolf" },
min = 1, min = 1,
@ -1168,9 +1168,9 @@ public class NPCCommands {
String unparsed = args.getFlag("collar"); String unparsed = args.getFlag("collar");
DyeColor color = null; DyeColor color = null;
try { try {
DyeColor.valueOf(unparsed.toUpperCase().replace(' ', '_')); color = DyeColor.valueOf(unparsed.toUpperCase().replace(' ', '_'));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
int rgb = Integer.parseInt(unparsed.replace("#", "")); int rgb = Integer.parseInt(unparsed.replace("#", ""), 16);
color = DyeColor.getByColor(org.bukkit.Color.fromRGB(rgb)); color = DyeColor.getByColor(org.bukkit.Color.fromRGB(rgb));
} }
if (color == null) if (color == null)