From 31b3f0af892472d79f741465079c62c002bec0b2 Mon Sep 17 00:00:00 2001 From: vemacs Date: Tue, 20 May 2014 17:00:15 -0600 Subject: [PATCH] Use API to get serverId --- .../com/imaginarycode/minecraft/redisbungee/RedisBungee.java | 4 ++-- .../minecraft/redisbungee/RedisBungeeConsumer.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java index 93778c3..9a16c83 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java @@ -57,7 +57,7 @@ public final class RedisBungee extends Plugin { @Getter private static Gson gson = new Gson(); @Getter - private static String serverId; + private String serverId; private static RedisBungeeAPI api; private static PubSubListener psl = null; @@ -351,8 +351,8 @@ public final class RedisBungee extends Plugin { getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.SendToAll(this)); getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.ServerId(this)); getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.ServerIds()); - getProxy().getPluginManager().registerListener(this, new RedisBungeeListener(this)); api = new RedisBungeeAPI(this); + getProxy().getPluginManager().registerListener(this, new RedisBungeeListener(this)); psl = new PubSubListener(); getProxy().getScheduler().runAsync(this, psl); getProxy().getScheduler().schedule(this, new Runnable() { diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeConsumer.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeConsumer.java index 296290a..3474cfb 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeConsumer.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeConsumer.java @@ -46,7 +46,7 @@ public class RedisBungeeConsumer implements Runnable { private void handle(ConsumerEvent event, Jedis jedis) { if (event instanceof PlayerLoggedInConsumerEvent) { PlayerLoggedInConsumerEvent event1 = (PlayerLoggedInConsumerEvent) event; - jedis.sadd("server:" + RedisBungee.getServerId() + ":usersOnline", event1.getPlayer().getUniqueId().toString()); + jedis.sadd("server:" + RedisBungee.getApi().getServerId() + ":usersOnline", event1.getPlayer().getUniqueId().toString()); jedis.hset("player:" + event1.getPlayer().getUniqueId().toString(), "online", "0"); jedis.hset("player:" + event1.getPlayer().getUniqueId().toString(), "ip", event1.getPlayer().getAddress().getAddress().getHostAddress()); jedis.hset("player:" + event1.getPlayer().getUniqueId().toString(), "name", event1.getPlayer().getName());