Search in sources :

Example 1 with MessagePlayOutScoreboardObjective

use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutScoreboardObjective in project LanternServer by LanternPowered.

the class CodecPlayOutScoreboardObjective method encode.

@Override
public ByteBuffer encode(CodecContext context, MessagePlayOutScoreboardObjective message) throws CodecException {
    ByteBuffer buf = context.byteBufAlloc().buffer();
    buf.writeString(message.getObjectiveName());
    if (message instanceof MessagePlayOutScoreboardObjective.CreateOrUpdate) {
        buf.writeByte((byte) (message instanceof MessagePlayOutScoreboardObjective.Create ? 0 : 2));
        MessagePlayOutScoreboardObjective.CreateOrUpdate message0 = (MessagePlayOutScoreboardObjective.CreateOrUpdate) message;
        buf.writeString(message0.getDisplayName());
        buf.writeString(message0.getDisplayMode().getId());
    } else {
        buf.writeByte((byte) 1);
    }
    return buf;
}
Also used : ByteBuffer(org.lanternpowered.server.network.buffer.ByteBuffer) MessagePlayOutScoreboardObjective(org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutScoreboardObjective)

Aggregations

ByteBuffer (org.lanternpowered.server.network.buffer.ByteBuffer)1 MessagePlayOutScoreboardObjective (org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutScoreboardObjective)1