Merge branch 'master' into new-block-api

This commit is contained in:
TheMode 2021-07-23 01:09:22 +02:00
commit 6c4cb66737
2 changed files with 5 additions and 9 deletions

View File

@ -254,10 +254,8 @@ public class ArgumentType {
} }
/** /**
* @see ArgumentLoop * @see ArgumentLong
* @deprecated brigadier does not support long
*/ */
@Deprecated
public static ArgumentLong Long(@NotNull String id) { public static ArgumentLong Long(@NotNull String id) {
return new ArgumentLong(id); return new ArgumentLong(id);
} }

View File

@ -35,16 +35,14 @@ public class ArgumentLong extends ArgumentNumber<Long> {
@Override @Override
public void processNodes(@NotNull NodeMaker nodeMaker, boolean executable) { public void processNodes(@NotNull NodeMaker nodeMaker, boolean executable) {
DeclareCommandsPacket.Node argumentNode = simpleArgumentNode(this, executable, false, false); DeclareCommandsPacket.Node argumentNode = simpleArgumentNode(this, executable, false, false);
// TODO maybe use ArgumentLiteral/ArgumentWord and impose long restriction server side? argumentNode.parser = "brigadier:long";
argumentNode.parser = "brigadier:integer";
argumentNode.properties = BinaryWriter.makeArray(packetWriter -> { argumentNode.properties = BinaryWriter.makeArray(packetWriter -> {
packetWriter.writeByte(getNumberProperties()); packetWriter.writeByte(getNumberProperties());
if (this.hasMin()) if (this.hasMin())
packetWriter.writeInt(this.getMin().intValue()); packetWriter.writeLong(this.getMin());
if (this.hasMax()) if (this.hasMax())
packetWriter.writeInt(this.getMax().intValue()); packetWriter.writeLong(this.getMax());
}); });
nodeMaker.addNodes(new DeclareCommandsPacket.Node[]{argumentNode}); nodeMaker.addNodes(new DeclareCommandsPacket.Node[]{argumentNode});