mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-09 20:21:02 +01:00
Attempt to Fix #407
This commit is contained in:
parent
5ec1b67e03
commit
627db6b9cf
@ -193,7 +193,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.isForceSurvivalModeEnabled
|
if (Settings.isForceSurvivalModeEnabled
|
||||||
&& !player.hasPermission(PlayerPermission.BYPASS_FORCE_SURVIVAL.getNode())) {
|
&& !player.hasPermission(PlayerPermission.BYPASS_FORCE_SURVIVAL.getNode())) {
|
||||||
player.setGameMode(GameMode.SURVIVAL);
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
PlayerAuth auth = plugin.getDataSource().getAuth(event.getName());
|
PlayerAuth auth = plugin.getDataSource().getAuth(event.getName());
|
||||||
if (Settings.preventOtherCase && auth != null && auth.getRealName() != null) {
|
if (Settings.preventOtherCase && auth != null && auth.getRealName() != null) {
|
||||||
String realName = auth.getRealName();
|
String realName = auth.getRealName();
|
||||||
if(!realName.isEmpty() && !realName.equals("Player") && !realName.equals(event.getName())) {
|
if (!realName.isEmpty() && !realName.equals("Player") && !realName.equals(event.getName())) {
|
||||||
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
|
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
|
||||||
// TODO: Add a message like : MessageKey.INVALID_NAME_CASE
|
// TODO: Add a message like : MessageKey.INVALID_NAME_CASE
|
||||||
event.setKickMessage("You should join using username: " + ChatColor.AQUA + realName +
|
event.setKickMessage("You should join using username: " + ChatColor.AQUA + realName +
|
||||||
@ -274,21 +274,26 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
// Get the permissions manager
|
// Get the permissions manager
|
||||||
PermissionsManager permsMan = plugin.getPermissionsManager();
|
PermissionsManager permsMan = plugin.getPermissionsManager();
|
||||||
|
|
||||||
if (event.getResult() == PlayerLoginEvent.Result.KICK_FULL
|
if (event.getResult() == PlayerLoginEvent.Result.KICK_FULL) {
|
||||||
&& permsMan.hasPermission(player, PlayerPermission.IS_VIP)) {
|
if (permsMan.hasPermission(player, PlayerPermission.IS_VIP)) {
|
||||||
int playersOnline = Utils.getOnlinePlayers().size();
|
int playersOnline = Utils.getOnlinePlayers().size();
|
||||||
if (playersOnline > plugin.getServer().getMaxPlayers()) {
|
if (playersOnline > plugin.getServer().getMaxPlayers()) {
|
||||||
event.allow();
|
|
||||||
} else {
|
|
||||||
Player pl = plugin.generateKickPlayer(Utils.getOnlinePlayers());
|
|
||||||
if (pl != null) {
|
|
||||||
pl.kickPlayer(m.retrieveSingle(MessageKey.KICK_FOR_VIP));
|
|
||||||
event.allow();
|
event.allow();
|
||||||
} else {
|
} else {
|
||||||
ConsoleLogger.info("The player " + event.getPlayer().getName() + " tried to join, but the server was full");
|
Player pl = plugin.generateKickPlayer(Utils.getOnlinePlayers());
|
||||||
event.setKickMessage(m.retrieveSingle(MessageKey.KICK_FULL_SERVER));
|
if (pl != null) {
|
||||||
event.setResult(PlayerLoginEvent.Result.KICK_FULL);
|
pl.kickPlayer(m.retrieveSingle(MessageKey.KICK_FOR_VIP));
|
||||||
|
event.allow();
|
||||||
|
} else {
|
||||||
|
ConsoleLogger.info("The player " + event.getPlayer().getName() + " tried to join, but the server was full");
|
||||||
|
event.setKickMessage(m.retrieveSingle(MessageKey.KICK_FULL_SERVER));
|
||||||
|
event.setResult(PlayerLoginEvent.Result.KICK_FULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
event.setKickMessage(m.retrieveSingle(MessageKey.KICK_FULL_SERVER));
|
||||||
|
event.setResult(PlayerLoginEvent.Result.KICK_FULL);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,12 +301,6 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getResult() == PlayerLoginEvent.Result.KICK_FULL && !permsMan.hasPermission(player, PlayerPermission.IS_VIP)) {
|
|
||||||
event.setKickMessage(m.retrieveSingle(MessageKey.KICK_FULL_SERVER));
|
|
||||||
event.setResult(PlayerLoginEvent.Result.KICK_FULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String name = player.getName().toLowerCase();
|
final String name = player.getName().toLowerCase();
|
||||||
boolean isAuthAvailable = plugin.getDataSource().isAuthAvailable(name);
|
boolean isAuthAvailable = plugin.getDataSource().isAuthAvailable(name);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user