From 5353139dd3cfb90c767415ad6b48b4b6afd8e3e6 Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Sat, 13 Feb 2021 20:08:25 -0500 Subject: [PATCH] Broader restricted permission rewards check --- .../convo/quests/rewards/RewardsPrompt.java | 41 ++++++++----------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/main/src/main/java/me/blackvein/quests/convo/quests/rewards/RewardsPrompt.java b/main/src/main/java/me/blackvein/quests/convo/quests/rewards/RewardsPrompt.java index 40793f65a..920298b44 100644 --- a/main/src/main/java/me/blackvein/quests/convo/quests/rewards/RewardsPrompt.java +++ b/main/src/main/java/me/blackvein/quests/convo/quests/rewards/RewardsPrompt.java @@ -967,33 +967,24 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt { if (s.startsWith("/")) { s = s.substring(1); } - switch (s.trim().split(" ")[0].toLowerCase()) { - case "*": - case "*.*": - case "bukkit.*": - case "bukkit.command.*": - case "bukkit.command.plugins": - case "bukkit.command.reload": - case "bukkit.command.timings": - case "minecraft.*": - case "minecraft.command.*": - case "minecraft.command.ban": - case "minecraft.command.ban-ip": - case "minecraft.command.deop": - case "minecraft.command.kick": - case "minecraft.command.kill": - case "minecraft.command.op": - case "minecraft.command.pardon": - case "minecraft.command.pardon-ip": - case "minecraft.command.save-all": - case "minecraft.command.save-off": - case "minecraft.command.save-on": - case "minecraft.command.stop": - case "minecraft.command.whitelist": + final String[] arr = { + "*", + "bukkit.command", + "minecraft.command", + "worledit" + }; + boolean found = false; + for (int i = 0; i < arr.length; i++) { + if (s.startsWith(arr[i])) { + found = true; + break; + } + } + if (found) { context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption") - + ChatColor.DARK_RED + " (" + s.trim() + ")"); + + ChatColor.DARK_RED + " (" + s.trim() + ")"); continue; - default: + } else { permissions.add(s.trim()); } }