hello we are creating a very simple plugin that when I write / invis become invisible when the rewrite disable invisibility effect so far I wrote this PHP: <?phpnamespace invisible;use pocketmine\plugin\PluginBase;use pocketmine\utils\TextFormat;use pocketmine\command\ConsoleCommandSender;use pocketmine\event\Listener;use pocketmine\command\Command;use pocketmine\command\CommandSender;class main extends PluginBase implements Listener{public function onEnable(){ $this->getlogger()->info(TextFormat::GREEN . "Il plugin è partito"); $this->saveDefaultConfig();} public function onDisable(){ $this->getLogger()->info(TextFormat::RED . "Il plugin è spento");}public function onCommand(CommandSender $sender, Command $command, $label, array $args){ if (! $sender->isOp ()) { $sender->sendMessage ( "Non sei op" ); return; } if(strtolower($command->$getName())== "invis"){ $command= str_replace("{player}", $player->getName(), $this->getConfig()->get("Comando")); $this->getServer()->dispatchCommand(new ConsoleCommandSender(), $command); }}}?>
Don't use dispatchCommand in plugins if it is not necessary. Actually you can just use $player->addEffect().
and while we are on the subject, why not check out our syntax guidelines (https://github.com/PocketMine/PocketMine-MP/blob/master/CONTRIBUTING.md#code-syntax). They are pretty non-standard so feel free to use an established PHP standard instead. However, if your plugins are bundles of nonsense which "work", they will 1) break easily and 2) won't be accepted into the repository. http://xkcd.com/1513/