mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-10-05 08:47:39 +02:00
Attempt to detect and warn about CraftBukkit + offline mode problems (#1439)
This commit is contained in:
parent
ae63a42c2e
commit
46072eb465
@ -50,12 +50,32 @@ import java.util.concurrent.TimeUnit;
|
||||
public class BukkitConnectionListener extends AbstractConnectionListener implements Listener {
|
||||
private final LPBukkitPlugin plugin;
|
||||
|
||||
private final boolean detectedCraftBukkitOfflineMode;
|
||||
|
||||
private final Set<UUID> deniedAsyncLogin = Collections.synchronizedSet(new HashSet<>());
|
||||
private final Set<UUID> deniedLogin = Collections.synchronizedSet(new HashSet<>());
|
||||
|
||||
public BukkitConnectionListener(LPBukkitPlugin plugin) {
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
|
||||
// check for craftbukkit + offline mode combination
|
||||
String version = plugin.getBootstrap().getServer().getVersion();
|
||||
boolean onlineMode = plugin.getBootstrap().getServer().getOnlineMode();
|
||||
|
||||
if (!onlineMode && version.startsWith("git-Bukkit-")) {
|
||||
printCraftBukkitOfflineModeError();
|
||||
this.detectedCraftBukkitOfflineMode = true;
|
||||
} else {
|
||||
this.detectedCraftBukkitOfflineMode = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void printCraftBukkitOfflineModeError() {
|
||||
this.plugin.getLogger().warn("It appears that your server is running CraftBukkit and configured in offline (cracked) mode.");
|
||||
this.plugin.getLogger().warn("Due to a CraftBukkit limitation, LuckPerms cannot function correctly in this setup.");
|
||||
this.plugin.getLogger().warn("To resolve this, please either a) upgrade from CraftBukkit to Spigot or Paper, or b) enable online-mode.");
|
||||
this.plugin.getLogger().warn("For more info, please see: https://github.com/lucko/LuckPerms/wiki/Installation#craftbukkit-and-offline-mode");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
@ -134,9 +154,17 @@ public class BukkitConnectionListener extends AbstractConnectionListener impleme
|
||||
this.deniedLogin.add(player.getUniqueId());
|
||||
|
||||
if (!getUniqueConnections().contains(player.getUniqueId())) {
|
||||
|
||||
this.plugin.getLogger().warn("User " + player.getUniqueId() + " - " + player.getName() +
|
||||
" doesn't have data pre-loaded, they have never been processed during pre-login in this session." +
|
||||
" - denying login.");
|
||||
|
||||
if (this.detectedCraftBukkitOfflineMode) {
|
||||
printCraftBukkitOfflineModeError();
|
||||
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, Message.LOADING_STATE_ERROR_CB_OFFLINE_MODE.asString(this.plugin.getLocaleManager()));
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
this.plugin.getLogger().warn("User " + player.getUniqueId() + " - " + player.getName() +
|
||||
" doesn't currently have data pre-loaded, but they have been processed before in this session." +
|
||||
|
@ -65,6 +65,7 @@ public enum Message {
|
||||
PLAYER_OFFLINE("&cOffline", false),
|
||||
LOADING_DATABASE_ERROR("&cA database error occurred whilst loading permissions data. Please try again later.", true),
|
||||
LOADING_STATE_ERROR("&cPermissions data for your user was not loaded during the pre-login stage - unable to continue. Please try again later.", true),
|
||||
LOADING_STATE_ERROR_CB_OFFLINE_MODE("&cPermissions data for your user was not loaded during the pre-login stage - this is likely due to a conflict between CraftBukkit and the online-mode setting. Please check the server console for more information.", true),
|
||||
LOADING_SETUP_ERROR("&cAn unexpected error occurred whilst setting up your permissions data. Please try again later.", true),
|
||||
OP_DISABLED("&bThe vanilla OP system is disabled on this server.", false),
|
||||
OP_DISABLED_SPONGE("&2Please note that Server Operator status has no effect on Sponge permission checks when a permission plugin is installed. Please edit user data directly.", true),
|
||||
|
Loading…
Reference in New Issue
Block a user