mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-22 20:28:00 +00:00
Simplify getLocalPlayersAsUuidStrings() as it was too redundant.
This commit is contained in:
parent
21710fcd8e
commit
8f1aff3a11
@ -26,7 +26,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.imaginarycode.minecraft.redisbungee;
|
package com.imaginarycode.minecraft.redisbungee;
|
||||||
|
|
||||||
import com.google.common.base.Functions;
|
|
||||||
import com.google.common.collect.*;
|
import com.google.common.collect.*;
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
@ -193,15 +192,12 @@ public final class RedisBungee extends Plugin {
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<UUID> getLocalPlayers() {
|
private Set<String> getLocalPlayersAsUuidStrings() {
|
||||||
ImmutableSet.Builder<UUID> setBuilder = ImmutableSet.builder();
|
ImmutableSet.Builder<String> builder = ImmutableSet.builder();
|
||||||
for (ProxiedPlayer pp : getProxy().getPlayers())
|
for (ProxiedPlayer player : getProxy().getPlayers()) {
|
||||||
setBuilder = setBuilder.add(pp.getUniqueId());
|
builder.add(player.getUniqueId().toString());
|
||||||
return setBuilder.build();
|
}
|
||||||
}
|
return builder.build();
|
||||||
|
|
||||||
private Collection<String> getLocalPlayersAsUuidStrings() {
|
|
||||||
return Collections2.transform(getLocalPlayers(), Functions.toStringFunction());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final Set<UUID> getPlayers() {
|
final Set<UUID> getPlayers() {
|
||||||
@ -321,7 +317,7 @@ public final class RedisBungee extends Plugin {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try (Jedis tmpRsc = pool.getResource()) {
|
try (Jedis tmpRsc = pool.getResource()) {
|
||||||
Set<String> players = new HashSet<>(getLocalPlayersAsUuidStrings());
|
Set<String> players = getLocalPlayersAsUuidStrings();
|
||||||
Set<String> redisCollection = tmpRsc.smembers("proxy:" + configuration.getServerId() + ":usersOnline");
|
Set<String> redisCollection = tmpRsc.smembers("proxy:" + configuration.getServerId() + ":usersOnline");
|
||||||
|
|
||||||
for (String member : redisCollection) {
|
for (String member : redisCollection) {
|
||||||
|
Loading…
Reference in New Issue
Block a user