diff --git a/src/main/java/net/citizensnpcs/commands/NPCCommands.java b/src/main/java/net/citizensnpcs/commands/NPCCommands.java index ca44d590a..8e0e31ed3 100644 --- a/src/main/java/net/citizensnpcs/commands/NPCCommands.java +++ b/src/main/java/net/citizensnpcs/commands/NPCCommands.java @@ -58,6 +58,7 @@ import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.StringHelper; import net.citizensnpcs.util.Util; +import org.apache.commons.lang3.StringUtils; import org.bukkit.Bukkit; import org.bukkit.DyeColor; import org.bukkit.GameMode; @@ -1039,7 +1040,7 @@ public class NPCCommands { String profession = args.getString(1); Profession parsed = Util.matchEnum(Profession.values(), profession.toUpperCase()); if (parsed == null) { - throw new CommandException(Messages.INVALID_PROFESSION); + throw new CommandException(Messages.INVALID_PROFESSION,args.getString(1),StringUtils.join(Profession.values(), ",")); } npc.getTrait(VillagerProfession.class).setProfession(parsed); Messaging.sendTr(sender, Messages.PROFESSION_SET, npc.getName(), profession); @@ -1088,7 +1089,7 @@ public class NPCCommands { aliases = { "npc" }, usage = "rabbittype [type]", desc = "Set the Type of a Rabbit NPC", - modifiers = { "rabbittype" }, + modifiers = { "rabbittype","rbtype" }, min = 2, permission = "citizens.npc.rabbittype") @Requirements(selected = true, ownership = true, types = { EntityType.RABBIT }) @@ -1097,7 +1098,7 @@ public class NPCCommands { try { type = RabbitTypes.valueOf(args.getString(1).toUpperCase()); } catch (IllegalArgumentException ex) { - throw new CommandException(Messages.INVALID_RABBIT_TYPE); + throw new CommandException(Messages.INVALID_RABBIT_TYPE,StringUtils.join(RabbitTypes.values(), ",")); } npc.getTrait(RabbitType.class).setType(type); Messaging.sendTr(sender, Messages.RABBIT_TYPE_SET, npc.getName(), type.name()); @@ -1197,9 +1198,12 @@ public class NPCCommands { "skeletontype", "sktype" }, min = 2, max = 2, permission = "citizens.npc.skeletontype") @Requirements(selected = true, ownership = true, types = EntityType.SKELETON) public void skeletonType(CommandContext args, CommandSender sender, NPC npc) throws CommandException { - SkeletonType type = SkeletonType.valueOf(args.getString(1).toUpperCase()); - if (type == null) - throw new CommandException(Messages.INVALID_SKELETON_TYPE); + SkeletonType type; + try { + type = SkeletonType.valueOf(args.getString(1).toUpperCase()); + } catch (IllegalArgumentException ex) { + throw new CommandException(Messages.INVALID_SKELETON_TYPE,StringUtils.join(SkeletonType.values(), ",")); + } npc.getTrait(NPCSkeletonType.class).setType(type); Messaging.sendTr(sender, Messages.SKELETON_TYPE_SET, npc.getName(), type); } diff --git a/src/main/resources/messages_en.properties b/src/main/resources/messages_en.properties index 327a28465..067937775 100644 --- a/src/main/resources/messages_en.properties +++ b/src/main/resources/messages_en.properties @@ -81,9 +81,9 @@ citizens.commands.npc.pose.missing=The pose [[{0}]] does not exist. citizens.commands.npc.pose.removed=Pose removed. citizens.commands.npc.powered.set=[[{0}]] will now be powered. citizens.commands.npc.powered.stopped=[[{0}]] will no longer be powered. -citizens.commands.npc.profession.invalid-profession={0} is not a valid profession. +citizens.commands.npc.profession.invalid-profession=[[{0}]] is not a valid profession. Try one of the following: [[{1}]]. citizens.commands.npc.profession.set=[[{0}]] is now a [[{1}]]. -citizens.commands.npc.rabbittype.invalid-type=Invalid rabbit type. +citizens.commands.npc.rabbittype.invalid-type=Invalid rabbit type. Try one of the following: [[{0}]]. citizens.commands.npc.rabbittype.type-set=[[{0}]]''s rabbit type has been set to [[{1}]] citizens.commands.npc.remove.incorrect-syntax=Incorrect syntax. /npc remove (all) citizens.commands.npc.remove.removed-all=You permanently removed all NPCs. @@ -100,9 +100,7 @@ citizens.commands.npc.sound.invalid-sound=Invalid sound. citizens.commands.npc.sound.set={0}''s sounds are now: ambient - [[{1}]] hurt - [[{2}]] and death - [[{3}]]. citizens.commands.npc.sound.info={0}''s sounds are: ambient - [[{1}]] hurt - [[{2}]] and death - [[{3}]].

Valid sounds are {4}. citizens.commands.npc.skeletontype.set={0}''s skeleton type set to [[{1}]]. -citizens.commands.npc.skeletontype.invalid-type=Invalid skeleton type. -citizens.commands.npc.rabbittype.set={0}''s rabbit type set to [[{1}]]. -citizens.commands.npc.rabbittype.invalid-type=Invalid rabbit Type. +citizens.commands.npc.skeletontype.invalid-type=Invalid skeleton type. Try one of the following: [[{0}]]. citizens.commands.npc.spawn.already-spawned=[[{0}]] is already spawned at another location. Use ''/npc tphere'' to teleport the NPC to your location. citizens.commands.npc.spawn.missing-npc-id=No NPC with the ID {0} exists. citizens.commands.npc.spawn.no-location=No stored location available - command must be used ingame.