Skip to content

Commit

Permalink
Add preventing spawn debug
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Oct 12, 2020
1 parent 675eaff commit 9eb2542
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions main/src/main/java/net/citizensnpcs/EventListen.java
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,13 @@ public void onNPCDespawn(NPCDespawnEvent event) {
|| event.getReason() == DespawnReason.RELOAD) {
if (event.getNPC().getStoredLocation() != null) {
ChunkCoord coord = new ChunkCoord(event.getNPC().getStoredLocation());
Messaging.debug("Preventing further respawns of", event.getNPC().getId(), "at", coord,
"due to DespawnReason." + event.getReason());
if (Messaging.isDebugging()) {
Messaging.debug("Preventing further respawns of", event.getNPC().getId(), "at", coord,
"due to DespawnReason." + event.getReason());
}
toRespawn.remove(coord, event.getNPC());
}
} else {
} else if (Messaging.isDebugging()) {
Messaging.debug("Removing " + event.getNPC().getId() + " from skin tracker due to DespawnReason."
+ event.getReason().name());
}
Expand Down Expand Up @@ -451,7 +453,12 @@ public void onNPCSpawn(NPCSpawnEvent event) {
if (location == null) {
location = event.getLocation();
}
toRespawn.remove(new ChunkCoord(location), event.getNPC());
ChunkCoord coord = new ChunkCoord(location);
if (Messaging.isDebugging()) {
Messaging.debug("Preventing further spawns of", event.getNPC().getId(), "at", coord,
"due to SpawnReason." + event.getReason());
}
toRespawn.remove(coord, event.getNPC());
}

@EventHandler(ignoreCancelled = true)
Expand Down

0 comments on commit 9eb2542

Please sign in to comment.