mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-24 00:51:34 +01:00
Write scoreboard values using legacy strings
This commit is contained in:
parent
6b644d6130
commit
d433b0d3bc
@ -38,7 +38,7 @@ public class ScoreboardObjectivePacket implements ComponentHoldingServerPacket {
|
||||
writer.writeByte(mode);
|
||||
|
||||
if (mode == 0 || mode == 2) {
|
||||
writer.writeComponent(objectiveValue);
|
||||
writer.writeComponentAsLegacy(objectiveValue);
|
||||
writer.writeVarInt(type.ordinal());
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package net.minestom.server.utils.binary;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.adventure.AdventureSerializer;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
@ -73,6 +74,17 @@ public class BinaryWriter extends OutputStream {
|
||||
this.writeSizedString(AdventureSerializer.serialize(component));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a component to the buffer as a sized string. This method uses
|
||||
* {@link LegacyComponentSerializer} to convert the component into a string
|
||||
* containing the legacy section signs.
|
||||
*
|
||||
* @param component the component
|
||||
*/
|
||||
public void writeComponentAsLegacy(@NotNull Component component) {
|
||||
this.writeSizedString(LegacyComponentSerializer.legacySection().serialize(component));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a single boolean to the buffer.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user