Skip to content

Commit

Permalink
Pass two: delete on despawn
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 2, 2015
1 parent cc92225 commit 4b15826
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/net/aufdemrand/denizen/flags/FlagManager.java
Expand Up @@ -145,6 +145,10 @@ public static void clearNPCFlags(int npcid) {
DenizenAPI.getCurrentInstance().getSaves().set("NPCs." + npcid, null);
}

public static void clearEntityFlags(dEntity entity) {
DenizenAPI.getCurrentInstance().getSaves().set("Entities." + entity.getSaveName(), null);
}

/**
* Returns a NPC Flag object. If this flag currently exists
* it will be populated with the current values. If the flag does NOT exist,
Expand Down
Expand Up @@ -2,6 +2,7 @@


import net.aufdemrand.denizen.events.scriptevents.EntityDespawnScriptEvent;
import net.aufdemrand.denizen.flags.FlagManager;
import net.aufdemrand.denizen.objects.dEntity;
import net.aufdemrand.denizen.utilities.DenizenAPI;
import net.aufdemrand.denizen.utilities.world.DenizenWorldAccess;
Expand Down Expand Up @@ -162,5 +163,6 @@ public static void unlinkEntity(Entity ent) {
if (ent == null || ent.getUniqueId() == null)
return;
entities.remove(ent.getUniqueId());
FlagManager.clearEntityFlags(new dEntity(ent));
}
}

0 comments on commit 4b15826

Please sign in to comment.