use of com.bergerkiller.generated.net.minecraft.server.EntityHandle in project BKCommonLib by bergerhealer.
the class ExtendedEntity method getLeashHolder.
/**
* Gets the Entity that is holding this Entity by a leash. If this Entity
* does not support leashing, or the Entity is not on a leash, null is
* returned instead.
*
* @return Leash holder
*/
public org.bukkit.entity.Entity getLeashHolder() {
if (handle.isInstanceOf(EntityInsentientHandle.T)) {
EntityInsentientHandle insHandle = EntityInsentientHandle.createHandle(handle.getRaw());
EntityHandle holder = insHandle.getLeashHolder();
if (holder != null) {
return holder.toBukkit();
}
}
return null;
}
use of com.bergerkiller.generated.net.minecraft.server.EntityHandle in project BKCommonLib by bergerhealer.
the class WorldUtil method removeEntity.
/**
* Removes a single entity from the world
*
* @param entity to remove
*/
public static void removeEntity(org.bukkit.entity.Entity entity) {
EntityHandle e = CommonNMS.getHandle(entity);
e.getWorld().removeEntity(e);
e.getWorldServer().getEntityTracker().stopTracking(entity);
}
Aggregations