mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-18 14:47:47 +01:00
Add debug logging for teleports (relates to #1521)
This commit is contained in:
parent
b5c028301b
commit
c96e28f726
@ -1,5 +1,6 @@
|
|||||||
package fr.xephi.authme.service;
|
package fr.xephi.authme.service;
|
||||||
|
|
||||||
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.data.auth.PlayerCache;
|
import fr.xephi.authme.data.auth.PlayerCache;
|
||||||
import fr.xephi.authme.data.limbo.LimboPlayer;
|
import fr.xephi.authme.data.limbo.LimboPlayer;
|
||||||
@ -63,12 +64,13 @@ public class TeleportationService implements Reloadable {
|
|||||||
public void teleportOnJoin(final Player player) {
|
public void teleportOnJoin(final Player player) {
|
||||||
if (!settings.getProperty(RestrictionSettings.NO_TELEPORT)
|
if (!settings.getProperty(RestrictionSettings.NO_TELEPORT)
|
||||||
&& settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) {
|
&& settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) {
|
||||||
|
ConsoleLogger.debug("Teleport on join for player `{0}`", player.getName());
|
||||||
teleportToSpawn(player, playerCache.isAuthenticated(player.getName()));
|
teleportToSpawn(player, playerCache.isAuthenticated(player.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the player's custom on join location
|
* Returns the player's custom on join location.
|
||||||
*
|
*
|
||||||
* @param player the player to process
|
* @param player the player to process
|
||||||
*
|
*
|
||||||
@ -82,10 +84,11 @@ public class TeleportationService implements Reloadable {
|
|||||||
SpawnTeleportEvent event = new SpawnTeleportEvent(player, location,
|
SpawnTeleportEvent event = new SpawnTeleportEvent(player, location,
|
||||||
playerCache.isAuthenticated(player.getName()));
|
playerCache.isAuthenticated(player.getName()));
|
||||||
bukkitService.callEvent(event);
|
bukkitService.callEvent(event);
|
||||||
if(!isEventValid(event)) {
|
if (!isEventValid(event)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConsoleLogger.debug("Returning custom location for >1.9 join event for player `{0}`", player.getName());
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -107,6 +110,7 @@ public class TeleportationService implements Reloadable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!player.hasPlayedBefore() || !dataSource.isAuthAvailable(player.getName())) {
|
if (!player.hasPlayedBefore() || !dataSource.isAuthAvailable(player.getName())) {
|
||||||
|
ConsoleLogger.debug("Attempting to teleport player `{0}` to first spawn", player.getName());
|
||||||
performTeleportation(player, new FirstSpawnTeleportEvent(player, firstSpawn));
|
performTeleportation(player, new FirstSpawnTeleportEvent(player, firstSpawn));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,12 +134,15 @@ public class TeleportationService implements Reloadable {
|
|||||||
|
|
||||||
// The world in LimboPlayer is from where the player comes, before any teleportation by AuthMe
|
// The world in LimboPlayer is from where the player comes, before any teleportation by AuthMe
|
||||||
if (mustForceSpawnAfterLogin(worldName)) {
|
if (mustForceSpawnAfterLogin(worldName)) {
|
||||||
|
ConsoleLogger.debug("Teleporting `{0}` to spawn because of 'force-spawn after login'", player.getName());
|
||||||
teleportToSpawn(player, true);
|
teleportToSpawn(player, true);
|
||||||
} else if (settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) {
|
} else if (settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) {
|
||||||
if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION) && auth.getQuitLocY() != 0) {
|
if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION) && auth.getQuitLocY() != 0) {
|
||||||
Location location = buildLocationFromAuth(player, auth);
|
Location location = buildLocationFromAuth(player, auth);
|
||||||
|
ConsoleLogger.debug("Teleporting `{0}` after login, based on the player auth", player.getName());
|
||||||
teleportBackFromSpawn(player, location);
|
teleportBackFromSpawn(player, location);
|
||||||
} else if (limbo != null && limbo.getLocation() != null) {
|
} else if (limbo != null && limbo.getLocation() != null) {
|
||||||
|
ConsoleLogger.debug("Teleporting `{0}` after login, based on the limbo player", player.getName());
|
||||||
teleportBackFromSpawn(player, limbo.getLocation());
|
teleportBackFromSpawn(player, limbo.getLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,9 +198,11 @@ public class SpawnLoader implements Reloadable {
|
|||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
if (spawnLoc != null) {
|
if (spawnLoc != null) {
|
||||||
|
ConsoleLogger.debug("Spawn location determined as `{0}` for world `{1}`", spawnLoc, world.getName());
|
||||||
return spawnLoc;
|
return spawnLoc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ConsoleLogger.debug("Fall back to default world spawn location. World: `{0}`", world.getName());
|
||||||
return world.getSpawnLocation(); // return default location
|
return world.getSpawnLocation(); // return default location
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user