how can i run a other command using codes? PHP: $this->getServer()->dispatchCommand(new ConsoleCommandSender(), "say hello");
What??? other commands? PHP: $this->getServer()->dispatchCommand(new ConsoleCommandSender(), "YOUR COMMAND HERE"); Or you mean run commands as player? PHP: /** var Player $p */$this->getServer()->dispatchCommand($p, "YOUR COMMAND HERE");
i can't run the command as a player because the player doesn't have perm for the command i want it to use
PHP: $cmd = "setuperm " . $pn . " vortex.command.fly"; $this->getServer()->dispatchCommand(new ConsoleCommandSender(), $cmd); would this work?
The plugin SimpleMacros does this: https://github.com/PEMapModder/Smal...os/src/pemapmodder/simplemacros/Main.php#L332 Check out the code related to $asOp. It temporarily gives the player the required permissions and revokes immediately.