Patch integers of value 20 million and up in commands (#17)

* Patch integers of value 20 million and up in commands

* You know, like, patch the bug?
This commit is contained in:
Business Goose 2021-04-18 03:25:43 +01:00 committed by GitHub
parent a3ea2d7498
commit 811178d30a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,6 +53,25 @@ public final class ServerCommand implements Listener {
commandName = "/" + arr[0].toLowerCase();
}
for (int i = 1; i < arr.length; i++) {
if (arr[i].matches("^[+-]?(?:\\d+\\.?\\d*|\\d*\\.?\\d+)[\\r\\n]*$")) {
try {
int integer = Integer.parseInt(arr[i]);
try {
if (integer >= Integer.MAX_VALUE) {
return "cancel";
}
} catch (Exception e) {
return "cancel";
}
} catch (NumberFormatException e) {
// Ignore exception
}
}
}
try {
switch (commandName) {
case "/minecraft:execute":