diff --git a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java index f64b30560..6fd13239e 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java @@ -287,7 +287,7 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi if (motd.startsWith("{")) { motdAsComponent = GsonComponentSerializer.INSTANCE.deserialize(motd); } else { - motdAsComponent = LegacyComponentSerializer.INSTANCE.deserialize(motd, '&'); + motdAsComponent = LegacyComponentSerializer.legacy().deserialize(motd, '&'); } } return motdAsComponent; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java index 5bb3ec2db..7589300fa 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java @@ -208,7 +208,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { // Due to issues with action bar packets, we'll need to convert the text message into a // legacy message and then inject the legacy text into a component... yuck! JsonObject object = new JsonObject(); - object.addProperty("text", LegacyComponentSerializer.INSTANCE.serialize(component)); + object.addProperty("text", LegacyComponentSerializer.legacy().serialize(component)); json = object.toString(); } } else { @@ -254,7 +254,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { @Override public void disconnect(Component reason) { logger.info("{} has disconnected: {}", this, - LegacyComponentSerializer.INSTANCE.serialize(reason)); + LegacyComponentSerializer.legacy().serialize(reason)); minecraftConnection.closeWith(Disconnect.create(reason)); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/InitialInboundConnection.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/InitialInboundConnection.java index 05a8b7b13..1a663edf7 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/InitialInboundConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/InitialInboundConnection.java @@ -55,7 +55,7 @@ class InitialInboundConnection implements InboundConnection, MinecraftConnection public void disconnect(Component reason) { logger.info("{} has disconnected: {}", this, - LegacyComponentSerializer.INSTANCE.serialize(reason)); + LegacyComponentSerializer.legacy().serialize(reason)); connection.closeWith(Disconnect.create(reason)); } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java b/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java index d31af224a..4b9d38aee 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java @@ -35,7 +35,7 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Cons @Override public void sendMessage(Component component) { - logger.info(LegacyComponentSerializer.INSTANCE.serialize(component)); + logger.info(LegacyComponentSerializer.legacy().serialize(component)); } @Override diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LegacyDisconnect.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LegacyDisconnect.java index 864b7c048..0b28ba17c 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LegacyDisconnect.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LegacyDisconnect.java @@ -26,7 +26,6 @@ public class LegacyDisconnect { * @param version the requesting clients' version * @return the disconnect packet */ - @SuppressWarnings("deprecation") // we use these on purpose to service older clients! public static LegacyDisconnect fromServerPing(ServerPing response, LegacyMinecraftPingVersion version) { Players players = response.getPlayers().orElse(FAKE_PLAYERS); @@ -47,7 +46,7 @@ public class LegacyDisconnect { LEGACY_COLOR_CODE + "1", Integer.toString(response.getVersion().getProtocol()), response.getVersion().getName(), - getFirstLine(LegacyComponentSerializer.INSTANCE.serialize(response.getDescription())), + getFirstLine(LegacyComponentSerializer.legacy().serialize(response.getDescription())), Integer.toString(players.getOnline()), Integer.toString(players.getMax()) )); @@ -72,8 +71,7 @@ public class LegacyDisconnect { */ public static LegacyDisconnect from(TextComponent component) { // We intentionally use the legacy serializers, because the old clients can't understand JSON. - @SuppressWarnings("deprecation") - String serialized = LegacyComponentSerializer.INSTANCE.serialize(component); + String serialized = LegacyComponentSerializer.legacy().serialize(component); return new LegacyDisconnect(serialized); }