Prevent the client from breaking due to weird command syntaxes

This commit is contained in:
TheMode 2021-08-17 21:39:26 +02:00
parent 9afb86a511
commit 460585ae9b

View File

@ -52,6 +52,9 @@ public class DeclareCommandsPacket implements ServerPacket {
public void write(@NotNull BinaryWriter writer) {
writer.writeByte(flags);
if (children != null && children.length > 262114) {
throw new RuntimeException("Children length " + children.length + " is bigger than the maximum allowed " + 262114);
}
writer.writeVarIntArray(children);
if ((flags & 0x08) != 0) {