PocketMine (PHP) Command Context possible?
one text
Solution:
There is a very handy library/virion that handles all this for you. Take a look at https://github.com/CortexPE/Commando and if you need any examples you can look at https://github.com/CortexPE/Hierarchy. With this library you can add custom argument types.
<?php
namespace mohamed205\example\argument;
use CortexPE\Commando\args\StringEnumArgument;
use pocketmine\command\CommandSender;
class ExampleArgument extends StringEnumArgument
{
protected const VALUES = [
// put valid values for your argument here
];
public function parse(string $argument, CommandSender $sender)
{
return $this->getValue($argument);
}
public function getTypeName(): string
{
return "exampleArgument";
}
}
Source