From 811178d30a3c2774ea9f215584b2b667222fb29a Mon Sep 17 00:00:00 2001 From: Business Goose <44676012+business-goose@users.noreply.github.com> Date: Sun, 18 Apr 2021 03:25:43 +0100 Subject: [PATCH] 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? --- .../extras/modules/server/ServerCommand.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java b/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java index 99ab6fb..ff3ef5d 100644 --- a/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java +++ b/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java @@ -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":