diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java index 686a6708..4daaf8fc 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java @@ -71,6 +71,10 @@ public class BukkitListener implements Listener { ex.printStackTrace(); } + if (plugin.getConfiguration().get(ConfigKeys.DEBUG_LOGINS)) { + plugin.getLog().info("Processing pre-login for " + e.getUniqueId() + " - " + e.getName()); + } + /* there was an issue connecting to the DB, performing file i/o, etc. we don't let players join in this case, because it means they can connect to the server without their permissions data. some server admins rely on negating perms to stop users from causing damage etc, so it's really important that @@ -139,6 +143,11 @@ public class BukkitListener implements Listener { At this point, the users data should be present and loaded. */ final Player player = e.getPlayer(); + + if (plugin.getConfiguration().get(ConfigKeys.DEBUG_LOGINS)) { + plugin.getLog().info("Processing login for " + player.getUniqueId() + " - " + player.getName()); + } + final User user = plugin.getUserManager().getIfLoaded(plugin.getUuidCache().getUUID(player.getUniqueId())); /* User instance is null for whatever reason. Could be that it was unloaded between asyncpre and now. */ diff --git a/bukkit/src/main/resources/config.yml b/bukkit/src/main/resources/config.yml index b678fe46..76cd1df8 100644 --- a/bukkit/src/main/resources/config.yml +++ b/bukkit/src/main/resources/config.yml @@ -70,6 +70,10 @@ use-server-uuids: true # in the LuckPerms cache. use-server-uuid-cache: false +# If LuckPerms should produce extra logging output when it handles logins. +# Useful if you're having issues with UUID forwarding or data not being loaded. +debug-logins: false + # If the plugin should send log notifications to users whenever permissions are modified. log-notify: true diff --git a/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java b/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java index 002dbd81..3e1ed165 100644 --- a/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java +++ b/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java @@ -70,6 +70,10 @@ public class BungeeListener implements Listener { final PendingConnection c = e.getConnection(); + if (plugin.getConfiguration().get(ConfigKeys.DEBUG_LOGINS)) { + plugin.getLog().info("Processing pre-login for " + c.getUniqueId() + " - " + c.getName()); + } + /* there was an issue connecting to the DB, performing file i/o, etc. as this is bungeecord, we will still allow the login, as players can't really do much harm without permissions data. the proxy will just fallback to using the config file perms. */ @@ -118,6 +122,10 @@ public class BungeeListener implements Listener { final ProxiedPlayer player = e.getPlayer(); final User user = plugin.getUserManager().getIfLoaded(plugin.getUuidCache().getUUID(e.getPlayer().getUniqueId())); + if (plugin.getConfiguration().get(ConfigKeys.DEBUG_LOGINS)) { + plugin.getLog().info("Processing post-login for " + player.getUniqueId() + " - " + player.getName()); + } + if (user == null) { plugin.getProxy().getScheduler().schedule(plugin, () -> { if (!player.isConnected()) { diff --git a/bungee/src/main/resources/config.yml b/bungee/src/main/resources/config.yml index 435ac60a..f6cb0371 100644 --- a/bungee/src/main/resources/config.yml +++ b/bungee/src/main/resources/config.yml @@ -73,6 +73,10 @@ use-server-uuids: true # try to find a uuid for a username using RedisBungee, if installed. use-server-uuid-cache: false +# If LuckPerms should produce extra logging output when it handles logins. +# Useful if you're having issues with UUID forwarding or data not being loaded. +debug-logins: false + # If the plugin should send log notifications to users whenever permissions are modified. log-notify: true diff --git a/common/src/main/java/me/lucko/luckperms/common/config/ConfigKeys.java b/common/src/main/java/me/lucko/luckperms/common/config/ConfigKeys.java index 31c8a7a1..0845c9f4 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/ConfigKeys.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/ConfigKeys.java @@ -122,6 +122,11 @@ public class ConfigKeys { */ public static final ConfigKey USE_SERVER_UUID_CACHE = BooleanKey.of("use-server-uuid-cache", false); + /** + * If LuckPerms should produce extra logging output when it handles logins. + */ + public static final ConfigKey DEBUG_LOGINS = BooleanKey.of("debug-logins", false); + /** * Controls how temporary add commands should behave */ diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeListener.java b/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeListener.java index 33fbe7df..68b086a4 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeListener.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeListener.java @@ -29,6 +29,7 @@ import lombok.RequiredArgsConstructor; import me.lucko.luckperms.api.caching.UserData; import me.lucko.luckperms.api.context.MutableContextSet; +import me.lucko.luckperms.common.config.ConfigKeys; import me.lucko.luckperms.common.locale.Message; import me.lucko.luckperms.common.model.User; import me.lucko.luckperms.common.utils.LoginHelper; @@ -72,6 +73,10 @@ public class SpongeListener { final GameProfile p = e.getProfile(); + if (plugin.getConfiguration().get(ConfigKeys.DEBUG_LOGINS)) { + plugin.getLog().info("Processing auth event for " + p.getUniqueId() + " - " + p.getName()); + } + /* either the plugin hasn't finished starting yet, or there was an issue connecting to the DB, performing file i/o, etc. we don't let players join in this case, because it means they can connect to the server without their permissions data. some server admins rely on negating perms to stop users from causing damage etc, so it's really important that @@ -142,6 +147,10 @@ public class SpongeListener { final GameProfile player = e.getProfile(); + if (plugin.getConfiguration().get(ConfigKeys.DEBUG_LOGINS)) { + plugin.getLog().info("Processing login event for " + player.getUniqueId() + " - " + player.getName()); + } + final User user = plugin.getUserManager().getIfLoaded(plugin.getUuidCache().getUUID(player.getUniqueId())); /* User instance is null for whatever reason. Could be that it was unloaded between asyncpre and now. */ diff --git a/sponge/src/main/resources/luckperms.conf b/sponge/src/main/resources/luckperms.conf index a5412136..866ee529 100644 --- a/sponge/src/main/resources/luckperms.conf +++ b/sponge/src/main/resources/luckperms.conf @@ -69,6 +69,10 @@ use-server-uuids=true # in the LuckPerms cache. use-server-uuid-cache=false +# If LuckPerms should produce extra logging output when it handles logins. +# Useful if you're having issues with UUID forwarding or data not being loaded. +debug-logins=false + # If the plugin should send log notifications to users whenever permissions are modified. log-notify=true