Fix entity uuid map memory leak

This commit is contained in:
themode 2020-12-30 20:29:46 +01:00
parent 835a769080
commit 23fc19430a

View File

@ -1219,12 +1219,13 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
/** /**
* Removes the entity from the server immediately. * Removes the entity from the server immediately.
* <p> * <p>
* WARNING: this do not trigger the {@link EntityDeathEvent} event. * WARNING: this does not trigger {@link EntityDeathEvent}.
*/ */
public void remove() { public void remove() {
this.removed = true; this.removed = true;
this.shouldRemove = true; this.shouldRemove = true;
entityById.remove(id); Entity.entityById.remove(id);
Entity.entityByUuid.remove(uuid);
if (instance != null) if (instance != null)
instance.UNSAFE_removeEntity(this); instance.UNSAFE_removeEntity(this);
} }