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

more try-with-resources.

This commit is contained in:
Tux 2015-06-06 16:39:10 -04:00
parent 86efdeaf8e
commit 665d73af0c

View File

@ -42,14 +42,14 @@ public class RedisBungeeListener implements Listener {
@EventHandler
public void onPlayerConnect(final PostLoginEvent event) {
Jedis rsc = plugin.getPool().getResource();
try {
try (Jedis rsc = plugin.getPool().getResource()) {
for (String server : plugin.getServerIds()) {
if (rsc.sismember("proxy:" + server + ":usersOnline", event.getPlayer().getUniqueId().toString())) {
event.getPlayer().disconnect(ALREADY_LOGGED_IN);
return;
}
}
}
plugin.getService().submit(new RedisCallable<Void>(plugin) {
@Override
@ -65,9 +65,6 @@ public class RedisBungeeListener implements Listener {
return null;
}
});
} finally {
plugin.getPool().returnResource(rsc);
}
}
@EventHandler