final Set<UUID> getPlayers() { ImmutableSet.Builder<UUID> setBuilder = ImmutableSet.builder(); if (pool != null) { try (Jedis rsc = pool.getResource()) { List<String> keys = new ArrayList<>(); for (String i : getServerIds()) { keys.add("proxy:" + i + ":usersOnline"); } if (!keys.isEmpty()) { Set<String> users = rsc.sunion(keys.toArray(new String[keys.size()])); if (users != null && !users.isEmpty()) { for (String user : users) { try { setBuilder = setBuilder.add(UUID.fromString(user)); } catch (IllegalArgumentException ignored) { } } } } } catch (JedisConnectionException e) { // Redis server has disappeared! getLogger() .log( Level.SEVERE, "Unable to get connection from pool - did your Redis server go away?", e); throw new RuntimeException("Unable to get all players online", e); } } return setBuilder.build(); }
private long getRedisTime(List<String> timeRes) { return Long.parseLong(timeRes.get(0)); }