use of com.bergerkiller.bukkit.common.collections.EntityMap in project BKCommonLib by bergerhealer.
the class CommonPlugin method notifyRemovedFromServer.
public void notifyRemovedFromServer(org.bukkit.World world, org.bukkit.entity.Entity e, boolean removeFromChangeSet) {
// Also remove from the set tracking these changes
if (removeFromChangeSet) {
this.entitiesRemovedFromServer.remove(e);
}
// Remove from maps
Iterator<SoftReference<EntityMap>> iter = this.maps.iterator();
while (iter.hasNext()) {
EntityMap map = iter.next().get();
if (map == null) {
iter.remove();
} else {
map.remove(e);
}
}
// Fire events
if (CommonUtil.hasHandlers(EntityRemoveFromServerEvent.getHandlerList())) {
CommonUtil.callEvent(new EntityRemoveFromServerEvent(e));
}
// Remove any entity controllers set for the entities that were removed
EntityHook hook = EntityHook.get(HandleConversion.toEntityHandle(e), EntityHook.class);
if (hook != null && hook.hasController()) {
hook.getController().getEntity().setController(null);
}
}
Aggregations