13
0
geforkt von Mirrors/Velocity

Replace uses of deprecated LegacyComponentSerializer.INSTANCE

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-05-31 15:50:46 -04:00
Ursprung a77fee9ad1
Commit dfe210707f
5 geänderte Dateien mit 7 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -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;

Datei anzeigen

@ -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));
}

Datei anzeigen

@ -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));
}
}

Datei anzeigen

@ -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

Datei anzeigen

@ -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);
}