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

@ -35,13 +35,14 @@ class PluginCommand extends Command implements PluginIdentifiableCommand{
private $executor;
/**
* @param string $name
* @param Plugin $owner
* @param string $name
* @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);
$this->owningPlugin = $owner;
$this->executor = $owner;
$this->executor = $executor;
$this->usageMessage = "";
}

View File

@ -181,7 +181,7 @@ abstract class PluginBase implements Plugin, CommandExecutor{
continue;
}
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"])){
$newCmd->setDescription($data["description"]);
}