mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-15 23:26:21 +01:00
Merge pull request #186 from kezz/fix-scorebord-value
Write scoreboard values using legacy strings
This commit is contained in:
commit
d41402c2e7
@ -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