Clean up player references even on exception.

This commit is contained in:
Olof Larsson 2014-10-22 07:53:56 +02:00
parent b083182291
commit 8fc5707061

View File

@ -247,24 +247,29 @@ public class MassiveCommand
} }
} }
// Set Sender Variables try
this.sender = sender;
this.senderIsConsole = true;
this.me = null;
if (sender instanceof Player)
{ {
this.me = (Player) sender; // Set Sender Variables
this.senderIsConsole = false; this.sender = sender;
this.senderIsConsole = true;
this.me = null;
if (sender instanceof Player)
{
this.me = (Player) sender;
this.senderIsConsole = false;
}
this.fixSenderVars();
if ( ! isValidCall(this.sender, this.getArgs())) return;
perform();
}
finally
{
// Unset Sender Variables
this.sender = null;
this.me = null;
this.unsetSenderVars();
} }
this.fixSenderVars();
if ( ! isValidCall(this.sender, this.getArgs())) return;
perform();
// Unset Sender Variables
this.sender = null;
this.me = null;
this.unsetSenderVars();
} }
public void fixSenderVars() public void fixSenderVars()