Add --registry to /npc list, let getNPC(Entity) use the Entity handle

This commit is contained in:
fullwall 2014-03-04 19:49:32 +08:00
parent 63023cc54f
commit 28f3c587a7
3 changed files with 2 additions and 9 deletions

View File

@ -1075,7 +1075,7 @@ public class NPCCommands {
}
Location prev = npc.isSpawned() ? npc.getEntity().getLocation() : null;
npc.despawn(DespawnReason.PENDING_RESPAWN);
npc.setName(Colorizer.parseColors(newName));
npc.setName(newName);
if (prev != null)
npc.spawn(prev);

View File

@ -23,7 +23,6 @@ import net.citizensnpcs.util.NMS;
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
@ -120,9 +119,7 @@ public class CitizensNPCRegistry implements NPCRegistry {
return null;
if (entity instanceof NPCHolder)
return ((NPCHolder) entity).getNPC();
if (!(entity instanceof LivingEntity))
return null;
Object handle = NMS.getHandle((LivingEntity) entity);
Object handle = NMS.getHandle(entity);
return handle instanceof NPCHolder ? ((NPCHolder) handle).getNPC() : null;
}

View File

@ -353,10 +353,6 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
handle.motY *= 0.98F;
}
}
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);