Skip to content

Commit

Permalink
Other potential fix for that one
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 1, 2016
1 parent 7b0df7e commit 6259246
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions plugin/src/main/java/net/aufdemrand/denizen/npc/dNPCRegistry.java
Expand Up @@ -9,6 +9,7 @@
import net.aufdemrand.denizen.utilities.debugging.dB;
import net.aufdemrand.denizen.utilities.depends.Depends;
import net.aufdemrand.denizencore.events.OldEventManager;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.event.NPCDespawnEvent;
import net.citizensnpcs.api.event.NPCRemoveEvent;
import net.citizensnpcs.api.event.NPCSpawnEvent;
Expand Down Expand Up @@ -88,7 +89,6 @@ private static void _registerNPC(NPC npc) {
if (!denizenNPCs.containsKey(npc.getId())) {
_registerNPC(new dNPC(npc));
}
// dB.log("Constructing NPC " + getDenizen(npc).toString());
}

/**
Expand All @@ -99,22 +99,11 @@ private static void _registerNPC(NPC npc) {
* @return a dNPC
*/
public static dNPC getDenizen(NPC npc) {
if (npc == null) {
return null;
}
if (!denizenNPCs.containsKey(npc.getId())) {
_registerNPC(npc);
}
return denizenNPCs.get(npc.getId());
return new dNPC(npc);
}

public static dNPC getDenizen(int id) {
if (denizenNPCs.containsKey(id)) {
return denizenNPCs.get(id);
}
else {
return null;
}
return new dNPC(CitizensAPI.getNPCRegistry().getById(id));
}

/**
Expand Down Expand Up @@ -187,7 +176,7 @@ public void onSpawn(NPCSpawnEvent event) {
("npc spawns"),
new BukkitScriptEntryData(null, dNPC.mirrorCitizensNPC(event.getNPC())), null);
// On Spawn action
getDenizen(event.getNPC()).action("spawn", null);
new dNPC(event.getNPC()).action("spawn", null);
}


Expand Down

0 comments on commit 6259246

Please sign in to comment.