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;
}
Aggregations