Added correct PluginIdentifiableCommand

This commit is contained in:
Shoghi Cervantes
2014-04-03 13:08:11 +02:00
parent 27fcf0286e
commit 04917ecd5a
5 changed files with 46 additions and 10 deletions

View File

@@ -25,6 +25,7 @@ use pocketmine\command\Command;
use pocketmine\command\CommandExecutor;
use pocketmine\command\CommandSender;
use pocketmine\command\PluginCommand;
use pocketmine\command\PluginIdentifiableCommand;
use pocketmine\Server;
use pocketmine\utils\Config;
@@ -137,7 +138,7 @@ abstract class PluginBase implements Plugin, CommandExecutor{
$command = $this->getServer()->getPluginCommand(strtolower($this->description->getName()) . ":" . $name);
}
if($command instanceof PluginCommand and $command->getPlugin() === $this){
if($command instanceof PluginIdentifiableCommand and $command->getPlugin() === $this){
return $command;
}else{
return null;

View File

@@ -151,6 +151,11 @@ class PluginManager{
if(($plugin = $loader->loadPlugin($path)) instanceof Plugin){
$this->plugins[$plugin->getDescription()->getName()] = $plugin;
$pluginCommands = $this->parseYamlCommands($plugin);
if(count($pluginCommands) > 0){
$this->commandMap->registerAll($plugin->getDescription()->getName(), $pluginCommands);
}
return $plugin;
}
}
@@ -500,11 +505,6 @@ class PluginManager{
*/
public function enablePlugin(Plugin $plugin){
if(!$plugin->isEnabled()){
$pluginCommands = $this->parseYamlCommands($plugin);
if(count($pluginCommands) > 0){
$this->commandMap->registerAll($plugin->getDescription()->getName(), $pluginCommands);
}
foreach($plugin->getDescription()->getPermissions() as $perm){
$this->addPermission($perm);