diff --git a/game/plugin/api/src/org/apollo/game/plugins/api/world.kt b/game/plugin/api/src/org/apollo/game/plugins/api/world.kt index 5a550879..8d77ce1c 100644 --- a/game/plugin/api/src/org/apollo/game/plugins/api/world.kt +++ b/game/plugin/api/src/org/apollo/game/plugins/api/world.kt @@ -46,7 +46,7 @@ class ExpireObjectTask( respawning = true setDelay(respawnDelay) } else { - region.removeEntity(replacement, false) + region.removeEntity(replacement) world.spawn(obj) stop() } diff --git a/game/src/main/java/org/apollo/game/model/area/Region.java b/game/src/main/java/org/apollo/game/model/area/Region.java index e5150d45..df7a9a17 100644 --- a/game/src/main/java/org/apollo/game/model/area/Region.java +++ b/game/src/main/java/org/apollo/game/model/area/Region.java @@ -334,23 +334,13 @@ public final class Region { listeners.forEach(listener -> listener.execute(this, entity, type)); } - /** - * Removes an {@link Entity} from this Region and notifies listeners. - * - * @param entity The Entity. - * @throws IllegalArgumentException If the Entity does not belong in this Region, or if it was never added. - */ - public void removeEntity(Entity entity) { - removeEntity(entity, true); - } - /** * Removes an {@link Entity} from this Region. * * @param entity The Entity. * @throws IllegalArgumentException If the Entity does not belong in this Region, or if it was never added. */ - public void removeEntity(Entity entity, boolean notifyListeners) { + public void removeEntity(Entity entity) { EntityType type = entity.getEntityType(); if (type.isTransient()) { throw new IllegalArgumentException("Tried to remove a transient Entity (" + entity + ") from " + @@ -366,9 +356,7 @@ public final class Region { throw new IllegalArgumentException("Entity (" + entity + ") belongs in (" + this + ") but does not exist."); } - if (notifyListeners) { - notifyListeners(entity, EntityUpdateType.REMOVE); - } + notifyListeners(entity, EntityUpdateType.REMOVE); } @Override @@ -425,7 +413,9 @@ public final class Region { } else { // TODO should this really be possible? removedObjects.get(height).remove(inverse); } - } else if (update == EntityUpdateType.REMOVE && !type.isTransient()) { + } + + if (update == EntityUpdateType.REMOVE && !type.isTransient()) { updates.remove(inverse); }