Skip to main content

Command API

The command API is for handling subcommands, permissions and tab complete automatically using reflections

How to use#

1. Create the command object#

object ExampleCommand : Command("name",arrayListOf("alias"){    }

2. Simple command#

Player or NSGPlayer

@CommandSubPathfun handle(player : Player){    //your code}

3. Permission command#

@CommandSubPath(permission = "nsg.admin")fun handle(player : Player){    //syour Code}

4. Sub command#

valid types :

@CommandSubPath("<target>")    fun get(player : Player,    @CommandArgument("target") target : NSGPlayer){        //your code    }

Sub command with Tab complete#

provider:

@CommandSubPath("<target>")    fun get(player : Player,    @CommandArgument("target",PlayerCommandSuggationProvider::class) target : NSGPlayer){        //your code    }

Example#

object CoinsCommand : Command("coins"){
    @CommandSubPath    fun handle(player : NSGPlayer){        //your code    }
    @CommandSubPath("<target>", "nsg.staff")    fun get(player : Player,    @CommandArgument("target",PlayerCommandSuggationProvider::class) target : NSGPlayer){        //your code    }}