mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-06 08:40:03 +00:00
Clear static object REMOVE messages when re-adding
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user