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

Better checking

This commit is contained in:
Tux 2014-06-26 03:34:16 -04:00
parent 32219a3fff
commit 718b020bf2

View File

@ -214,8 +214,9 @@ public final class RedisBungee extends Plugin {
if (pool != null) { if (pool != null) {
Jedis tmpRsc = pool.getResource(); Jedis tmpRsc = pool.getResource();
try { try {
if (tmpRsc.hexists("player:" + uuid, "server")) String result = tmpRsc.hget("player:" + uuid, "server");
server = getProxy().getServerInfo(tmpRsc.hget("player:" + uuid, "server")); if (result != null)
server = getProxy().getServerInfo(result);
} catch (JedisConnectionException e) { } catch (JedisConnectionException e) {
// Redis server has disappeared! // Redis server has disappeared!
getLogger().log(Level.SEVERE, "Unable to get connection from pool - did your Redis server go away?", e); getLogger().log(Level.SEVERE, "Unable to get connection from pool - did your Redis server go away?", e);
@ -234,9 +235,10 @@ public final class RedisBungee extends Plugin {
if (pool != null) { if (pool != null) {
Jedis tmpRsc = pool.getResource(); Jedis tmpRsc = pool.getResource();
try { try {
if (tmpRsc.hexists("player:" + uuid, "online")) String result = tmpRsc.hget("player:" + uuid, "online");
if (result != null)
try { try {
time = Long.valueOf(tmpRsc.hget("player:" + uuid, "online")); time = Long.valueOf(result);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
getLogger().info("I found a funny number for when " + uuid + " was last online!"); getLogger().info("I found a funny number for when " + uuid + " was last online!");
boolean found = false; boolean found = false;
@ -276,8 +278,9 @@ public final class RedisBungee extends Plugin {
if (pool != null) { if (pool != null) {
Jedis tmpRsc = pool.getResource(); Jedis tmpRsc = pool.getResource();
try { try {
if (tmpRsc.hexists("player:" + uuid, "ip")) String result = tmpRsc.hget("player:" + uuid, "ip");
ia = InetAddress.getByName(tmpRsc.hget("player:" + uuid, "ip")); if (result != null)
ia = InetAddress.getByName(result);
} catch (JedisConnectionException e) { } catch (JedisConnectionException e) {
// Redis server has disappeared! // Redis server has disappeared!
getLogger().log(Level.SEVERE, "Unable to get connection from pool - did your Redis server go away?", e); getLogger().log(Level.SEVERE, "Unable to get connection from pool - did your Redis server go away?", e);