Add login debug option

This commit is contained in:
Luck 2017-08-27 13:54:26 +01:00
parent 39aaa8a292
commit 509826949d
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
7 changed files with 43 additions and 0 deletions

View File

@ -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. */

View File

@ -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

View File

@ -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()) {

View File

@ -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

View File

@ -122,6 +122,11 @@ public class ConfigKeys {
*/
public static final ConfigKey<Boolean> 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<Boolean> DEBUG_LOGINS = BooleanKey.of("debug-logins", false);
/**
* Controls how temporary add commands should behave
*/

View File

@ -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. */

View File

@ -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