mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 12:04:46 +00:00
Added correct PluginIdentifiableCommand
This commit is contained in:
@@ -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;
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user