From 70a989e955babd427681465681fa66db60873d9d Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 28 Jun 2020 21:29:25 -0400 Subject: [PATCH] Minor cleanup and add some missing Deprecated tags --- .../api/event/player/KickedFromServerEvent.java | 8 ++++---- .../api/proxy/player/TabListEntry.java | 4 +++- .../api/proxy/server/ServerPing.java | 1 + .../connection/client/StatusSessionHandler.java | 14 -------------- 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/api/src/main/java/com/velocitypowered/api/event/player/KickedFromServerEvent.java b/api/src/main/java/com/velocitypowered/api/event/player/KickedFromServerEvent.java index 3c7f70768..7f4a1208a 100644 --- a/api/src/main/java/com/velocitypowered/api/event/player/KickedFromServerEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/player/KickedFromServerEvent.java @@ -33,6 +33,7 @@ public final class KickedFromServerEvent implements * @param duringServerConnect whether or not the player was kicked during the connection process * @param fancyReason a fancy reason for being disconnected, used for the initial result */ + @Deprecated public KickedFromServerEvent(Player player, RegisteredServer server, @Nullable Component originalReason, boolean duringServerConnect, Component fancyReason) { this(player, server, originalReason, duringServerConnect, Notify.create(fancyReason)); @@ -46,10 +47,9 @@ public final class KickedFromServerEvent implements * @param duringServerConnect whether or not the player was kicked during the connection process * @param result the initial result */ - public KickedFromServerEvent(Player player, - RegisteredServer server, - @Nullable Component originalReason, boolean duringServerConnect, - ServerKickResult result) { + @Deprecated + public KickedFromServerEvent(Player player, RegisteredServer server, + @Nullable Component originalReason, boolean duringServerConnect, ServerKickResult result) { this(player, server, AdventureCompat.asAdventureComponent(originalReason), duringServerConnect, result); } diff --git a/api/src/main/java/com/velocitypowered/api/proxy/player/TabListEntry.java b/api/src/main/java/com/velocitypowered/api/proxy/player/TabListEntry.java index ea0de73f8..5b0ba7549 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/player/TabListEntry.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/player/TabListEntry.java @@ -34,8 +34,9 @@ public interface TabListEntry { * * @return {@link Optional} text {@link net.kyori.text.Component} of name displayed in the tab * list - * + * @deprecated Use {@link #getDisplayNameComponent()} instead */ + @Deprecated Optional getDisplayName(); /** @@ -56,6 +57,7 @@ public interface TabListEntry { * @return {@code this}, for chaining * @deprecated Use {@link #setDisplayName(Component)} instead */ + @Deprecated TabListEntry setDisplayName(net.kyori.text.Component displayName); /** diff --git a/api/src/main/java/com/velocitypowered/api/proxy/server/ServerPing.java b/api/src/main/java/com/velocitypowered/api/proxy/server/ServerPing.java index 9b78f3554..f1a7ccd66 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/server/ServerPing.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/server/ServerPing.java @@ -293,6 +293,7 @@ public final class ServerPing { return samplePlayers; } + @Deprecated public Optional getDescription() { return Optional.ofNullable(description).map(AdventureCompat::asOriginalTextComponent); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/StatusSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/StatusSessionHandler.java index 675f02b7a..62455d760 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/StatusSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/StatusSessionHandler.java @@ -1,14 +1,12 @@ package com.velocitypowered.proxy.connection.client; import com.google.common.collect.ImmutableList; -import com.google.gson.Gson; import com.spotify.futures.CompletableFutures; import com.velocitypowered.api.event.proxy.ProxyPingEvent; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.ServerPing; -import com.velocitypowered.api.util.Favicon; import com.velocitypowered.api.util.ModInfo; import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.config.PingPassthroughMode; @@ -20,7 +18,6 @@ import com.velocitypowered.proxy.protocol.packet.LegacyPing; import com.velocitypowered.proxy.protocol.packet.StatusPing; import com.velocitypowered.proxy.protocol.packet.StatusRequest; import com.velocitypowered.proxy.protocol.packet.StatusResponse; -import com.velocitypowered.proxy.protocol.util.FaviconSerializer; import com.velocitypowered.proxy.server.VelocityRegisteredServer; import io.netty.buffer.ByteBuf; import java.net.InetSocketAddress; @@ -34,17 +31,6 @@ import org.apache.logging.log4j.Logger; public class StatusSessionHandler implements MinecraftSessionHandler { - private static final Gson PRE_1_16_PING_SERIALIZER = GsonComponentSerializer - .colorDownsamplingGson() - .serializer() - .newBuilder() - .registerTypeHierarchyAdapter(Favicon.class, new FaviconSerializer()) - .create(); - private static final Gson POST_1_16_PING_SERIALIZER = GsonComponentSerializer.gson() - .serializer() - .newBuilder() - .registerTypeHierarchyAdapter(Favicon.class, new FaviconSerializer()) - .create(); private static final Logger logger = LogManager.getLogger(StatusSessionHandler.class); private final VelocityServer server;