From bbf328919b6af22c773282920ff07e96579741b7 Mon Sep 17 00:00:00 2001 From: mcmonkey4eva Date: Sat, 20 Jun 2015 01:19:40 -0700 Subject: [PATCH] fix as_op silent Because morph wasn't paying attention --- .../commands/server/ExecuteCommand.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/server/ExecuteCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/server/ExecuteCommand.java index e19516d950..133a383edb 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/server/ExecuteCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/server/ExecuteCommand.java @@ -105,12 +105,14 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { if (!pcpe.isCancelled()) { boolean silentBool = silent.asBoolean(); Player player = ((BukkitScriptEntryData) scriptEntry.entryData).getPlayer().getPlayerEntity(); - if (silentBool) + if (silentBool) { silencedPlayers.add(player.getUniqueId()); + } player.performCommand(pcpe.getMessage().startsWith("/") ? pcpe.getMessage().substring(1) : pcpe.getMessage()); - if (silentBool) + if (silentBool) { silencedPlayers.remove(player.getUniqueId()); + } } } catch (Throwable e) { @@ -125,9 +127,18 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { try { PlayerCommandPreprocessEvent pcpe = new PlayerCommandPreprocessEvent(((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getPlayerEntity(), "/" + command); Bukkit.getPluginManager().callEvent(pcpe); - if (!pcpe.isCancelled()) - ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getPlayerEntity().performCommand( - pcpe.getMessage().startsWith("/") ? pcpe.getMessage().substring(1): pcpe.getMessage()); + if (!pcpe.isCancelled()) { + boolean silentBool = silent.asBoolean(); + Player player = ((BukkitScriptEntryData) scriptEntry.entryData).getPlayer().getPlayerEntity(); + if (silentBool) { + silencedPlayers.add(player.getUniqueId()); + } + player.performCommand(pcpe.getMessage().startsWith("/") ? + pcpe.getMessage().substring(1) : pcpe.getMessage()); + if (silentBool) { + silencedPlayers.remove(player.getUniqueId()); + } + } } catch (Throwable e) { dB.echoError(scriptEntry.getResidingQueue(), "Exception while executing command as OP.");