diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/DataManager.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/DataManager.java index 220a69c..b1927f2 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/DataManager.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/DataManager.java @@ -76,11 +76,11 @@ public class DataManager implements Listener { }, 1, 1, TimeUnit.MINUTES); } - public static InternalCache createCache() { + private static InternalCache createCache() { return new InternalCache<>(); } - public static InternalCache createCache(long entryWriteExpiry) { + private static InternalCache createCache(long entryWriteExpiry) { return new InternalCache<>(entryWriteExpiry); } diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java index 7634700..4051aef 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java @@ -84,7 +84,7 @@ public final class RedisBungee extends Plugin { @Getter private static OkHttpClient httpClient; private List serverIds; - private AtomicInteger nagAboutServers = new AtomicInteger(); + private final AtomicInteger nagAboutServers = new AtomicInteger(); private ScheduledTask integrityCheck; private ScheduledTask heartbeatTask; private boolean usingLua; @@ -107,7 +107,7 @@ public final class RedisBungee extends Plugin { return serverIds; } - final List getCurrentServerIds() { + private List getCurrentServerIds() { try (Jedis jedis = pool.getResource()) { int nag = nagAboutServers.decrementAndGet(); if (nag <= 0) { @@ -193,21 +193,21 @@ public final class RedisBungee extends Plugin { return c; } - final Set getLocalPlayers() { + private Set getLocalPlayers() { ImmutableSet.Builder setBuilder = ImmutableSet.builder(); for (ProxiedPlayer pp : getProxy().getPlayers()) setBuilder = setBuilder.add(pp.getUniqueId()); return setBuilder.build(); } - final Collection getLocalPlayersAsUuidStrings() { + private Collection getLocalPlayersAsUuidStrings() { return Collections2.transform(getLocalPlayers(), Functions.toStringFunction()); } final Set getPlayers() { ImmutableSet.Builder setBuilder = ImmutableSet.builder(); if (pool != null) { - try (Jedis rsc = pool.getResource();) { + try (Jedis rsc = pool.getResource()) { List keys = new ArrayList<>(); for (String i : getServerIds()) { keys.add("proxy:" + i + ":usersOnline"); @@ -454,12 +454,12 @@ public final class RedisBungee extends Plugin { crashFile.delete(); } else if (rsc.hexists("heartbeats", serverId)) { try { - Long value = Long.valueOf(rsc.hget("heartbeats", serverId)); - if (value != null && System.currentTimeMillis() < value + 20000) { + long value = Long.parseLong(rsc.hget("heartbeats", serverId)); + if (System.currentTimeMillis() < value + 20000) { getLogger().severe("You have launched a possible impostor BungeeCord instance. Another instance is already running."); getLogger().severe("For data consistency reasons, RedisBungee will now disable itself."); getLogger().severe("If this instance is coming up from a crash, create a file in your RedisBungee plugins directory with the name 'restarted_from_crash.txt' and RedisBungee will not perform this check."); - throw new RuntimeException("Possible imposter instance!"); + throw new RuntimeException("Possible impostor instance!"); } } catch (NumberFormatException ignored) { } @@ -523,7 +523,7 @@ public final class RedisBungee extends Plugin { } } - class JedisPubSubHandler extends JedisPubSub { + private class JedisPubSubHandler extends JedisPubSub { @Override public void onMessage(final String s, final String s2) { if (s2.trim().length() == 0) return; diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDFetcher.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDFetcher.java index aaff413..0d7614f 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDFetcher.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDFetcher.java @@ -51,7 +51,7 @@ public class UUIDFetcher implements Callable> { @Setter private static OkHttpClient httpClient; - public UUIDFetcher(List names, boolean rateLimiting) { + private UUIDFetcher(List names, boolean rateLimiting) { this.names = ImmutableList.copyOf(names); this.rateLimiting = rateLimiting; }