Restore changes

This commit is contained in:
fullwall 2014-03-04 19:51:14 +08:00
parent 28f3c587a7
commit f3e2ccb309
2 changed files with 7 additions and 2 deletions

View File

@ -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);
}

View File

@ -354,6 +354,10 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
}
}
public static void registerControllerType(EntityType type, Class<? extends MovementController> clazz) {
controllerTypes.put(type, clazz);
}
private static final Map<EntityType, Class<? extends MovementController>> controllerTypes = Maps
.newEnumMap(EntityType.class);