use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutScoreboardScore in project LanternServer by LanternPowered.
the class CodecPlayOutScoreboardScore method encode.
@Override
public ByteBuffer encode(CodecContext context, MessagePlayOutScoreboardScore message) throws CodecException {
ByteBuffer buf = context.byteBufAlloc().buffer();
buf.writeString(message.getScoreName());
int action = message instanceof MessagePlayOutScoreboardScore.Remove ? 1 : 0;
buf.writeByte((byte) action);
buf.writeString(message.getObjectiveName());
if (action == 0) {
buf.writeVarInt(((MessagePlayOutScoreboardScore.CreateOrUpdate) message).getValue());
}
return buf;
}
Aggregations