Example #1
0
 public Set<UUID> getPlayersOnProxy(String server) {
   checkArgument(getServerIds().contains(server), server + " is not a valid proxy ID");
   try (Jedis jedis = pool.getResource()) {
     Set<String> users = jedis.smembers("proxy:" + server + ":usersOnline");
     ImmutableSet.Builder<UUID> builder = ImmutableSet.builder();
     for (String user : users) {
       builder.add(UUID.fromString(user));
     }
     return builder.build();
   }
 }
Example #2
0
  @Override
  public void onDisable() {
    if (pool != null) {
      // Poison the PubSub listener
      psl.poison();
      getProxy().getScheduler().cancel(this);
      integrityCheck.cancel();
      heartbeatTask.cancel();
      getProxy().getPluginManager().unregisterListeners(this);

      try (Jedis tmpRsc = pool.getResource()) {
        tmpRsc.hdel("heartbeats", configuration.getServerId());
        if (tmpRsc.scard("proxy:" + configuration.getServerId() + ":usersOnline") > 0) {
          Set<String> players =
              tmpRsc.smembers("proxy:" + configuration.getServerId() + ":usersOnline");
          for (String member : players) RedisUtil.cleanUpPlayer(member, tmpRsc);
        }
      }

      pool.destroy();
    }
  }