2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2026-04-08 16:10:26 +00:00

add config option to restore old kick behavior pre 0.9.0

This commit is contained in:
2022-11-27 12:29:13 +04:00
parent 31e461a11c
commit c8362a44ec
6 changed files with 39 additions and 9 deletions

View File

@@ -58,7 +58,15 @@ public class RedisBungeeBungeeListener extends AbstractRedisBungeeListener<Login
if (event.isCancelled()) {
return null;
}
if (api.isPlayerOnline(event.getConnection().getUniqueId())) {
if (plugin.getConfiguration().restoreOldKickBehavior()) {
for (String s : plugin.getProxiesIds()) {
if (unifiedJedis.sismember("proxy:" + s + ":usersOnline", event.getConnection().getUniqueId().toString())) {
event.setCancelled(true);
event.setCancelReason(plugin.getConfiguration().getMessages().get(RedisBungeeConfiguration.MessageType.ALREADY_LOGGED_IN));
return null;
}
}
} else if (api.isPlayerOnline(event.getConnection().getUniqueId())) {
PlayerUtils.setKickedOtherLocation(event.getConnection().getUniqueId().toString(), unifiedJedis);
api.kickPlayer(event.getConnection().getUniqueId(), plugin.getConfiguration().getMessages().get(RedisBungeeConfiguration.MessageType.LOGGED_IN_OTHER_LOCATION));
}