Registers a new command enum (set of keys each of which can be used as a command argument and corresponds to a specific integer value, which then can be got using CommandContext.getInt).
enum's name that has to be used in CommandsModule.enumArg as the enumName
parameter
enum's data set represented as a java.util.Map with string keys and integer values. Different keys can have same values.
Registers a new command enum (set of keys each of which can be used as a command argument and corresponds to a specific integer value, which then can be got using CommandContext.getInt).
enum's name that has to be used in CommandsModule.enumArg as the enumName
parameter
enum's data set represented as a JS object with string keys and integer values. Different keys can have same values.
Registers a new string command enum (set of strings each of which can be used as a command argument, which then can be got using CommandContext.getString).
enum's name that has to be used in CommandsModule.stringEnumArg as the enumName
parameter
enum values represented as a java.util.Set of unique strings
Registers a new string command enum (set of strings each of which can be used as a command argument, which then can be got using CommandContext.getString).
enum's name that has to be used in CommandsModule.stringEnumArg as the enumName
parameter
enum values represented as an array of unique strings
object to describe new boolean argument for the custom command;
if defaultValue
is not specified, it defaults to true
object to describe new entity selector argument for the custom command
object to describe new enum argument for the custom command.
The user will have to input a string enum key, which they'll be able to choose from
the list of suggestions above the input box, and then internally this key will be converted
to the corresponding integer value (you'll be able to get it using CommandContext.getInt).
If defaultValue
is not specified, it defaults to 0.
object to describe new floating point argument for the custom command;
if defaultValue
is not specified, it defaults to 0.0
object to describe new position argument with floating point coordinates for the custom command; In this overload, the default value for the position is {0.0, 0.0, 0.0}
object to describe new position argument with floating point coordinates for the custom command
object to describe new integer argument for the custom command;
if defaultValue
is not specified, it defaults to 0
object to describe new JSON object argument for the custom command
object to describe new literal argument for the custom command.
A literal is one specific word that must be written into the chat command line,
like list
in /tickingarea list
or clear
in /effect visualstudiodan clear
object to describe new message argument for the custom command. This argument type is used to be put as a last argument of the command, so it'll grab all the rest of the command text to its string
Creates an object to describe a new custom chat command. The result must be put in CommandsModule.registerCommand after specifying everything you need.
command's name that will have to be put after a slash
command's permission level, defaults to 0 (all players can use this command)
the object to describe a new custom chat command
Sequential-call-based alternative of CommandsModule.addEnum.
enum's name that has to be used in CommandsModule.enumArg as the enumName
parameter
object to add enum's key-value pairs one by one and then call its register
method to register the enum itself
Sequential-call-based alternative of CommandsModule.addStringEnum.
enum's name that has to be used in CommandsModule.stringEnumArg as the enumName
parameter
object to add enum values one by one and then call its register
method to register the enum itself
object to describe new player selector argument for the custom command
object to describe new position argument with integer coordinates for the custom command; In this overload, the default value for the position is {0, 0, 0}
object to describe new position argument with integer coordinates for the custom command
Registers an alias (alternative name) for the command with given name,
like tp
for teleport
and ?
for help
in vanilla.
command's original name
alternative name to assign to the command's name
Registers new custom chat command from given data object returned by CommandsModule.newCommand. You have to call this method with your CommandOverloadBase only after specifying everything you need for this command.
However, this can be done in a single sequential call, for example:
KEX.CommandsModule.registerCommand(KEX.CommandsModule.newCommand("heal", 1)
.then(KEX.CommandsModule.entityArg("target")
.executes(function(ctx) {
heal(ctx.getEntities("target"), 20);
})
.then(KEX.CommandsModule.intArg("amount")
.executes(function(ctx) {
heal(ctx.getEntities("target"), ctx.getInt("amount"))
})
)
)
);
function heal(entities, amount) {
let iter = entities.iterator();
while(iter.hasNext()) iter.next().heal(amount);
}
Registers new custom chat command with fully custom parser defined by yourself.
Actually it's just a shortcut that looks like this:
registerCommand(newCommand(name, permissionLevel)
.then(messageArg("{...}")
.executes(new CommandExecuteCallback() {
public void execute(CommandContext ctx)
{
callback.execute(ctx.getMessage("{...}"), ctx);
}
})
)
);
command's name that will have to be put after a slash
function defining command's behavior depending on the command message and CommandContext
command's permission level, defaults to 0 (all players can use this command)
object to describe new relative float
(~VALUE
, where ~
is the center value you choose in your code)
argument for the custom command;
if defaultValue
is not specified, it defaults to 0.0
object to describe new string argument for the custom command;
if defaultValue
is not specified, it defaults to null.
object to describe new string enum argument for the custom command.
The user will have to input a string enum value, which they'll be able to choose from
the list of suggestions above the input box, and then you'll be able to get it using CommandContext.getString.
Note that defaultValue
is required here.
Generated using TypeDoc
Module to register custom chat commands.
3.0