2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-12-23 10:38: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) {
Jedis rsc = pool.getResource();
try {
rsc.sadd("server:" + configuration.getServerId() + ":usersOnline", event.getPlayer().getName());
rsc.hset("player:" + event.getPlayer().getName(), "online", "0");
if (rsc.hexists("player:" + event.getPlayer().getName(), "server")) {
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 {
pool.returnResource(rsc);
}