CortexPE/Commando

how to make a warps list arg?

rjworks opened this issue · 1 comments

how to make a warps list arg? player type /warp and it shows all warps in my config

Create enum

class WarpEnumArgument extends StringEnumArgument
{
    public function getTypeName(): string
    {
        return "string";
    }

    public function parse(string $argument, CommandSender $sender)
    {
        return $argument;
    }

    public function getEnumValues(): array
    {
        return MyWarps::getWarps();
    }

    public function getEnumName(): string
    {
        return "warp";
    }
}

Your command:

	protected function prepare(): void {
...
		$this->registerArgument(0, new WarpEnumArgument("warp", false));
	}