2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2026-05-05 12:40:27 +00:00

update okhttp

This commit is contained in:
2024-12-23 15:04:25 +04:00
parent 6eab4ef602
commit 0050575aff
10 changed files with 23 additions and 81 deletions

View File

@@ -46,7 +46,7 @@ tasks {
relocate("redis.clients.jedis", "com.imaginarycode.minecraft.redisbungee.internal.jedis")
relocate("redis.clients.util", "com.imaginarycode.minecraft.redisbungee.internal.jedisutil")
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("org.json", "com.imaginarycode.minecraft.redisbungee.internal.json")
// configurate shade

View File

@@ -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.summoners.Summoner;
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.commands.CommandLoader;
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.PlayerLeftNetworkEvent;
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.serializer.bungeecord.BungeeComponentSerializer;
import net.md_5.bungee.api.ProxyServer;
@@ -72,7 +68,6 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin<ProxiedPlay
private UUIDTranslator uuidTranslator;
private RedisBungeeConfiguration configuration;
private LangConfiguration langConfiguration;
private OkHttpClient httpClient;
private BungeeCommandManager commandManager;
private final Logger logger = LoggerFactory.getLogger("RedisBungee");
@@ -241,11 +236,6 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin<ProxiedPlay
// cleanup
this.cleanupTask = getProxy().getScheduler().schedule(this, () -> this.proxyDataManager.correctionTask(), 0, 60, TimeUnit.SECONDS);
// init the http lib
httpClient = new OkHttpClient();
Dispatcher dispatcher = new Dispatcher(getExecutorService());
httpClient.setDispatcher(dispatcher);
NameFetcher.setHttpClient(httpClient);
UUIDFetcher.setHttpClient(httpClient);
InitialUtils.checkRedisVersion(this);
uuidTranslator = new UUIDTranslator(this);

View File

@@ -21,7 +21,7 @@ java {
tasks {
runVelocity {
velocityVersion("3.4.0-SNAPSHOT")
velocityVersion(libs.versions.velocity.get())
environment["REDISBUNGEE_PROXY_ID"] = "velocity-1"
environment["REDISBUNGEE_NETWORK_ID"] = "dev"
}
@@ -36,7 +36,7 @@ tasks {
relocate("redis.clients.jedis", "com.imaginarycode.minecraft.redisbungee.internal.jedis")
relocate("redis.clients.util", "com.imaginarycode.minecraft.redisbungee.internal.jedisutil")
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("org.json", "com.imaginarycode.minecraft.redisbungee.internal.json")
// acf shade

View File

@@ -35,8 +35,6 @@ import com.imaginarycode.minecraft.redisbungee.events.PlayerChangedServerNetwork
import com.imaginarycode.minecraft.redisbungee.events.PlayerJoinedNetworkEvent;
import com.imaginarycode.minecraft.redisbungee.events.PlayerLeftNetworkEvent;
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.Subscribe;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
@@ -78,7 +76,6 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, Con
private final UUIDTranslator uuidTranslator;
private RedisBungeeConfiguration configuration;
private LangConfiguration langConfiguration;
private final OkHttpClient httpClient;
private final ProxyDataManager proxyDataManager;
@@ -127,11 +124,6 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, Con
};
this.playerDataManager = new VelocityPlayerDataManager(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) {
heartbeatTask.cancel();
}
try {
this.proxyDataManager.close();
this.jedisSummoner.close();
@@ -309,13 +299,6 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, Con
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();
logInfo("RedisBungee shutdown complete");
}