13
0
geforkt von Mirrors/Velocity

Yet another breaking change in the Adventure API

Dieser Commit ist enthalten in:
Andrew Steinborn 2020-07-22 11:18:46 -04:00
Ursprung bf0ae6b856
Commit f34b5ac2fc
6 geänderte Dateien mit 10 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -138,7 +138,7 @@ class BungeeCordMessageResponder {
}
private void processMessage(ByteBufDataInput in) {
processMessage0(in, LegacyComponentSerializer.legacy());
processMessage0(in, LegacyComponentSerializer.legacySection());
}
private void processMessageRaw(ByteBufDataInput in) {
@ -210,7 +210,7 @@ class BungeeCordMessageResponder {
private void processKick(ByteBufDataInput in) {
proxy.getPlayer(in.readUTF()).ifPresent(player -> {
String kickReason = in.readUTF();
player.disconnect(LegacyComponentSerializer.legacy().deserialize(kickReason));
player.disconnect(LegacyComponentSerializer.legacySection().deserialize(kickReason));
});
}

Datei anzeigen

@ -273,7 +273,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.legacy().serialize(message));
object.addProperty("text", LegacyComponentSerializer.legacySection().serialize(message));
Chat chat = new Chat();
chat.setMessage(object.toString());
chat.setType((byte) 1);
@ -391,7 +391,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
*/
public void disconnect0(Component reason, boolean duringLogin) {
logger.info("{} has disconnected: {}", this,
LegacyComponentSerializer.legacy().serialize(reason));
LegacyComponentSerializer.legacySection().serialize(reason));
connection.closeWith(Disconnect.create(reason, this.getProtocolVersion()));
}

Datei anzeigen

@ -60,7 +60,7 @@ public final class InitialInboundConnection implements InboundConnection,
*/
public void disconnect(Component reason) {
logger.info("{} has disconnected: {}", this,
LegacyComponentSerializer.legacy().serialize(reason));
LegacyComponentSerializer.legacySection().serialize(reason));
connection.closeWith(Disconnect.create(reason, getProtocolVersion()));
}

Datei anzeigen

@ -39,7 +39,7 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Cons
@Override
public void sendMessage(net.kyori.adventure.text.@NonNull Component message) {
logger.info(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacy()
logger.info(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection()
.serialize(message));
}

Datei anzeigen

@ -48,7 +48,7 @@ public class LegacyDisconnect {
LEGACY_COLOR_CODE + "1",
Integer.toString(response.getVersion().getProtocol()),
response.getVersion().getName(),
getFirstLine(LegacyComponentSerializer.legacy().serialize(response
getFirstLine(LegacyComponentSerializer.legacySection().serialize(response
.getDescriptionComponent())),
Integer.toString(players.getOnline()),
Integer.toString(players.getMax())
@ -74,7 +74,7 @@ public class LegacyDisconnect {
*/
public static LegacyDisconnect from(TextComponent component) {
// We intentionally use the legacy serializers, because the old clients can't understand JSON.
String serialized = LegacyComponentSerializer.legacy().serialize(component);
String serialized = LegacyComponentSerializer.legacySection().serialize(component);
return new LegacyDisconnect(serialized);
}

Datei anzeigen

@ -127,7 +127,8 @@ public class PlayerListItem implements MinecraftPacket {
} else {
Item item = items.get(0);
if (item.getDisplayName() != null) {
String displayName = LegacyComponentSerializer.legacy().serialize(item.getDisplayName());
String displayName = LegacyComponentSerializer.legacySection()
.serialize(item.getDisplayName());
ProtocolUtils.writeString(buf,
displayName.length() > 16 ? displayName.substring(0, 16) : displayName);
} else {