-
Notifications
You must be signed in to change notification settings - Fork 2
Docs꞉ Getting Started with Ovommand
⠀
CommandOverload represents an overload of a command. This overload can be compared to function overloading // in languages such as java. It represents a single usage of the command. A command may have multiple // different overloads, which are handled differently. type CommandOverload struct { // Chaining determines if the parameters use chained subcommands or not. Chaining bool // Parameters is a list of command parameters that are part of the overload. These parameters specify the // usage of the command when this overload is applied. Parameters []CommandParameter }
A - How to use Ovommand
⠀⠀1. Hook Ovommand to your plugin
⠀⠀2. Create command/subCommand class
⠀⠀3. Register command to server
B - Links
If you have experience with Commando before, you can easily use this framework. The structure is kinda similar in a way.
use pocketmine\plugin\PluginBase;
class TestPlugin extends PluginBase{
protected function onEnable() : void{
OvommandHook::register($this);
}
}
MSG MSG
Source:
BaseCommand
BaseSubCommand
use galaxygames\ovommand\BaseCommand;
use galaxygames\ovommand\BaseSubCommand;
class TestCommand extends BaseCommand{
public function setup() : void{
$this->registerSubCommand(new TestSubCommand("sub1", ));
$this->registerSubCommand(new TestSubCommand("sub2"));
}
public function onRun(CommandSender $sender, string $label, array $args, string $preLabel = "") : void{}
}
class TestSubCommand extends BaseSubCommand{
public function setup() : void{}
public function onRun(CommandSender $sender, string $label, array $args, string $preLabel = "") : void{}
}
you can register infinite sub commands to sub command itself too C:
class TestSubCommand extends BaseSubCommand{
public function setup() : void{
$this->registerSubCommand(new TestSubCommand("subSub"));
}
public function onRun(CommandSender $sender, string $label, array $args, string $preLabel = "") : void{}
}
class TestSubSubCommand extends BaseSubCommand{
protected function setup() {}
public function onRun(CommandSender $sender, string $label, array $args, string $preLabel = "") : void{}
}
use pocketmine\plugin\PluginBase;
class TestPlugin extends PluginBase{
protected function onEnable() : void{
OvommandHook::register($this);
$this->getServer()->getCommandMap()->register("ovo", new TestCommand($this, "test", "Test ovo command", aliases: ["t", "ovo"]));
}
}
Demo plugin
Doc: Parameter⠀
Doc: Enum⠀
Doc: Result⠀⠀⠀
This wiki is under construction....
⠀Home⠀⠀
⠀Back to top⠀⠀
⠀Getting Started⠀⠀
⠀Parameters⠀⠀
⠀Enums⠀⠀
⠀Results⠀⠀
⠀FQA⠀⠀
⠀Demo plugin⠀
© 2023 GalaxyGamesMC