From 1d3bd7e1013f175b9a6221da2645d8487f46dd2a Mon Sep 17 00:00:00 2001 From: Mohammed Alteneiji Date: Sat, 22 Feb 2025 15:43:49 +0400 Subject: [PATCH] remove depercated apis | begin removing adventure api from the main api --- api/build.gradle.kts | 5 - .../redisbungee/AbstractRedisBungeeAPI.java | 180 ------------------ .../minecraft/redisbungee/RedisBungeeAPI.java | 25 +++ 3 files changed, 25 insertions(+), 185 deletions(-) diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 45e798e..dca2211 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -13,11 +13,6 @@ dependencies { api(libs.okhttp) api(libs.configurateV3) api(libs.caffeine) - api(libs.adventure.api) - api(libs.adventure.gson) - api(libs.adventure.legacy) - api(libs.adventure.plain) - api(libs.adventure.miniMessage) } description = "RedisBungee interfaces" diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/AbstractRedisBungeeAPI.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/AbstractRedisBungeeAPI.java index 50f475e..2c9c125 100644 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/AbstractRedisBungeeAPI.java +++ b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/AbstractRedisBungeeAPI.java @@ -14,16 +14,10 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multimap; import com.imaginarycode.minecraft.redisbungee.api.RedisBungeeMode; import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.api.summoners.JedisClusterSummoner; -import com.imaginarycode.minecraft.redisbungee.api.summoners.JedisPooledSummoner; import com.imaginarycode.minecraft.redisbungee.api.summoners.Summoner; -import net.kyori.adventure.text.Component; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisCluster; import redis.clients.jedis.JedisPool; -import redis.clients.jedis.JedisPooled; import java.net.InetAddress; import java.util.*; @@ -216,19 +210,6 @@ public abstract class AbstractRedisBungeeAPI { return plugin.proxyDataManager().proxyId(); } - /** - * Get the current BungeeCord / Velocity proxy ID for this server. - * - * @return the current server ID - * @see #getAllServers() - * @since 0.2.5 - * @deprecated to avoid confusion between A server and A proxy see #getProxyId() - */ - @Deprecated(forRemoval = true) - public final String getServerId() { - return getProxyId(); - } - /** * Get all the linked proxies in this network. * @@ -240,41 +221,6 @@ public abstract class AbstractRedisBungeeAPI { return plugin.proxyDataManager().proxiesIds(); } - /** - * Get all the linked proxies in this network. - * - * @return the list of all proxies - * @see #getServerId() - * @since 0.2.5 - * @deprecated to avoid confusion between A server and A proxy see see {@link #getAllProxies()} - */ - @Deprecated(forRemoval = true) - public final List getAllServers() { - return getAllProxies(); - } - - /** - * Register (a) PubSub channel(s), so that you may handle PubSubMessageEvent for it. - * - * @param channels the channels to register - * @since 0.3 - * @deprecated No longer required - */ - @Deprecated(forRemoval = true) - public final void registerPubSubChannels(String... channels) { - } - - /** - * Unregister (a) PubSub channel(s). - * - * @param channels the channels to unregister - * @since 0.3 - * @deprecated No longer required - */ - @Deprecated(forRemoval = true) - public final void unregisterPubSubChannels(String... channels) { - } - /** * Fetch a name from the specified UUID. UUIDs are cached locally and in Redis. This function falls back to Mojang * as a last resort, so calls may be blocking. @@ -343,132 +289,6 @@ public abstract class AbstractRedisBungeeAPI { } - /** - * Kicks a player from the network - * calls {@link #getUuidFromName(String)} to get uuid - * - * @param playerName player name - * @param message kick message that player will see on kick - * @since 0.8.0 - * @deprecated - */ - @Deprecated(forRemoval = true) - public void kickPlayer(String playerName, String message) { - kickPlayer(getUuidFromName(playerName), message); - } - - /** - * Kicks a player from the network - * - * @param playerUUID player name - * @param message kick message that player will see on kick - * @since 0.8.0 - * @deprecated - */ - @Deprecated(forRemoval = true) - public void kickPlayer(UUID playerUUID, String message) { - kickPlayer(playerUUID, Component.text(message)); - } - - /** - * Kicks a player from the network - * calls {@link #getUuidFromName(String)} to get uuid - * - * @param playerName player name - * @param message kick message that player will see on kick - * @since 0.12.0 - */ - - public void kickPlayer(String playerName, Component message) { - kickPlayer(getUuidFromName(playerName), message); - } - - /** - * Kicks a player from the network - * - * @param playerUUID player name - * @param message kick message that player will see on kick - * @since 0.12.0 - */ - public void kickPlayer(UUID playerUUID, Component message) { - this.plugin.playerDataManager().kickPlayer(playerUUID, message); - } - - - /** - * This gives you instance of Jedis - * - * @return {@link Jedis} - * @throws IllegalStateException if the {@link #getMode()} is not equal to {@link RedisBungeeMode#SINGLE} - * @see #getJedisPool() - * @since 0.7.0 - * @deprecated use {@link #getSummoner() } - */ - @Deprecated(forRemoval = true) - public Jedis requestJedis() { - if (getMode() == RedisBungeeMode.SINGLE) { - return getJedisPool().getResource(); - } else { - throw new IllegalStateException("Mode is not " + RedisBungeeMode.SINGLE); - } - } - - /** - * This gets Redis Bungee {@link JedisPool} - * - * @return {@link JedisPool} - * @throws IllegalStateException if the {@link #getMode()} is not equal to {@link RedisBungeeMode#SINGLE} - * @throws IllegalStateException if JedisPool compatibility mode is disabled in the config - * @since 0.6.5 - */ - public JedisPool getJedisPool() { - if (getMode() == RedisBungeeMode.SINGLE) { - JedisPool jedisPool = ((JedisPooledSummoner) this.plugin.getSummoner()).getCompatibilityJedisPool(); - if (jedisPool == null) { - throw new IllegalStateException("JedisPool compatibility mode is disabled, Please enable it in the RedisBungee config.yml"); - } - return jedisPool; - } else { - throw new IllegalStateException("Mode is not " + RedisBungeeMode.SINGLE); - } - } - - /** - * This gives you an instance of JedisCluster that can't be closed - * see {@link com.imaginarycode.minecraft.redisbungee.api.summoners.NotClosableJedisCluster} - * - * @return {@link redis.clients.jedis.JedisCluster} - * @throws IllegalStateException if the {@link #getMode()} is not equal to {@link RedisBungeeMode#CLUSTER} - * @since 0.8.0 - * @deprecated use {@link #getSummoner()} - */ - @Deprecated(forRemoval = true) - public JedisCluster requestClusterJedis() { - if (getMode() == RedisBungeeMode.CLUSTER) { - return ((JedisClusterSummoner) this.plugin.getSummoner()).obtainResource(); - } else { - throw new IllegalStateException("Mode is not " + RedisBungeeMode.CLUSTER); - } - } - - /** - * This gives you an instance of JedisPooled that can't be closed - * see {@link com.imaginarycode.minecraft.redisbungee.api.summoners.NotClosableJedisPooled} - * - * @return {@link redis.clients.jedis.JedisPooled} - * @throws IllegalStateException if the {@link #getMode()} is not equal to {@link RedisBungeeMode#SINGLE} - * @since 0.8.0 - * @deprecated use {@link #getSummoner()} - */ - @Deprecated(forRemoval = true) - public JedisPooled requestJedisPooled() { - if (getMode() == RedisBungeeMode.SINGLE) { - return ((JedisPooledSummoner) this.plugin.getSummoner()).obtainResource(); - } else { - throw new IllegalStateException("Mode is not " + RedisBungeeMode.SINGLE); - } - } - /** * returns Summoner class responsible for Single Jedis {@link redis.clients.jedis.JedisPooled} with {@link JedisPool}, Cluster Jedis {@link redis.clients.jedis.JedisCluster} handling * diff --git a/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeAPI.java b/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeAPI.java index 01d55fc..8d3dd5e 100644 --- a/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeAPI.java +++ b/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeAPI.java @@ -13,6 +13,7 @@ package com.imaginarycode.minecraft.redisbungee; import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.ServerInfo; +import net.kyori.adventure.text.Component; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; @@ -52,6 +53,30 @@ public class RedisBungeeAPI extends AbstractRedisBungeeAPI { return ((ServerObjectFetcher) this.plugin).getProxy().getServer(serverName).map((RegisteredServer::getServerInfo)).orElse(null); } + /** + * Kicks a player from the network + * calls {@link #getUuidFromName(String)} to get uuid + * + * @param playerName player name + * @param message kick message that player will see on kick + * @since 0.12.0 + */ + public void kickPlayer(String playerName, Component message) { + kickPlayer(getUuidFromName(playerName), message); + } + + /** + * Kicks a player from the network + * + * @param playerUUID player name + * @param message kick message that player will see on kick + * @since 0.12.0 + */ + public void kickPlayer(UUID playerUUID, Component message) { + this.plugin.playerDataManager().kickPlayer(playerUUID, message); + } + + /** * Api instance *