Fix optional metadata

This commit is contained in:
themode 2021-01-31 15:26:51 +01:00
parent 1707cc73f5
commit 735dd50f4e

View File

@ -203,10 +203,12 @@ public class Metadata {
@Override
public void write(@NotNull BinaryWriter writer) {
writer.writeVarInt(type);
final boolean present = value != null;
writer.writeBoolean(present);
if (present) {
super.write(writer);
this.valueWriter.accept(writer);
}
}
}