2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2025-04-20 01:27:07 +00:00

Removed player count caching and fixed typo (ported from the efficient-server-listing branch).

This commit is contained in:
Tux 2014-08-18 15:33:51 -04:00
parent ad67e1c60c
commit 5102c39ee6
2 changed files with 1 additions and 8 deletions

View File

@ -62,7 +62,6 @@ public final class RedisBungee extends Plugin {
private static PubSubListener psl = null; private static PubSubListener psl = null;
private List<String> serverIds; private List<String> serverIds;
private AtomicInteger nagAboutServers = new AtomicInteger(); private AtomicInteger nagAboutServers = new AtomicInteger();
private int globalCount;
/** /**
* Fetch the {@link RedisBungeeAPI} object created on plugin start. * Fetch the {@link RedisBungeeAPI} object created on plugin start.
@ -126,10 +125,6 @@ public final class RedisBungee extends Plugin {
} }
final int getCount() { final int getCount() {
return globalCount;
}
final int getCurrentCount() {
int c = 0; int c = 0;
if (pool != null) { if (pool != null) {
Jedis rsc = pool.getResource(); Jedis rsc = pool.getResource();
@ -246,7 +241,6 @@ public final class RedisBungee extends Plugin {
pool.returnResource(tmpRsc); pool.returnResource(tmpRsc);
} }
serverIds = getCurrentServerIds(); serverIds = getCurrentServerIds();
globalCount = getCurrentCount();
uuidTranslator = new UUIDTranslator(this); uuidTranslator = new UUIDTranslator(this);
getProxy().getScheduler().schedule(this, new Runnable() { getProxy().getScheduler().schedule(this, new Runnable() {
@Override @Override
@ -262,7 +256,6 @@ public final class RedisBungee extends Plugin {
pool.returnResource(rsc); pool.returnResource(rsc);
} }
serverIds = getCurrentServerIds(); serverIds = getCurrentServerIds();
globalCount = getCurrentCount();
} }
}, 0, 3, TimeUnit.SECONDS); }, 0, 3, TimeUnit.SECONDS);
consumer = new RedisBungeeConsumer(this); consumer = new RedisBungeeConsumer(this);

View File

@ -58,7 +58,7 @@ public class RedisBungeeConsumer implements Runnable {
} else if (event instanceof PlayerLoggedOffConsumerEvent) { } else if (event instanceof PlayerLoggedOffConsumerEvent) {
PlayerLoggedOffConsumerEvent event1 = (PlayerLoggedOffConsumerEvent) event; PlayerLoggedOffConsumerEvent event1 = (PlayerLoggedOffConsumerEvent) event;
Pipeline pipeline = jedis.pipelined(); Pipeline pipeline = jedis.pipelined();
jedis.hset("player:" + event1.getPlayer().getUniqueId().toString(), "online", String.valueOf(System.currentTimeMillis())); pipeline.hset("player:" + event1.getPlayer().getUniqueId().toString(), "online", String.valueOf(System.currentTimeMillis()));
RedisUtil.cleanUpPlayer(event1.getPlayer().getUniqueId().toString(), pipeline); RedisUtil.cleanUpPlayer(event1.getPlayer().getUniqueId().toString(), pipeline);
pipeline.publish("redisbungee-data", RedisBungee.getGson().toJson(new DataManager.DataManagerMessage(event1.getPlayer().getUniqueId(), DataManager.DataManagerMessage.Action.LEAVE))); pipeline.publish("redisbungee-data", RedisBungee.getGson().toJson(new DataManager.DataManagerMessage(event1.getPlayer().getUniqueId(), DataManager.DataManagerMessage.Action.LEAVE)));
pipeline.sync(); pipeline.sync();