mirror of
				https://github.com/proxiodev/RedisBungee.git
				synced 2025-11-04 09:38:03 +00:00 
			
		
		
		
	update okhttp
This commit is contained in:
		
							parent
							
								
									6eab4ef602
								
							
						
					
					
						commit
						0050575aff
					
				@ -17,7 +17,7 @@ public class Constants {
 | 
				
			|||||||
    public final static String GIT_COMMIT = "@git_commit@";
 | 
					    public final static String GIT_COMMIT = "@git_commit@";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static String getGithubCommitLink() {
 | 
					    public static String getGithubCommitLink() {
 | 
				
			||||||
        return "https://github.com/ProxioDev/RedisBungee/commit/" + GIT_COMMIT;
 | 
					        return "https://github.com/ProxioDev/ValioBungee/commit/" + GIT_COMMIT;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -13,28 +13,7 @@ package com.imaginarycode.minecraft.redisbungee.api.util.uuid;
 | 
				
			|||||||
import java.util.Calendar;
 | 
					import java.util.Calendar;
 | 
				
			||||||
import java.util.UUID;
 | 
					import java.util.UUID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CachedUUIDEntry {
 | 
					public record CachedUUIDEntry(String name, UUID uuid, Calendar expiry) {
 | 
				
			||||||
    private final String name;
 | 
					 | 
				
			||||||
    private final UUID uuid;
 | 
					 | 
				
			||||||
    private final Calendar expiry;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public CachedUUIDEntry(String name, UUID uuid, Calendar expiry) {
 | 
					 | 
				
			||||||
        this.name = name;
 | 
					 | 
				
			||||||
        this.uuid = uuid;
 | 
					 | 
				
			||||||
        this.expiry = expiry;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public String getName() {
 | 
					 | 
				
			||||||
        return name;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public UUID getUuid() {
 | 
					 | 
				
			||||||
        return uuid;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public Calendar getExpiry() {
 | 
					 | 
				
			||||||
        return expiry;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public boolean expired() {
 | 
					    public boolean expired() {
 | 
				
			||||||
        return Calendar.getInstance().after(expiry);
 | 
					        return Calendar.getInstance().after(expiry);
 | 
				
			||||||
 | 
				
			|||||||
@ -12,9 +12,9 @@ package com.imaginarycode.minecraft.redisbungee.api.util.uuid;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.google.gson.Gson;
 | 
					import com.google.gson.Gson;
 | 
				
			||||||
import com.google.gson.JsonObject;
 | 
					import com.google.gson.JsonObject;
 | 
				
			||||||
import com.squareup.okhttp.OkHttpClient;
 | 
					import okhttp3.OkHttpClient;
 | 
				
			||||||
import com.squareup.okhttp.Request;
 | 
					import okhttp3.Request;
 | 
				
			||||||
import com.squareup.okhttp.ResponseBody;
 | 
					import okhttp3.ResponseBody;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.util.Collections;
 | 
					import java.util.Collections;
 | 
				
			||||||
@ -22,13 +22,9 @@ import java.util.List;
 | 
				
			|||||||
import java.util.UUID;
 | 
					import java.util.UUID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class NameFetcher {
 | 
					public class NameFetcher {
 | 
				
			||||||
    private static OkHttpClient httpClient;
 | 
					    private static final OkHttpClient httpClient = new OkHttpClient();
 | 
				
			||||||
    private static final Gson gson = new Gson();
 | 
					    private static final Gson gson = new Gson();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static void setHttpClient(OkHttpClient httpClient) {
 | 
					 | 
				
			||||||
        NameFetcher.httpClient = httpClient;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static List<String> nameHistoryFromUuid(UUID uuid) throws IOException {
 | 
					    public static List<String> nameHistoryFromUuid(UUID uuid) throws IOException {
 | 
				
			||||||
        String name = getName(uuid);
 | 
					        String name = getName(uuid);
 | 
				
			||||||
        if (name == null) return Collections.emptyList();
 | 
					        if (name == null) return Collections.emptyList();
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,7 @@ package com.imaginarycode.minecraft.redisbungee.api.util.uuid;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.google.common.collect.ImmutableList;
 | 
					import com.google.common.collect.ImmutableList;
 | 
				
			||||||
import com.google.gson.Gson;
 | 
					import com.google.gson.Gson;
 | 
				
			||||||
import com.squareup.okhttp.*;
 | 
					import okhttp3.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.HashMap;
 | 
					import java.util.HashMap;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
@ -28,13 +28,7 @@ public class UUIDFetcher implements Callable<Map<String, UUID>> {
 | 
				
			|||||||
    private final List<String> names;
 | 
					    private final List<String> names;
 | 
				
			||||||
    private final boolean rateLimiting;
 | 
					    private final boolean rateLimiting;
 | 
				
			||||||
    private static final Gson gson = new Gson();
 | 
					    private static final Gson gson = new Gson();
 | 
				
			||||||
 | 
					    private static final OkHttpClient httpClient = new OkHttpClient();
 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static void setHttpClient(OkHttpClient httpClient) {
 | 
					 | 
				
			||||||
        UUIDFetcher.httpClient = httpClient;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private static OkHttpClient httpClient;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private UUIDFetcher(List<String> names, boolean rateLimiting) {
 | 
					    private UUIDFetcher(List<String> names, boolean rateLimiting) {
 | 
				
			||||||
        this.names = ImmutableList.copyOf(names);
 | 
					        this.names = ImmutableList.copyOf(names);
 | 
				
			||||||
 | 
				
			|||||||
@ -61,7 +61,7 @@ public final class UUIDTranslator {
 | 
				
			|||||||
        CachedUUIDEntry cachedUUIDEntry = nameToUuidMap.get(player.toLowerCase());
 | 
					        CachedUUIDEntry cachedUUIDEntry = nameToUuidMap.get(player.toLowerCase());
 | 
				
			||||||
        if (cachedUUIDEntry != null) {
 | 
					        if (cachedUUIDEntry != null) {
 | 
				
			||||||
            if (!cachedUUIDEntry.expired())
 | 
					            if (!cachedUUIDEntry.expired())
 | 
				
			||||||
                return cachedUUIDEntry.getUuid();
 | 
					                return cachedUUIDEntry.uuid();
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
                nameToUuidMap.remove(player);
 | 
					                nameToUuidMap.remove(player);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -93,11 +93,11 @@ public final class UUIDTranslator {
 | 
				
			|||||||
                    if (entry.expired()) {
 | 
					                    if (entry.expired()) {
 | 
				
			||||||
                        unifiedJedis.hdel("uuid-cache", player.toLowerCase());
 | 
					                        unifiedJedis.hdel("uuid-cache", player.toLowerCase());
 | 
				
			||||||
                        // Doesn't hurt to also remove the UUID entry as well.
 | 
					                        // Doesn't hurt to also remove the UUID entry as well.
 | 
				
			||||||
                        unifiedJedis.hdel("uuid-cache", entry.getUuid().toString());
 | 
					                        unifiedJedis.hdel("uuid-cache", entry.uuid().toString());
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        nameToUuidMap.put(player.toLowerCase(), entry);
 | 
					                        nameToUuidMap.put(player.toLowerCase(), entry);
 | 
				
			||||||
                        uuidToNameMap.put(entry.getUuid(), entry);
 | 
					                        uuidToNameMap.put(entry.uuid(), entry);
 | 
				
			||||||
                        return entry.getUuid();
 | 
					                        return entry.uuid();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -141,7 +141,7 @@ public final class UUIDTranslator {
 | 
				
			|||||||
        CachedUUIDEntry cachedUUIDEntry = uuidToNameMap.get(player);
 | 
					        CachedUUIDEntry cachedUUIDEntry = uuidToNameMap.get(player);
 | 
				
			||||||
        if (cachedUUIDEntry != null) {
 | 
					        if (cachedUUIDEntry != null) {
 | 
				
			||||||
            if (!cachedUUIDEntry.expired())
 | 
					            if (!cachedUUIDEntry.expired())
 | 
				
			||||||
                return cachedUUIDEntry.getName();
 | 
					                return cachedUUIDEntry.name();
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
                uuidToNameMap.remove(player);
 | 
					                uuidToNameMap.remove(player);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -159,11 +159,11 @@ public final class UUIDTranslator {
 | 
				
			|||||||
                        unifiedJedis.hdel("uuid-cache", player.toString());
 | 
					                        unifiedJedis.hdel("uuid-cache", player.toString());
 | 
				
			||||||
                        // Doesn't hurt to also remove the named entry as well.
 | 
					                        // Doesn't hurt to also remove the named entry as well.
 | 
				
			||||||
                        // TODO: Since UUIDs are fixed, we could look up the name and see if the UUID matches.
 | 
					                        // TODO: Since UUIDs are fixed, we could look up the name and see if the UUID matches.
 | 
				
			||||||
                        unifiedJedis.hdel("uuid-cache", entry.getName());
 | 
					                        unifiedJedis.hdel("uuid-cache", entry.name());
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        nameToUuidMap.put(entry.getName().toLowerCase(), entry);
 | 
					                        nameToUuidMap.put(entry.name().toLowerCase(), entry);
 | 
				
			||||||
                        uuidToNameMap.put(player, entry);
 | 
					                        uuidToNameMap.put(player, entry);
 | 
				
			||||||
                        return entry.getName();
 | 
					                        return entry.name();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
[versions]
 | 
					[versions]
 | 
				
			||||||
guava = "31.1-jre"
 | 
					guava = "31.1-jre"
 | 
				
			||||||
jedis = "5.2.0"
 | 
					jedis = "5.2.0"
 | 
				
			||||||
okhttp = "2.7.5"
 | 
					okhttp = "4.12.0"
 | 
				
			||||||
configurateV3 = "3.7.3"
 | 
					configurateV3 = "3.7.3"
 | 
				
			||||||
caffeine = "3.1.8"
 | 
					caffeine = "3.1.8"
 | 
				
			||||||
adventure = "4.18.0"
 | 
					adventure = "4.18.0"
 | 
				
			||||||
@ -12,13 +12,13 @@ velocity = "3.4.0-SNAPSHOT"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[plugins]
 | 
					[plugins]
 | 
				
			||||||
blossom = { id = "net.kyori.blossom", version = "1.2.0" }
 | 
					blossom = { id = "net.kyori.blossom", version = "1.2.0" }
 | 
				
			||||||
shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" }
 | 
					shadow = { id = "com.gradleup.shadow", version = "8.3.5" }
 | 
				
			||||||
run-velocity = { id = "xyz.jpenilla.run-velocity", version = "2.0.0" }
 | 
					run-velocity = { id = "xyz.jpenilla.run-velocity", version = "2.3.1" }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[libraries]
 | 
					[libraries]
 | 
				
			||||||
guava = { module = "com.google.guava:guava", version.ref = "guava" }
 | 
					guava = { module = "com.google.guava:guava", version.ref = "guava" }
 | 
				
			||||||
jedis = { module = "redis.clients:jedis", version.ref = "jedis" }
 | 
					jedis = { module = "redis.clients:jedis", version.ref = "jedis" }
 | 
				
			||||||
okhttp = { module = "com.squareup.okhttp:okhttp", version.ref = "okhttp" }
 | 
					okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
 | 
				
			||||||
configurateV3 = { module = "org.spongepowered:configurate-yaml", version.ref = "configurateV3" }
 | 
					configurateV3 = { module = "org.spongepowered:configurate-yaml", version.ref = "configurateV3" }
 | 
				
			||||||
caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "caffeine" }
 | 
					caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "caffeine" }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -46,7 +46,7 @@ tasks {
 | 
				
			|||||||
        relocate("redis.clients.jedis", "com.imaginarycode.minecraft.redisbungee.internal.jedis")
 | 
					        relocate("redis.clients.jedis", "com.imaginarycode.minecraft.redisbungee.internal.jedis")
 | 
				
			||||||
        relocate("redis.clients.util", "com.imaginarycode.minecraft.redisbungee.internal.jedisutil")
 | 
					        relocate("redis.clients.util", "com.imaginarycode.minecraft.redisbungee.internal.jedisutil")
 | 
				
			||||||
        relocate("org.apache.commons.pool", "com.imaginarycode.minecraft.redisbungee.internal.commonspool")
 | 
					        relocate("org.apache.commons.pool", "com.imaginarycode.minecraft.redisbungee.internal.commonspool")
 | 
				
			||||||
        relocate("com.squareup.okhttp", "com.imaginarycode.minecraft.redisbungee.internal.okhttp")
 | 
					        relocate("com.squareup.okhttp3", "com.imaginarycode.minecraft.redisbungee.internal.okhttp3")
 | 
				
			||||||
        relocate("okio", "com.imaginarycode.minecraft.redisbungee.internal.okio")
 | 
					        relocate("okio", "com.imaginarycode.minecraft.redisbungee.internal.okio")
 | 
				
			||||||
        relocate("org.json", "com.imaginarycode.minecraft.redisbungee.internal.json")
 | 
					        relocate("org.json", "com.imaginarycode.minecraft.redisbungee.internal.json")
 | 
				
			||||||
        // configurate shade
 | 
					        // configurate shade
 | 
				
			||||||
 | 
				
			|||||||
@ -25,8 +25,6 @@ import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerLeftNetworkEven
 | 
				
			|||||||
import com.imaginarycode.minecraft.redisbungee.api.events.IPubSubMessageEvent;
 | 
					import com.imaginarycode.minecraft.redisbungee.api.events.IPubSubMessageEvent;
 | 
				
			||||||
import com.imaginarycode.minecraft.redisbungee.api.summoners.Summoner;
 | 
					import com.imaginarycode.minecraft.redisbungee.api.summoners.Summoner;
 | 
				
			||||||
import com.imaginarycode.minecraft.redisbungee.api.util.InitialUtils;
 | 
					import com.imaginarycode.minecraft.redisbungee.api.util.InitialUtils;
 | 
				
			||||||
import com.imaginarycode.minecraft.redisbungee.api.util.uuid.NameFetcher;
 | 
					 | 
				
			||||||
import com.imaginarycode.minecraft.redisbungee.api.util.uuid.UUIDFetcher;
 | 
					 | 
				
			||||||
import com.imaginarycode.minecraft.redisbungee.api.util.uuid.UUIDTranslator;
 | 
					import com.imaginarycode.minecraft.redisbungee.api.util.uuid.UUIDTranslator;
 | 
				
			||||||
import com.imaginarycode.minecraft.redisbungee.commands.CommandLoader;
 | 
					import com.imaginarycode.minecraft.redisbungee.commands.CommandLoader;
 | 
				
			||||||
import com.imaginarycode.minecraft.redisbungee.commands.utils.CommandPlatformHelper;
 | 
					import com.imaginarycode.minecraft.redisbungee.commands.utils.CommandPlatformHelper;
 | 
				
			||||||
@ -34,8 +32,6 @@ import com.imaginarycode.minecraft.redisbungee.events.PlayerChangedServerNetwork
 | 
				
			|||||||
import com.imaginarycode.minecraft.redisbungee.events.PlayerJoinedNetworkEvent;
 | 
					import com.imaginarycode.minecraft.redisbungee.events.PlayerJoinedNetworkEvent;
 | 
				
			||||||
import com.imaginarycode.minecraft.redisbungee.events.PlayerLeftNetworkEvent;
 | 
					import com.imaginarycode.minecraft.redisbungee.events.PlayerLeftNetworkEvent;
 | 
				
			||||||
import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent;
 | 
					import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent;
 | 
				
			||||||
import com.squareup.okhttp.Dispatcher;
 | 
					 | 
				
			||||||
import com.squareup.okhttp.OkHttpClient;
 | 
					 | 
				
			||||||
import net.kyori.adventure.text.Component;
 | 
					import net.kyori.adventure.text.Component;
 | 
				
			||||||
import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer;
 | 
					import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer;
 | 
				
			||||||
import net.md_5.bungee.api.ProxyServer;
 | 
					import net.md_5.bungee.api.ProxyServer;
 | 
				
			||||||
@ -72,7 +68,6 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin<ProxiedPlay
 | 
				
			|||||||
    private UUIDTranslator uuidTranslator;
 | 
					    private UUIDTranslator uuidTranslator;
 | 
				
			||||||
    private RedisBungeeConfiguration configuration;
 | 
					    private RedisBungeeConfiguration configuration;
 | 
				
			||||||
    private LangConfiguration langConfiguration;
 | 
					    private LangConfiguration langConfiguration;
 | 
				
			||||||
    private OkHttpClient httpClient;
 | 
					 | 
				
			||||||
    private BungeeCommandManager commandManager;
 | 
					    private BungeeCommandManager commandManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final Logger logger = LoggerFactory.getLogger("RedisBungee");
 | 
					    private final Logger logger = LoggerFactory.getLogger("RedisBungee");
 | 
				
			||||||
@ -241,11 +236,6 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin<ProxiedPlay
 | 
				
			|||||||
        // cleanup
 | 
					        // cleanup
 | 
				
			||||||
        this.cleanupTask = getProxy().getScheduler().schedule(this, () -> this.proxyDataManager.correctionTask(), 0, 60, TimeUnit.SECONDS);
 | 
					        this.cleanupTask = getProxy().getScheduler().schedule(this, () -> this.proxyDataManager.correctionTask(), 0, 60, TimeUnit.SECONDS);
 | 
				
			||||||
        // init the http lib
 | 
					        // init the http lib
 | 
				
			||||||
        httpClient = new OkHttpClient();
 | 
					 | 
				
			||||||
        Dispatcher dispatcher = new Dispatcher(getExecutorService());
 | 
					 | 
				
			||||||
        httpClient.setDispatcher(dispatcher);
 | 
					 | 
				
			||||||
        NameFetcher.setHttpClient(httpClient);
 | 
					 | 
				
			||||||
        UUIDFetcher.setHttpClient(httpClient);
 | 
					 | 
				
			||||||
        InitialUtils.checkRedisVersion(this);
 | 
					        InitialUtils.checkRedisVersion(this);
 | 
				
			||||||
        uuidTranslator = new UUIDTranslator(this);
 | 
					        uuidTranslator = new UUIDTranslator(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -21,7 +21,7 @@ java {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
tasks {
 | 
					tasks {
 | 
				
			||||||
    runVelocity {
 | 
					    runVelocity {
 | 
				
			||||||
        velocityVersion("3.4.0-SNAPSHOT")
 | 
					        velocityVersion(libs.versions.velocity.get())
 | 
				
			||||||
        environment["REDISBUNGEE_PROXY_ID"] = "velocity-1"
 | 
					        environment["REDISBUNGEE_PROXY_ID"] = "velocity-1"
 | 
				
			||||||
        environment["REDISBUNGEE_NETWORK_ID"] = "dev"
 | 
					        environment["REDISBUNGEE_NETWORK_ID"] = "dev"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -36,7 +36,7 @@ tasks {
 | 
				
			|||||||
        relocate("redis.clients.jedis", "com.imaginarycode.minecraft.redisbungee.internal.jedis")
 | 
					        relocate("redis.clients.jedis", "com.imaginarycode.minecraft.redisbungee.internal.jedis")
 | 
				
			||||||
        relocate("redis.clients.util", "com.imaginarycode.minecraft.redisbungee.internal.jedisutil")
 | 
					        relocate("redis.clients.util", "com.imaginarycode.minecraft.redisbungee.internal.jedisutil")
 | 
				
			||||||
        relocate("org.apache.commons.pool", "com.imaginarycode.minecraft.redisbungee.internal.commonspool")
 | 
					        relocate("org.apache.commons.pool", "com.imaginarycode.minecraft.redisbungee.internal.commonspool")
 | 
				
			||||||
        relocate("com.squareup.okhttp", "com.imaginarycode.minecraft.redisbungee.internal.okhttp")
 | 
					        relocate("com.squareup.okhttp3", "com.imaginarycode.minecraft.redisbungee.internal.okhttp3")
 | 
				
			||||||
        relocate("okio", "com.imaginarycode.minecraft.redisbungee.internal.okio")
 | 
					        relocate("okio", "com.imaginarycode.minecraft.redisbungee.internal.okio")
 | 
				
			||||||
        relocate("org.json", "com.imaginarycode.minecraft.redisbungee.internal.json")
 | 
					        relocate("org.json", "com.imaginarycode.minecraft.redisbungee.internal.json")
 | 
				
			||||||
        // acf shade
 | 
					        // acf shade
 | 
				
			||||||
 | 
				
			|||||||
@ -35,8 +35,6 @@ import com.imaginarycode.minecraft.redisbungee.events.PlayerChangedServerNetwork
 | 
				
			|||||||
import com.imaginarycode.minecraft.redisbungee.events.PlayerJoinedNetworkEvent;
 | 
					import com.imaginarycode.minecraft.redisbungee.events.PlayerJoinedNetworkEvent;
 | 
				
			||||||
import com.imaginarycode.minecraft.redisbungee.events.PlayerLeftNetworkEvent;
 | 
					import com.imaginarycode.minecraft.redisbungee.events.PlayerLeftNetworkEvent;
 | 
				
			||||||
import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent;
 | 
					import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent;
 | 
				
			||||||
import com.squareup.okhttp.Dispatcher;
 | 
					 | 
				
			||||||
import com.squareup.okhttp.OkHttpClient;
 | 
					 | 
				
			||||||
import com.velocitypowered.api.event.PostOrder;
 | 
					import com.velocitypowered.api.event.PostOrder;
 | 
				
			||||||
import com.velocitypowered.api.event.Subscribe;
 | 
					import com.velocitypowered.api.event.Subscribe;
 | 
				
			||||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
 | 
					import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
 | 
				
			||||||
@ -78,7 +76,6 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, Con
 | 
				
			|||||||
    private final UUIDTranslator uuidTranslator;
 | 
					    private final UUIDTranslator uuidTranslator;
 | 
				
			||||||
    private RedisBungeeConfiguration configuration;
 | 
					    private RedisBungeeConfiguration configuration;
 | 
				
			||||||
    private LangConfiguration langConfiguration;
 | 
					    private LangConfiguration langConfiguration;
 | 
				
			||||||
    private final OkHttpClient httpClient;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final ProxyDataManager proxyDataManager;
 | 
					    private final ProxyDataManager proxyDataManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -127,11 +124,6 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, Con
 | 
				
			|||||||
        };
 | 
					        };
 | 
				
			||||||
        this.playerDataManager = new VelocityPlayerDataManager(this);
 | 
					        this.playerDataManager = new VelocityPlayerDataManager(this);
 | 
				
			||||||
        uuidTranslator = new UUIDTranslator(this);
 | 
					        uuidTranslator = new UUIDTranslator(this);
 | 
				
			||||||
        this.httpClient = new OkHttpClient();
 | 
					 | 
				
			||||||
        Dispatcher dispatcher = new Dispatcher(Executors.newFixedThreadPool(6));
 | 
					 | 
				
			||||||
        this.httpClient.setDispatcher(dispatcher);
 | 
					 | 
				
			||||||
        NameFetcher.setHttpClient(httpClient);
 | 
					 | 
				
			||||||
        UUIDFetcher.setHttpClient(httpClient);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -300,8 +292,6 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, Con
 | 
				
			|||||||
        if (heartbeatTask != null) {
 | 
					        if (heartbeatTask != null) {
 | 
				
			||||||
            heartbeatTask.cancel();
 | 
					            heartbeatTask.cancel();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            this.proxyDataManager.close();
 | 
					            this.proxyDataManager.close();
 | 
				
			||||||
            this.jedisSummoner.close();
 | 
					            this.jedisSummoner.close();
 | 
				
			||||||
@ -309,13 +299,6 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, Con
 | 
				
			|||||||
            throw new RuntimeException(e);
 | 
					            throw new RuntimeException(e);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.httpClient.getDispatcher().getExecutorService().shutdown();
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
            logInfo("waiting for httpclient thread-pool termination.....");
 | 
					 | 
				
			||||||
            this.httpClient.getDispatcher().getExecutorService().awaitTermination(20, TimeUnit.SECONDS);
 | 
					 | 
				
			||||||
        } catch (InterruptedException e) {
 | 
					 | 
				
			||||||
            throw new RuntimeException(e);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (commandManager != null) commandManager.unregisterCommands();
 | 
					        if (commandManager != null) commandManager.unregisterCommands();
 | 
				
			||||||
        logInfo("RedisBungee shutdown complete");
 | 
					        logInfo("RedisBungee shutdown complete");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user