More debug messages
This commit is contained in:
@@ -23,24 +23,31 @@ public class Events implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!e.getPlayer().hasPlayedBefore()) {
|
if (!e.getPlayer().hasPlayedBefore()) {
|
||||||
if (GoSpawn.instance.getConfig().getBoolean("debug")) {
|
GoSpawn.instance.debug("Player '" + e.getPlayer().getName() + "' has not played here before.");
|
||||||
GoSpawn.instance.getLogger().info("Player '" + e.getPlayer().getName() + "' has not played here before.");
|
|
||||||
}
|
|
||||||
e.setSpawnLocation(loc);
|
e.setSpawnLocation(loc);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (GoSpawn.instance.getConfig().getBoolean("debug")) {
|
GoSpawn.instance.debug("Player '" + e.getPlayer().getName() + "' has already played here before.");
|
||||||
GoSpawn.instance.getLogger().info("Player '" + e.getPlayer().getName() + "' has already played here before.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Location currentLoc = e.getSpawnLocation();
|
Location currentLoc = e.getSpawnLocation();
|
||||||
|
|
||||||
|
GoSpawn.instance.debug("Current world of player '" + e.getPlayer().getName() + "' is " + currentLoc.getWorld().getName() + "(" + currentLoc.getWorld().getUID() + ")");
|
||||||
|
|
||||||
if (GoSpawn.instance.shouldForceRespawnIfInWorld(currentLoc.getWorld())) {
|
if (GoSpawn.instance.shouldForceRespawnIfInWorld(currentLoc.getWorld())) {
|
||||||
e.setSpawnLocation(loc);
|
e.setSpawnLocation(loc);
|
||||||
|
GoSpawn.instance.debug("Config says that " + e.getPlayer().getName() + " should be teleported to the spawn, because their world is not whitelisted.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID lastWorld = GoSpawn.instance.getPlayerLastWorld(e.getPlayer());
|
UUID lastWorld = GoSpawn.instance.getPlayerLastWorld(e.getPlayer());
|
||||||
|
|
||||||
|
if (lastWorld == null) {
|
||||||
|
GoSpawn.instance.debug("No last world stored for player " + e.getPlayer().getName() + ".");
|
||||||
|
} else {
|
||||||
|
GoSpawn.instance.debug("The UID of the last world of player " + e.getPlayer().getName() + " is " + lastWorld + ".");
|
||||||
|
}
|
||||||
|
|
||||||
if (lastWorld != null && Bukkit.getWorld(lastWorld) == null) {
|
if (lastWorld != null && Bukkit.getWorld(lastWorld) == null) {
|
||||||
e.setSpawnLocation(loc);
|
e.setSpawnLocation(loc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,4 +201,10 @@ public final class GoSpawn extends JavaPlugin {
|
|||||||
long configCooldown = getConfig().getLong("spawn-cooldown") * 1000;
|
long configCooldown = getConfig().getLong("spawn-cooldown") * 1000;
|
||||||
return Math.max(0, configCooldown - timeElapsed);
|
return Math.max(0, configCooldown - timeElapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void debug(String msg) {
|
||||||
|
if (getConfig().getBoolean("debug")) {
|
||||||
|
getLogger().info("[DEBUG] " + msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user