Skip to content

Commit

Permalink
Restore changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Mar 4, 2014
1 parent c9b7c9d commit 0b405e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/net/citizensnpcs/commands/NPCCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -1068,16 +1068,17 @@ public void remove(CommandContext args, CommandSender sender, NPC npc) throws Co
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);
}
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);
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/net/citizensnpcs/trait/Controllable.java
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ public void run(Player rider) {
}
}

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

Expand Down

0 comments on commit 0b405e7

Please sign in to comment.