Add preventing spawn debug

This commit is contained in:
fullwall 2020-10-12 22:49:09 +08:00
parent 675eaffad5
commit 9eb254215f

View File

@ -415,11 +415,13 @@ public class EventListen implements Listener {
|| event.getReason() == DespawnReason.RELOAD) { || event.getReason() == DespawnReason.RELOAD) {
if (event.getNPC().getStoredLocation() != null) { if (event.getNPC().getStoredLocation() != null) {
ChunkCoord coord = new ChunkCoord(event.getNPC().getStoredLocation()); ChunkCoord coord = new ChunkCoord(event.getNPC().getStoredLocation());
Messaging.debug("Preventing further respawns of", event.getNPC().getId(), "at", coord, if (Messaging.isDebugging()) {
"due to DespawnReason." + event.getReason()); Messaging.debug("Preventing further respawns of", event.getNPC().getId(), "at", coord,
"due to DespawnReason." + event.getReason());
}
toRespawn.remove(coord, event.getNPC()); toRespawn.remove(coord, event.getNPC());
} }
} else { } else if (Messaging.isDebugging()) {
Messaging.debug("Removing " + event.getNPC().getId() + " from skin tracker due to DespawnReason." Messaging.debug("Removing " + event.getNPC().getId() + " from skin tracker due to DespawnReason."
+ event.getReason().name()); + event.getReason().name());
} }
@ -451,7 +453,12 @@ public class EventListen implements Listener {
if (location == null) { if (location == null) {
location = event.getLocation(); 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) @EventHandler(ignoreCancelled = true)