From 95d3e151dfe6d418c1464008b7801b70de23c97a Mon Sep 17 00:00:00 2001 From: mathiascode Date: Thu, 4 Mar 2021 02:55:06 +0200 Subject: [PATCH] Update command restrictions --- .../extras/modules/server/ServerCommand.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) 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 ff3ef5d..1cbd922 100644 --- a/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java +++ b/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java @@ -95,8 +95,14 @@ public final class ServerCommand implements Listener { arr[arr.length - 1] = "64"; return String.join(" ", arr); } - } else if ("title".equalsIgnoreCase(arr[i + 1])) { - if (parseCharCodes(command).contains("selector")) { + } else if ("bossbar".equalsIgnoreCase(arr[i + 1]) + || "fill".equalsIgnoreCase(arr[i + 1]) + || "setblock".equalsIgnoreCase(arr[i + 1]) + || "tellraw".equalsIgnoreCase(arr[i + 1]) + || "title".equalsIgnoreCase(arr[i + 1])) { + command = parseCharCodes(command) + if (command.contains("selector") + || command.contains("translate")) { return "cancel"; } } @@ -119,6 +125,10 @@ public final class ServerCommand implements Listener { if (command.contains("auto")) { return command.replace("auto", "[auto]"); } + if (command.contains("selector") + || command.contains("translate")) { + return "cancel"; + } case "/minecraft:gamerule": case "/gamerule": if (arr.length >= 3) { @@ -158,9 +168,17 @@ public final class ServerCommand implements Listener { return String.join(" ", arr); } break; + case "/minecraft:bossbar": + case "/minecraft:setblock": + case "/minecraft:tellraw": case "/minecraft:title": + case "/bossbar": + case "/setblock": + case "/tellraw": case "/title": - if (parseCharCodes(command).contains("selector")) { + command = parseCharCodes(command) + if (command.contains("selector") + || command.contains("translate")) { return "cancel"; } break;