mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-23 11:05:49 +01:00
Add --registry to /npc list, let getNPC(Entity) use the Entity handle
This commit is contained in:
parent
63023cc54f
commit
28f3c587a7
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user