mirror of
https://github.com/kaboomserver/extras.git
synced 2025-02-11 03:29:50 +00:00
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:
parent
a3ea2d7498
commit
811178d30a
1 changed files with 19 additions and 0 deletions
|
@ -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":
|
||||
|
|
Loading…
Reference in a new issue