2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-23 04:28:01 +00:00

TIL you can clone yourself

This commit is contained in:
Tux 2013-11-26 19:43:40 -05:00
parent 983d7567da
commit 7ff324c6d8

View File

@ -247,8 +247,12 @@ public class RedisBungee extends Plugin implements Listener {
public void onPlayerConnect(final PostLoginEvent event) { public void onPlayerConnect(final PostLoginEvent event) {
Jedis rsc = pool.getResource(); Jedis rsc = pool.getResource();
try { try {
rsc.sadd("server:" + configuration.getServerId() + ":usersOnline", event.getPlayer().getName()); if (rsc.hexists("player:" + event.getPlayer().getName(), "server")) {
rsc.hset("player:" + event.getPlayer().getName(), "online", "0"); event.getPlayer().disconnect("You are already logged on this server.");
} else {
rsc.sadd("server:" + configuration.getServerId() + ":usersOnline", event.getPlayer().getName());
rsc.hset("player:" + event.getPlayer().getName(), "online", "0");
}
} finally { } finally {
pool.returnResource(rsc); pool.returnResource(rsc);
} }