mirror of https://github.com/Minestom/Minestom.git
Write scoreboard objects using standard JSON serialization (#196)
This commit is contained in:
parent
36813c6858
commit
156c6a31df
|
@ -38,7 +38,7 @@ public class ScoreboardObjectivePacket implements ComponentHoldingServerPacket {
|
|||
writer.writeByte(mode);
|
||||
|
||||
if (mode == 0 || mode == 2) {
|
||||
writer.writeComponentAsLegacy(objectiveValue);
|
||||
writer.writeComponent(objectiveValue);
|
||||
writer.writeVarInt(type.ordinal());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ 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;
|
||||
|
@ -18,7 +17,6 @@ import org.jglrxavpok.hephaistos.nbt.NBTWriter;
|
|||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
@ -74,17 +72,6 @@ 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