From a071fd5058099568f35dc84cca35de5369455751 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Fri, 12 Sep 2014 10:19:28 +0200 Subject: [PATCH] Remove sender references when they no longer are needed. --- .../massivecore/cmd/MassiveCommand.java | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/com/massivecraft/massivecore/cmd/MassiveCommand.java b/src/com/massivecraft/massivecore/cmd/MassiveCommand.java index f3f2fbe2..7fb2b33f 100644 --- a/src/com/massivecraft/massivecore/cmd/MassiveCommand.java +++ b/src/com/massivecraft/massivecore/cmd/MassiveCommand.java @@ -207,18 +207,6 @@ public class MassiveCommand // The commandChain is a list of the parent command chain used to get to this command. public void execute(CommandSender sender, List args, List commandChain) { - // Set the execution-time specific variables - this.sender = sender; - this.senderIsConsole = true; - this.me = null; - if (sender instanceof Player) - { - this.me = (Player) sender; - this.senderIsConsole = false; - } - - this.fixSenderVars(); - this.setArgs(args); this.setCommandChain(commandChain); @@ -240,12 +228,34 @@ public class MassiveCommand } } - if ( ! validCall(this.sender, this.getArgs())) return; + // Set Sender Variables + this.sender = sender; + this.senderIsConsole = true; + this.me = null; + if (sender instanceof Player) + { + this.me = (Player) sender; + this.senderIsConsole = false; + } + this.fixSenderVars(); + if ( ! validCall(this.sender, this.getArgs())) return; perform(); + + // Unset Sender Variables + this.sender = null; + this.me = null; + this.unsetSenderVars(); } - public void fixSenderVars() {}; + public void fixSenderVars() + { + + } + public void unsetSenderVars() + { + + } public void execute(CommandSender sender, List args) {