mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-08 04:38:35 +00:00
Use CommandExecutor by default on plugins :P
This commit is contained in:
parent
711519d4ff
commit
4098252ec7
@ -39,11 +39,7 @@ class PluginCommand extends Command implements PluginIdentifiableCommand{
|
|||||||
public function __construct($name, Plugin $owner){
|
public function __construct($name, Plugin $owner){
|
||||||
parent::__construct($name);
|
parent::__construct($name);
|
||||||
$this->owningPlugin = $owner;
|
$this->owningPlugin = $owner;
|
||||||
if(!($owner instanceof CommandExecutor)){
|
|
||||||
trigger_error("Plugin does not implement CommandExecutor", E_USER_WARNING);
|
|
||||||
}else{
|
|
||||||
$this->executor = $owner;
|
$this->executor = $owner;
|
||||||
}
|
|
||||||
$this->usageMessage = "";
|
$this->usageMessage = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,13 +23,14 @@
|
|||||||
* Plugin related classes
|
* Plugin related classes
|
||||||
*/
|
*/
|
||||||
namespace pocketmine\plugin;
|
namespace pocketmine\plugin;
|
||||||
|
use pocketmine\command\CommandExecutor;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It is recommended to use PluginBase for the actual plugin
|
* It is recommended to use PluginBase for the actual plugin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
interface Plugin{
|
interface Plugin extends CommandExecutor{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the plugin is loaded, before calling onEnable()
|
* Called when the plugin is loaded, before calling onEnable()
|
||||||
|
@ -22,9 +22,7 @@
|
|||||||
namespace pocketmine\plugin;
|
namespace pocketmine\plugin;
|
||||||
|
|
||||||
use pocketmine\command\Command;
|
use pocketmine\command\Command;
|
||||||
use pocketmine\command\CommandExecutor;
|
|
||||||
use pocketmine\command\CommandSender;
|
use pocketmine\command\CommandSender;
|
||||||
use pocketmine\command\PluginCommand;
|
|
||||||
use pocketmine\command\PluginIdentifiableCommand;
|
use pocketmine\command\PluginIdentifiableCommand;
|
||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
use pocketmine\utils\Config;
|
use pocketmine\utils\Config;
|
||||||
@ -152,6 +150,18 @@ abstract class PluginBase implements Plugin{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CommandSender $sender
|
||||||
|
* @param Command $command
|
||||||
|
* @param string $label
|
||||||
|
* @param array $args
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function onCommand(CommandSender $sender, Command $command, $label, array $args){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user