From 48e1f93b643d3310af42047237dfc5f1aa0e2b22 Mon Sep 17 00:00:00 2001 From: ArcticZeroo Date: Tue, 20 Feb 2018 16:39:38 -0500 Subject: [PATCH] Prevent /bukkit: and /minecraft: commands for non-OP players --- .../mapparser/module/modules/CommandModule.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/CommandModule.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/CommandModule.java index 3cfe1ac73..480192e3a 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/CommandModule.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/CommandModule.java @@ -26,6 +26,20 @@ public class CommandModule extends Module super("Commands", plugin); } + @EventHandler + public void preventMe(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().toLowerCase().startsWith("/bukkit") + || event.getMessage().toLowerCase().startsWith("/minecraft")) + { + if (!event.getPlayer().isOp()) + { + event.getPlayer().sendMessage(F.main("Parser", "Nope, not allowed!")); + event.setCancelled(true); + } + } + } + @EventHandler public void onCommand(PlayerCommandPreprocessEvent event) {