Stop parseGoal from removing the last argument

isNumeric returns false if the input is anything other than a positive integer. This meant that baritone wouldn't properly set goals if they ended in anything other than a positive integer.
This commit is contained in:
reb0rt 2019-08-18 13:04:39 +10:00 committed by GitHub
parent 0eb7a5aed6
commit 24da012903
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,7 +50,7 @@ import net.minecraft.world.chunk.Chunk;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.*; import java.util.*;
import static org.apache.commons.lang3.StringUtils.isNumeric; import static org.apache.commons.lang3.math.NumberUtils.isCreatable;
public class ExampleBaritoneControl implements Helper, AbstractGameEventListener { public class ExampleBaritoneControl implements Helper, AbstractGameEventListener {
private static final String COMMAND_PREFIX = "#"; private static final String COMMAND_PREFIX = "#";
@ -694,7 +694,7 @@ public class ExampleBaritoneControl implements Helper, AbstractGameEventListener
BetterBlockPos playerFeet = ctx.playerFeet(); BetterBlockPos playerFeet = ctx.playerFeet();
int length = params.length - 1; // length has to be smaller when a dimension parameter is added int length = params.length - 1; // length has to be smaller when a dimension parameter is added
if (params.length < 1 || (isNumeric(params[params.length - 1]) || params[params.length - 1].startsWith("~"))) { if (params.length < 1 || (isCreatable(params[params.length - 1]) || params[params.length - 1].startsWith("~"))) {
length = params.length; length = params.length;
} }
switch (length) { switch (length) {