From 8f1aff3a11c5d3ec7ccc4d05c368bb1f1d5fa4d3 Mon Sep 17 00:00:00 2001 From: Tux Date: Wed, 24 Jun 2015 07:04:01 -0400 Subject: [PATCH] Simplify getLocalPlayersAsUuidStrings() as it was too redundant. --- .../minecraft/redisbungee/RedisBungee.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java index 4051aef..a26ba38 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java @@ -26,7 +26,6 @@ */ package com.imaginarycode.minecraft.redisbungee; -import com.google.common.base.Functions; import com.google.common.collect.*; import com.google.common.io.ByteStreams; import com.google.gson.Gson; @@ -193,15 +192,12 @@ public final class RedisBungee extends Plugin { return c; } - private Set getLocalPlayers() { - ImmutableSet.Builder setBuilder = ImmutableSet.builder(); - for (ProxiedPlayer pp : getProxy().getPlayers()) - setBuilder = setBuilder.add(pp.getUniqueId()); - return setBuilder.build(); - } - - private Collection getLocalPlayersAsUuidStrings() { - return Collections2.transform(getLocalPlayers(), Functions.toStringFunction()); + private Set getLocalPlayersAsUuidStrings() { + ImmutableSet.Builder builder = ImmutableSet.builder(); + for (ProxiedPlayer player : getProxy().getPlayers()) { + builder.add(player.getUniqueId().toString()); + } + return builder.build(); } final Set getPlayers() { @@ -321,7 +317,7 @@ public final class RedisBungee extends Plugin { @Override public void run() { try (Jedis tmpRsc = pool.getResource()) { - Set players = new HashSet<>(getLocalPlayersAsUuidStrings()); + Set players = getLocalPlayersAsUuidStrings(); Set redisCollection = tmpRsc.smembers("proxy:" + configuration.getServerId() + ":usersOnline"); for (String member : redisCollection) {