use of net.minecraft.server.v1_8_R1.WorldServer in project Citizens2 by CitizensDev.
the class NMSImpl method replaceTrackerEntry.
@Override
public void replaceTrackerEntry(Player player) {
WorldServer server = (WorldServer) NMSImpl.getHandle(player).getWorld();
EntityTrackerEntry entry = server.getTracker().trackedEntities.get(player.getEntityId());
if (entry == null)
return;
PlayerlistTrackerEntry replace = new PlayerlistTrackerEntry(entry);
server.getTracker().trackedEntities.a(player.getEntityId(), replace);
if (TRACKED_ENTITY_SET != null) {
try {
Set<Object> set = (Set<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
set.remove(entry);
set.add(replace);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
if (getHandle(player) instanceof EntityHumanNPC) {
((EntityHumanNPC) getHandle(player)).setTracked(replace);
}
}
use of net.minecraft.server.v1_8_R1.WorldServer in project Citizens2 by CitizensDev.
the class LlamaSpitController method createEntity.
@Override
protected Entity createEntity(Location at, NPC npc) {
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(ws, npc);
handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
return handle.getBukkitEntity();
}
use of net.minecraft.server.v1_8_R1.WorldServer in project Citizens2 by CitizensDev.
the class LlamaSpitController method createEntity.
@Override
protected Entity createEntity(Location at, NPC npc) {
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(ws, npc);
handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
return handle.getBukkitEntity();
}
use of net.minecraft.server.v1_8_R1.WorldServer in project Citizens2 by CitizensDev.
the class EggController method createEntity.
@Override
protected Entity createEntity(Location at, NPC npc) {
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
final EntityEggNPC handle = new EntityEggNPC(ws, npc, at.getX(), at.getY(), at.getZ());
return handle.getBukkitEntity();
}
use of net.minecraft.server.v1_8_R1.WorldServer in project Citizens2 by CitizensDev.
the class NMSImpl method removeFromWorld.
@Override
public void removeFromWorld(org.bukkit.entity.Entity entity) {
Preconditions.checkNotNull(entity);
Entity nmsEntity = ((CraftEntity) entity).getHandle();
((WorldServer) nmsEntity.world).removeEntity(nmsEntity);
}
Aggregations