From bf549ee22367ede44193d7c160ab624b7016ff76 Mon Sep 17 00:00:00 2001 From: Corentin Boiteau Date: Sun, 17 Nov 2019 16:52:34 +0100 Subject: [PATCH] Update MainListener.java --- .../plugins/ArmorStandTools/MainListener.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/MainListener.java b/src/com/gmail/St3venAU/plugins/ArmorStandTools/MainListener.java index 664a9cf..c658d08 100644 --- a/src/com/gmail/St3venAU/plugins/ArmorStandTools/MainListener.java +++ b/src/com/gmail/St3venAU/plugins/ArmorStandTools/MainListener.java @@ -52,6 +52,23 @@ public class MainListener implements Listener { this.plugin = main; } + @EventHandler(ignoreCancelled = true) + public void onCommandProcess(PlayerCommandPreprocessEvent event) { + Player player = event.getPlayer(); + if (!plugin.carryingArmorStand.containsKey(player.getUniqueId())) + return; + + String command = event.getMessage().split(" ")[0].toLowerCase(); + for (String block : Config.commandsBlocked) { + if (!command.contains(block)) + continue; + + player.sendMessage(ChatColor.RED + Config.commandBlocked); + event.setCancelled(true); + return; + } + } + @EventHandler public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) { if(event.getRightClicked() instanceof ArmorStand) {