From f1ec5a2248b70b03a3cb6d4fa80604b3d437a1b2 Mon Sep 17 00:00:00 2001 From: sanjay900 Date: Thu, 18 Dec 2014 22:55:30 +1300 Subject: [PATCH] Im an idiot... Why did i set it every tick? --- .../java/net/citizensnpcs/commands/NPCCommands.java | 4 ++-- src/main/java/net/citizensnpcs/trait/RabbitType.java | 11 ++++------- src/main/resources/messages_en.properties | 6 +++++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/citizensnpcs/commands/NPCCommands.java b/src/main/java/net/citizensnpcs/commands/NPCCommands.java index 70e88af46..ca44d590a 100644 --- a/src/main/java/net/citizensnpcs/commands/NPCCommands.java +++ b/src/main/java/net/citizensnpcs/commands/NPCCommands.java @@ -1083,7 +1083,7 @@ public class NPCCommands { npc.destroy(); Messaging.sendTr(sender, Messages.NPC_REMOVED, npc.getName()); } - + @Command( aliases = { "npc" }, usage = "rabbittype [type]", @@ -1102,7 +1102,7 @@ public class NPCCommands { npc.getTrait(RabbitType.class).setType(type); Messaging.sendTr(sender, Messages.RABBIT_TYPE_SET, npc.getName(), type.name()); } - + @Command( aliases = { "npc" }, usage = "rename [name]", diff --git a/src/main/java/net/citizensnpcs/trait/RabbitType.java b/src/main/java/net/citizensnpcs/trait/RabbitType.java index 058dbbd06..e4cdbafa3 100644 --- a/src/main/java/net/citizensnpcs/trait/RabbitType.java +++ b/src/main/java/net/citizensnpcs/trait/RabbitType.java @@ -21,17 +21,14 @@ public class RabbitType extends Trait { rabbit = npc.getEntity() instanceof Rabbit ? (Rabbit) npc.getEntity() : null; } - @Override - public void run() { + public void setType(RabbitTypes type) { + + this.type = type; if (rabbit != null) { ((EntityRabbit)((CraftRabbit)rabbit).getHandle()).r(type.type); } } - - public void setType(RabbitTypes type) { - - this.type = type; - } + public enum RabbitTypes { BROWN(0), diff --git a/src/main/resources/messages_en.properties b/src/main/resources/messages_en.properties index 9237e7d4d..269e7c80c 100644 --- a/src/main/resources/messages_en.properties +++ b/src/main/resources/messages_en.properties @@ -83,6 +83,8 @@ 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.set=[[{0}]] is now a [[{1}]]. +citizens.commands.npc.rabbittype.invalid-type=Invalid rabbit type. +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. citizens.commands.npc.remove.removed=You permanently removed [[{0}]]. @@ -99,6 +101,8 @@ citizens.commands.npc.sound.set={0}''s sounds are now: ambient - [[{1}]] hurt - 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.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. @@ -172,7 +176,7 @@ citizens.editors.equipment.sheep-coloured=[[{0}]] is now coloured [[{1}]]. citizens.editors.selection.start-prompt=There were multiple NPCs with the supplied name.
Please enter an id or number from the list below to select that NPC. citizens.editors.text.add-prompt=Enter text to add to the NPC. citizens.editors.text.added-entry=[[Added]] the entry [[{0}]]. -citizens.editors.text.begin=Entered the text editor! Type 'exit' to leave the editor. +citizens.editors.text.begin=Entered the text editor! citizens.editors.text.change-page-prompt=Enter a page number to view more text entries. citizens.editors.text.close-talker-set=[[Close talker]] set to [[{0}]]. citizens.editors.text.edit-begin-prompt=Enter the index of the entry you wish to edit or [[page]] to view more pages.