CustomCommand - v1.0.0
    Preparing search index...

    Class CMD

    custom command creator.

    const command = new CMD()
    .setName("tp")
    .setDescription("tp player to coord")
    .setPermision(CommandPermissionLevel.Any)
    .addPlayerSelector("player", true)
    .addLocation("location", true)
    .setFunction((eventData) => {
    const { source, args } = eventData;

    if (
    !source.sourceEntity ||
    source.sourceEntity?.typeId !== "minecraft:player"
    )
    return ResultStatus.failure();
    if (!Is.Player(args["player"]))
    return ResultStatus.failure("arg player need to be a player entity");
    if (!args["location"]) return ResultStatus.failure("need to be location");

    const target = args["player"];
    target.teleport(args["location"]);

    return ResultStatus.success();
    })
    .register();
    Index

    Constructors

    Methods

    • add argument type block, like when you use /fill or /place.

      Parameters

      • name: string

        the name of this argument.

      • Optionalrequire: boolean = true

        is it required or not, required arguments listed first.

      Returns CMD

      this

      if its a required parameters, but added after optional parameters

    • add argument type boolean, like yes/no true/false.

      Parameters

      • name: string

        the name of this argument.

      • Optionalrequire: boolean = true

        is it required or not, required arguments listed first.

      Returns CMD

      this

      if its a required parameters, but added after optional parameters

    • add argument type entity, like player, zombie ,or other entity.

      Parameters

      • name: string

        the name of this argument.

      • Optionalrequire: boolean = true

        is it required or not, required arguments listed first.

      Returns CMD

      this

      if its a required parameters, but added after optional parameters

    • add argument type enum from RegisterEnum

      Parameters

      • name: string

        the name of this argument.

      • Optionalrequire: boolean = true

        is it required or not, required arguments listed first.

      Returns CMD

      this

      if its a required parameters, but added after optional parameters

    • add argument type float or decimal number, like 1.0, 2.4, 7.2.

      Parameters

      • name: string

        the name of this argument.

      • Optionalrequire: boolean = true

        is it required or not, required arguments listed first.

      Returns CMD

      this

      if its a required parameters, but added after optional parameters

    • add argument type integer or round number, like 1, 2, 3.

      Parameters

      • name: string

        the name of this argument.

      • Optionalrequire: boolean = true

        is it required or not, required arguments listed first.

      Returns CMD

      this

      if its a required parameters, but added after optional parameters

    • add argument type item.

      Parameters

      • name: string

        the name of this argument.

      • Optionalrequire: boolean = true

        is it required or not, required arguments listed first.

      Returns CMD

      this

      if its a required parameters, but added after optional parameters

    • add argument type location or position, usualy xyz coordinate.

      Parameters

      • name: string

        the name of this argument.

      • Optionalrequire: boolean = true

        is it required or not, required arguments listed first.

      Returns CMD

      this

      if its a required parameters, but added after optional parameters

    • add argument type player only, only a player will be check unlike addEntitySelector.

      Parameters

      • name: string

        the name of this argument.

      • Optionalrequire: boolean = true

        is it required or not, required arguments listed first.

      Returns CMD

      this

      if its a required parameters, but added after optional parameters

    • add argument type string or text, just text, a normal text.

      Parameters

      • name: string

        the name of this argument.

      • Optionalrequire: boolean = true

        is it required or not, required arguments listed first.

      Returns CMD

      this

      if its a required parameters, but added after optional parameters

    • get this command description.

      Returns string

      the description of this command.

    • get this command name.

      Returns string

      the name of this command.

    • get this custom command optional arguments

      Returns cmdParam

      array of optional arguments

    • get this custom command's all arguments in order

      Returns cmdParam

      array of required and optional arguments

    • get this command permission level.

      Returns string

      permissionLevel.

    • get this custom command required arguments

      Returns cmdParam

      array of required arguments

    • do this at the end. verify the command and register it.

      Returns void

      if the syntax is wrong

    • is cheat need to be enable to use (default can be change in the config)

      Parameters

      • a: boolean

        required?

      Returns CMD

      this

    • set this command description.

      Parameters

      • a: string

        description.

      Returns CMD

      this.

    • set this command name.

      Parameters

      • a: string

        name.

      Returns CMD

      this.

    • set tab that required when running this command

      Parameters

      • tags: string[]
      • anyOrAll: "all" | "any" = "any"

      Returns CMD

    • create new instance of custom command creator.

      Parameters

      • name: string

        name of the command

      Returns CMD