2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-12-23 18:48:02 +00:00

Use API to get serverId

This commit is contained in:
vemacs 2014-05-20 17:00:15 -06:00
parent f9fbbb388a
commit 31b3f0af89
2 changed files with 3 additions and 3 deletions

View File

@ -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() {

View File

@ -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());