Options
All
  • Public
  • Public/Protected
  • All
Menu

Module to register custom chat commands.

since

3.0

Index

Functions

  • 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).

    since

    3.0

    Parameters

    Returns void

  • 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).

    since

    3.0

    Parameters

    • name: any_string

      enum's name that has to be used in CommandsModule.enumArg as the enumName parameter

    • values: {}

      enum's data set represented as a JS object with string keys and integer values. Different keys can have same values.

      • [key: string]: number

    Returns void

  • since

    3.0

    Parameters

    Returns CommandArgument

    object to describe new boolean argument for the custom command; if defaultValue is not specified, it defaults to true

  • since

    3.0

    Parameters

    Returns CommandArgument

    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.

  • since

    3.0

    Parameters

    Returns CommandArgument

    object to describe new floating point argument for the custom command; if defaultValue is not specified, it defaults to 0.0

  • since

    3.0

    Parameters

    Returns CommandArgument

    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}

  • since

    3.0

    Parameters

    • name: any_string
    • defaultX: number
    • defaultY: number
    • defaultZ: number

    Returns CommandArgument

    object to describe new position argument with floating point coordinates for the custom command

  • since

    3.0

    Parameters

    Returns CommandArgument

    object to describe new integer argument for the custom command; if defaultValue is not specified, it defaults to 0

  • since

    3.0

    Parameters

    Returns CommandArgument

    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

  • since

    3.0

    Parameters

    Returns CommandArgument

    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.

    since

    3.0

    Parameters

    • name: any_string

      command's name that will have to be put after a slash

    • Optional permissionLevel: number

      command's permission level, defaults to 0 (all players can use this command)

    Returns CommandOverloadBase

    the object to describe a new custom chat command

  • since

    3.0

    Parameters

    Returns CommandArgument

    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}

  • since

    3.0

    Parameters

    • name: any_string
    • defaultX: number
    • defaultY: number
    • defaultZ: number

    Returns CommandArgument

    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.

    since

    3.0

    Parameters

    • name: any_string

      command's original name

    • alias: any_string

      alternative name to assign to the command's name

    Returns void

  • 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);
    }
    since

    3.0

    Parameters

    Returns void

  • 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);
    }
    })
    )
    );
    since

    3.0

    Parameters

    • name: any_string

      command's name that will have to be put after a slash

    • callback: CustomParserCommandExecuteCallback

      function defining command's behavior depending on the command message and CommandContext

    • Optional permissionLevel: number

      command's permission level, defaults to 0 (all players can use this command)

    Returns void

  • since

    3.0

    Parameters

    Returns CommandArgument

    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

  • since

    3.0

    Parameters

    Returns CommandArgument

    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