2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-12-23 18:48:02 +00:00

Readd the clone detection.

This commit is contained in:
Tux 2013-12-15 12:07:42 -05:00
parent adf61b7b8d
commit 17ba11a284

View File

@ -302,6 +302,23 @@ public final class RedisBungee extends Plugin implements Listener {
}
}
@EventHandler
public void onPreLogin(PreLoginEvent event) {
if (pool != null) {
Jedis rsc = pool.getResource();
try {
for (String server : configuration.getLinkedServers()) {
if (rsc.sismember("server:" + server + ":usersOnline", event.getConnection().getName())) {
event.setCancelled(true);
event.setCancelReason("You are already logged on to this server.");
}
}
} finally {
pool.returnResource(rsc);
}
}
}
@EventHandler
public void onPlayerConnect(final PostLoginEvent event) {
if (pool != null) {