mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-22 20:28:00 +00:00
TIL you can clone yourself
This commit is contained in:
parent
983d7567da
commit
7ff324c6d8
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user