mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-12-23 18:48:02 +00:00
Ran inspections on code. Fixed compile errors.
This commit is contained in:
parent
8bf80450ca
commit
527f76ac6b
@ -512,7 +512,7 @@ public final class RedisBungee extends Plugin {
|
||||
}
|
||||
|
||||
class JedisPubSubHandler extends JedisPubSub {
|
||||
private ExecutorService executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setDaemon(true).setNameFormat("RedisBungee PubSub Handler - #%d").build());
|
||||
private final ExecutorService executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setDaemon(true).setNameFormat("RedisBungee PubSub Handler - #%d").build());
|
||||
|
||||
@Override
|
||||
public void onMessage(final String s, final String s2) {
|
||||
|
@ -23,7 +23,7 @@ import java.util.Collections;
|
||||
* @since 0.2.3
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class RedisBungeeCommandSender implements CommandSender {
|
||||
class RedisBungeeCommandSender implements CommandSender {
|
||||
static final RedisBungeeCommandSender instance = new RedisBungeeCommandSender();
|
||||
|
||||
@Override
|
||||
|
@ -60,7 +60,7 @@ class RedisBungeeCommands {
|
||||
Multimap<String, UUID> serverToPlayers = RedisBungee.getApi().getServerToPlayers();
|
||||
Multimap<String, String> human = HashMultimap.create();
|
||||
for (Map.Entry<String, UUID> entry : serverToPlayers.entries()) {
|
||||
human.put(entry.getKey(), plugin.getUuidTranslator().getNameFromUuid(entry.getValue()));
|
||||
human.put(entry.getKey(), plugin.getUuidTranslator().getNameFromUuid(entry.getValue(), false));
|
||||
}
|
||||
for (String server : new TreeSet<>(serverToPlayers.keySet())) {
|
||||
TextComponent serverName = new TextComponent();
|
||||
@ -102,7 +102,7 @@ class RedisBungeeCommands {
|
||||
@Override
|
||||
public void run() {
|
||||
if (args.length > 0) {
|
||||
UUID uuid = plugin.getUuidTranslator().getTranslatedUuid(args[0]);
|
||||
UUID uuid = plugin.getUuidTranslator().getTranslatedUuid(args[0], true);
|
||||
if (uuid == null) {
|
||||
sender.sendMessage(PLAYER_NOT_FOUND);
|
||||
return;
|
||||
@ -138,7 +138,7 @@ class RedisBungeeCommands {
|
||||
@Override
|
||||
public void run() {
|
||||
if (args.length > 0) {
|
||||
UUID uuid = plugin.getUuidTranslator().getTranslatedUuid(args[0]);
|
||||
UUID uuid = plugin.getUuidTranslator().getTranslatedUuid(args[0], true);
|
||||
if (uuid == null) {
|
||||
sender.sendMessage(PLAYER_NOT_FOUND);
|
||||
return;
|
||||
@ -178,7 +178,7 @@ class RedisBungeeCommands {
|
||||
@Override
|
||||
public void run() {
|
||||
if (args.length > 0) {
|
||||
UUID uuid = plugin.getUuidTranslator().getTranslatedUuid(args[0]);
|
||||
UUID uuid = plugin.getUuidTranslator().getTranslatedUuid(args[0], true);
|
||||
if (uuid == null) {
|
||||
sender.sendMessage(PLAYER_NOT_FOUND);
|
||||
return;
|
||||
|
@ -19,7 +19,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
@RequiredArgsConstructor
|
||||
public class RedisBungeeConsumer implements Runnable {
|
||||
private final RedisBungee plugin;
|
||||
private BlockingQueue<ConsumerEvent> consumerQueue = new LinkedBlockingQueue<>();
|
||||
private final BlockingQueue<ConsumerEvent> consumerQueue = new LinkedBlockingQueue<>();
|
||||
private boolean stopped = false;
|
||||
|
||||
@Override
|
||||
|
@ -68,7 +68,7 @@ public class RedisBungeeListener implements Listener {
|
||||
ServerPing.PlayerInfo[] info = new ServerPing.PlayerInfo[players.size()];
|
||||
int idx = 0;
|
||||
for (UUID player : players) {
|
||||
info[idx] = new ServerPing.PlayerInfo(plugin.getUuidTranslator().getNameFromUuid(player), "");
|
||||
info[idx] = new ServerPing.PlayerInfo(plugin.getUuidTranslator().getNameFromUuid(player, false), "");
|
||||
idx++;
|
||||
}
|
||||
reply.setPlayers(new ServerPing.Players(old.getPlayers().getMax(), players.size(), info));
|
||||
@ -110,7 +110,7 @@ public class RedisBungeeListener implements Listener {
|
||||
}
|
||||
Set<String> players = new HashSet<>();
|
||||
for (UUID uuid : original)
|
||||
players.add(plugin.getUuidTranslator().getNameFromUuid(uuid));
|
||||
players.add(plugin.getUuidTranslator().getNameFromUuid(uuid, false));
|
||||
out.writeUTF(Joiner.on(',').join(players));
|
||||
break;
|
||||
case "PlayerCount":
|
||||
@ -133,7 +133,7 @@ public class RedisBungeeListener implements Listener {
|
||||
String user = in.readUTF();
|
||||
out.writeUTF("LastOnline");
|
||||
out.writeUTF(user);
|
||||
out.writeLong(plugin.getLastOnline(plugin.getUuidTranslator().getTranslatedUuid(user)));
|
||||
out.writeLong(plugin.getLastOnline(plugin.getUuidTranslator().getTranslatedUuid(user, true)));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -8,7 +8,7 @@ package com.imaginarycode.minecraft.redisbungee;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
public class RedisUtil {
|
||||
class RedisUtil {
|
||||
public static void cleanUpPlayer(String player, Jedis rsc) {
|
||||
rsc.srem("server:" + RedisBungee.getApi().getServerId() + ":usersOnline", player);
|
||||
rsc.hdel("player:" + player, "server");
|
||||
|
@ -20,7 +20,7 @@ import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
/* Credits to evilmidget38 for this class. I modified it to use Gson. */
|
||||
public class NameFetcher implements Callable<Map<UUID, String>> {
|
||||
class NameFetcher implements Callable<Map<UUID, String>> {
|
||||
private static final String PROFILE_URL = "https://sessionserver.mojang.com/session/minecraft/profile/";
|
||||
private final List<UUID> uuids;
|
||||
|
||||
|
@ -18,7 +18,7 @@ import java.util.*;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
/* Credits to evilmidget38 for this class. I modified it to use Gson. */
|
||||
public class UUIDFetcher implements Callable<Map<String, UUID>> {
|
||||
class UUIDFetcher implements Callable<Map<String, UUID>> {
|
||||
private static final double PROFILES_PER_REQUEST = 100;
|
||||
private static final String PROFILE_URL = "https://api.mojang.com/profiles/minecraft";
|
||||
private final List<String> names;
|
||||
|
@ -9,7 +9,6 @@ package com.imaginarycode.minecraft.redisbungee.util;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.imaginarycode.minecraft.redisbungee.RedisBungee;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -30,8 +29,8 @@ public class UUIDTranslator {
|
||||
private final RedisBungee plugin;
|
||||
private final BiMap<String, UUID> uuidMap = HashBiMap.create();
|
||||
private final ReadWriteLock lock = new ReentrantReadWriteLock();
|
||||
public static final Pattern UUID_PATTERN = Pattern.compile("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}");
|
||||
public static final Pattern MOJANGIAN_UUID_PATTERN = Pattern.compile("[a-fA-F0-9]{32}");
|
||||
private static final Pattern UUID_PATTERN = Pattern.compile("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}");
|
||||
private static final Pattern MOJANGIAN_UUID_PATTERN = Pattern.compile("[a-fA-F0-9]{32}");
|
||||
|
||||
public UUID getTranslatedUuid(@NonNull String player, boolean expensiveLookups) {
|
||||
if (ProxyServer.getInstance().getPlayer(player) != null)
|
||||
|
Loading…
Reference in New Issue
Block a user