PluginCommand: separate CommandExecutor param

looking at the code now it's clear that this class combines two jobs into the same class.
closes #3203
This commit is contained in:
Dylan K. Taylor 2019-12-04 19:14:45 +00:00
parent 2ff25dfbd2
commit b43bd5fb67
2 changed files with 6 additions and 5 deletions

View File

@ -37,11 +37,12 @@ class PluginCommand extends Command implements PluginIdentifiableCommand{
/** /**
* @param string $name * @param string $name
* @param Plugin $owner * @param Plugin $owner
* @param CommandExecutor $executor
*/ */
public function __construct(string $name, Plugin $owner){ public function __construct(string $name, Plugin $owner, CommandExecutor $executor){
parent::__construct($name); parent::__construct($name);
$this->owningPlugin = $owner; $this->owningPlugin = $owner;
$this->executor = $owner; $this->executor = $executor;
$this->usageMessage = ""; $this->usageMessage = "";
} }

View File

@ -181,7 +181,7 @@ abstract class PluginBase implements Plugin, CommandExecutor{
continue; continue;
} }
if(is_array($data)){ //TODO: error out if it isn't if(is_array($data)){ //TODO: error out if it isn't
$newCmd = new PluginCommand($key, $this); $newCmd = new PluginCommand($key, $this, $this);
if(isset($data["description"])){ if(isset($data["description"])){
$newCmd->setDescription($data["description"]); $newCmd->setDescription($data["description"]);
} }