13
0
geforkt von Mirrors/Velocity

Minor cleanup and add some missing Deprecated tags

Dieser Commit ist enthalten in:
Andrew Steinborn 2020-06-28 21:29:25 -04:00
Ursprung 2e7a598916
Commit 70a989e955
4 geänderte Dateien mit 8 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -33,6 +33,7 @@ public final class KickedFromServerEvent implements
* @param duringServerConnect whether or not the player was kicked during the connection process * @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 * @param fancyReason a fancy reason for being disconnected, used for the initial result
*/ */
@Deprecated
public KickedFromServerEvent(Player player, RegisteredServer server, public KickedFromServerEvent(Player player, RegisteredServer server,
@Nullable Component originalReason, boolean duringServerConnect, Component fancyReason) { @Nullable Component originalReason, boolean duringServerConnect, Component fancyReason) {
this(player, server, originalReason, duringServerConnect, Notify.create(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 duringServerConnect whether or not the player was kicked during the connection process
* @param result the initial result * @param result the initial result
*/ */
public KickedFromServerEvent(Player player, @Deprecated
RegisteredServer server, public KickedFromServerEvent(Player player, RegisteredServer server,
@Nullable Component originalReason, boolean duringServerConnect, @Nullable Component originalReason, boolean duringServerConnect, ServerKickResult result) {
ServerKickResult result) {
this(player, server, AdventureCompat.asAdventureComponent(originalReason), duringServerConnect, this(player, server, AdventureCompat.asAdventureComponent(originalReason), duringServerConnect,
result); result);
} }

Datei anzeigen

@ -34,8 +34,9 @@ public interface TabListEntry {
* *
* @return {@link Optional} text {@link net.kyori.text.Component} of name displayed in the tab * @return {@link Optional} text {@link net.kyori.text.Component} of name displayed in the tab
* list * list
* * @deprecated Use {@link #getDisplayNameComponent()} instead
*/ */
@Deprecated
Optional<net.kyori.text.Component> getDisplayName(); Optional<net.kyori.text.Component> getDisplayName();
/** /**
@ -56,6 +57,7 @@ public interface TabListEntry {
* @return {@code this}, for chaining * @return {@code this}, for chaining
* @deprecated Use {@link #setDisplayName(Component)} instead * @deprecated Use {@link #setDisplayName(Component)} instead
*/ */
@Deprecated
TabListEntry setDisplayName(net.kyori.text.Component displayName); TabListEntry setDisplayName(net.kyori.text.Component displayName);
/** /**

Datei anzeigen

@ -293,6 +293,7 @@ public final class ServerPing {
return samplePlayers; return samplePlayers;
} }
@Deprecated
public Optional<net.kyori.text.Component> getDescription() { public Optional<net.kyori.text.Component> getDescription() {
return Optional.ofNullable(description).map(AdventureCompat::asOriginalTextComponent); return Optional.ofNullable(description).map(AdventureCompat::asOriginalTextComponent);
} }

Datei anzeigen

@ -1,14 +1,12 @@
package com.velocitypowered.proxy.connection.client; package com.velocitypowered.proxy.connection.client;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.gson.Gson;
import com.spotify.futures.CompletableFutures; import com.spotify.futures.CompletableFutures;
import com.velocitypowered.api.event.proxy.ProxyPingEvent; import com.velocitypowered.api.event.proxy.ProxyPingEvent;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.proxy.InboundConnection;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.proxy.server.ServerPing; import com.velocitypowered.api.proxy.server.ServerPing;
import com.velocitypowered.api.util.Favicon;
import com.velocitypowered.api.util.ModInfo; import com.velocitypowered.api.util.ModInfo;
import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.config.PingPassthroughMode; 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.StatusPing;
import com.velocitypowered.proxy.protocol.packet.StatusRequest; import com.velocitypowered.proxy.protocol.packet.StatusRequest;
import com.velocitypowered.proxy.protocol.packet.StatusResponse; import com.velocitypowered.proxy.protocol.packet.StatusResponse;
import com.velocitypowered.proxy.protocol.util.FaviconSerializer;
import com.velocitypowered.proxy.server.VelocityRegisteredServer; import com.velocitypowered.proxy.server.VelocityRegisteredServer;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
@ -34,17 +31,6 @@ import org.apache.logging.log4j.Logger;
public class StatusSessionHandler implements MinecraftSessionHandler { 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 static final Logger logger = LogManager.getLogger(StatusSessionHandler.class);
private final VelocityServer server; private final VelocityServer server;