mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-23 04:28:01 +00:00
more try-with-resources.
This commit is contained in:
parent
86efdeaf8e
commit
665d73af0c
@ -42,14 +42,14 @@ public class RedisBungeeListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerConnect(final PostLoginEvent event) {
|
public void onPlayerConnect(final PostLoginEvent event) {
|
||||||
Jedis rsc = plugin.getPool().getResource();
|
try (Jedis rsc = plugin.getPool().getResource()) {
|
||||||
try {
|
|
||||||
for (String server : plugin.getServerIds()) {
|
for (String server : plugin.getServerIds()) {
|
||||||
if (rsc.sismember("proxy:" + server + ":usersOnline", event.getPlayer().getUniqueId().toString())) {
|
if (rsc.sismember("proxy:" + server + ":usersOnline", event.getPlayer().getUniqueId().toString())) {
|
||||||
event.getPlayer().disconnect(ALREADY_LOGGED_IN);
|
event.getPlayer().disconnect(ALREADY_LOGGED_IN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
plugin.getService().submit(new RedisCallable<Void>(plugin) {
|
plugin.getService().submit(new RedisCallable<Void>(plugin) {
|
||||||
@Override
|
@Override
|
||||||
@ -65,9 +65,6 @@ public class RedisBungeeListener implements Listener {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} finally {
|
|
||||||
plugin.getPool().returnResource(rsc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
Loading…
Reference in New Issue
Block a user