Add spawnreason to debug

This commit is contained in:
fullwall 2020-11-17 09:09:52 +08:00
parent e29f05156d
commit 0add70d397

View File

@ -231,11 +231,11 @@ public class CitizensNPC extends AbstractNPC {
Preconditions.checkNotNull(at, "location cannot be null"); Preconditions.checkNotNull(at, "location cannot be null");
Preconditions.checkNotNull(reason, "reason cannot be null"); Preconditions.checkNotNull(reason, "reason cannot be null");
if (isSpawned()) { if (isSpawned()) {
Messaging.debug("Tried to spawn", getId(), "while already spawned."); Messaging.debug("Tried to spawn", getId(), "while already spawned. SpawnReason." + reason);
return false; return false;
} }
if (at.getWorld() == null) { if (at.getWorld() == null) {
Messaging.debug("Tried to spawn", getId(), "but the world was null."); Messaging.debug("Tried to spawn", getId(), "but the world was null. SpawnReason." + reason);
return false; return false;
} }
data().get(NPC.DEFAULT_PROTECTED_METADATA, true); data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
@ -261,8 +261,8 @@ public class CitizensNPC extends AbstractNPC {
} }
} else { } else {
if (Messaging.isDebugging()) { if (Messaging.isDebugging()) {
Messaging.debug("Retrying spawn of", getId(), "later. Was loaded", loaded, "is loaded", Messaging.debug("Retrying spawn of", getId(), "later, SpawnReason." + reason + ". Was loaded", loaded,
Util.isLoaded(at)); "is loaded", Util.isLoaded(at));
} }
// we need to wait before trying to spawn // we need to wait before trying to spawn
entityController.remove(); entityController.remove();
@ -283,7 +283,7 @@ public class CitizensNPC extends AbstractNPC {
if (spawnEvent.isCancelled()) { if (spawnEvent.isCancelled()) {
entityController.remove(); entityController.remove();
Messaging.debug("Couldn't spawn", getId(), "due to event cancellation."); Messaging.debug("Couldn't spawn", getId(), "SpawnReason." + reason + " due to event cancellation.");
return false; return false;
} }