From f3e2ccb30907aee534e318ad9bcc7f5d6e25fd4e Mon Sep 17 00:00:00 2001 From: fullwall Date: Tue, 4 Mar 2014 19:51:14 +0800 Subject: [PATCH] Restore changes --- src/main/java/net/citizensnpcs/commands/NPCCommands.java | 5 +++-- src/main/java/net/citizensnpcs/trait/Controllable.java | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/citizensnpcs/commands/NPCCommands.java b/src/main/java/net/citizensnpcs/commands/NPCCommands.java index ea3aec979..61cafc493 100644 --- a/src/main/java/net/citizensnpcs/commands/NPCCommands.java +++ b/src/main/java/net/citizensnpcs/commands/NPCCommands.java @@ -1068,7 +1068,7 @@ public class NPCCommands { permission = "citizens.npc.rename") public void rename(CommandContext args, CommandSender sender, NPC npc) { String oldName = npc.getName(); - String newName = args.getJoinedStrings(1); + String newName = Colorizer.parseColors(args.getJoinedStrings(1)); if (newName.length() > 16) { Messaging.sendErrorTr(sender, Messages.NPC_NAME_TOO_LONG); newName = newName.substring(0, 15); @@ -1076,8 +1076,9 @@ public class NPCCommands { Location prev = npc.isSpawned() ? npc.getEntity().getLocation() : null; npc.despawn(DespawnReason.PENDING_RESPAWN); npc.setName(newName); - if (prev != null) + if (prev != null) { npc.spawn(prev); + } Messaging.sendTr(sender, Messages.NPC_RENAMED, oldName, newName); } diff --git a/src/main/java/net/citizensnpcs/trait/Controllable.java b/src/main/java/net/citizensnpcs/trait/Controllable.java index 0f2e65f7c..687af0ab8 100644 --- a/src/main/java/net/citizensnpcs/trait/Controllable.java +++ b/src/main/java/net/citizensnpcs/trait/Controllable.java @@ -354,6 +354,10 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab } } + public static void registerControllerType(EntityType type, Class clazz) { + controllerTypes.put(type, clazz); + } + private static final Map> controllerTypes = Maps .newEnumMap(EntityType.class);