From 44b6da408d3c44cc0cf1e5553cfd3e0a2203d272 Mon Sep 17 00:00:00 2001 From: fullwall Date: Thu, 9 Jul 2020 23:43:27 +0800 Subject: [PATCH] Simplify marker removal --- .../net/citizensnpcs/trait/waypoint/EntityMarkers.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/trait/waypoint/EntityMarkers.java b/main/src/main/java/net/citizensnpcs/trait/waypoint/EntityMarkers.java index 2a72d4e07..e67b723e5 100644 --- a/main/src/main/java/net/citizensnpcs/trait/waypoint/EntityMarkers.java +++ b/main/src/main/java/net/citizensnpcs/trait/waypoint/EntityMarkers.java @@ -14,6 +14,7 @@ import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.MemoryNPCDataStore; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPCRegistry; +import net.citizensnpcs.npc.ai.NPCHolder; /** * A helper class for storing a number of entity markers. By default an entity marker is a non-persisted EnderSignal. @@ -50,16 +51,14 @@ public class EntityMarkers { } public void destroyMarkers() { - for (Entity entity : markers.values()) { - entity.remove(); - } + registry.deregisterAll(); markers.clear(); } public void removeMarker(T marker) { Entity entity = markers.remove(marker); if (entity != null) { - entity.remove(); + ((NPCHolder) entity).getNPC().destroy(); } }