CommandAPI 9.6.0
An API for the command UI introduced in Minecraft 1.13
com.mojang.brigadier.Command< S > Interface Template Reference

The functional interface actually representing a command to execute. More...

Public Member Functions

int run (CommandContext< S > context) throws CommandSyntaxException
 Executes the command using the given CommandContext to supply information to the command. More...
 

Public Attributes

int SINGLE_SUCCESS = 1
 A static constant you can use when the command completed successfully. More...
 

Detailed Description

The functional interface actually representing a command to execute.

This interface represents the code that will be run, when the command is executed.

Parameters
<S>the type of the command source this command will be called with

Member Function Documentation

◆ run()

Executes the command using the given CommandContext to supply information to the command.

Parameters
contextthe command context to use for supplying all information the command will need
Returns
the result of executing the command. The value is arbitrary, though SINGLE_SUCCESS is a suggestion
Exceptions
CommandSyntaxExceptionTODO: Why does it throw a Syntax exception here?

Member Data Documentation

◆ SINGLE_SUCCESS

int com.mojang.brigadier.Command< S >.SINGLE_SUCCESS = 1

A static constant you can use when the command completed successfully.

As the return value means what you want it to mean, this is merely a suggestion to make the code a bit more expressive, if you follow it.