Change ArgumentLong to use actual longs

why is this not a thing already
This commit is contained in:
MrGazdag 2021-07-22 19:44:39 +02:00 committed by GitHub
parent 8f6f63b2c8
commit d3515c13c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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