CustomCommand - v1.0.1
    Preparing search index...

    Class CMD<P, A>

    custom command creator.

    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();

    Type Parameters

    • P extends Phase = "required"
    • A extends object = {}
    Index

    Constructors

    • create new instance of custom command creator.

      Type Parameters

      • P extends Phase = "required"
      • A extends object = {}

      Parameters

      • Optionalinit: CustomCommand = ...

        custom command that already listed/registered.

      Returns CMD<P, A>

    Methods

    • add this command a name alias

      Parameters

      • a: string

        name

      Returns CMD<P, A>

      this

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

      Type Parameters

      • N extends string
      • R extends boolean

      Parameters

      • this: P extends "required" ? CMD<P<P>, A> : R extends false ? CMD<P, A> : never
      • name: N

        the name of this argument.

      • Optionalrequire: R = ...

        is it required or not, required arguments listed first.

      Returns CMD<
          R extends true ? "required" : "optional",
          A & (
              R extends true ? { [P in string]: string } : { [P in string]?: string }
          ),
      >

      this

      if its a required parameters, but added after optional parameters

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

      Type Parameters

      • N extends string
      • R extends boolean

      Parameters

      • this: P extends "required" ? CMD<P<P>, A> : R extends false ? CMD<P, A> : never
      • name: N

        the name of this argument.

      • Optionalrequire: R = ...

        is it required or not, required arguments listed first.

      Returns CMD<
          R extends true ? "required" : "optional",
          A & (
              R extends true
                  ? { [P in string]: boolean }
                  : { [P in string]?: boolean }
          ),
      >

      this

      if its a required parameters, but added after optional parameters

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

      Type Parameters

      • N extends string
      • R extends boolean

      Parameters

      • this: P extends "required" ? CMD<P<P>, A> : R extends false ? CMD<P, A> : never
      • name: N

        the name of this argument.

      • Optionalrequire: R = ...

        is it required or not, required arguments listed first.

      Returns CMD<
          R extends true ? "required" : "optional",
          A & (
              R extends true ? { [P in string]: Entity } : { [P in string]?: Entity }
          ),
      >

      this

      if its a required parameters, but added after optional parameters

    • add argument type enum from RegisterEnum

      Type Parameters

      • N extends string
      • R extends boolean

      Parameters

      • this: P extends "required" ? CMD<P<P>, A> : R extends false ? CMD<P, A> : never
      • name: N

        the name of this argument.

      • Optionalrequire: R = ...

        is it required or not, required arguments listed first

      • Optionalvalue: string[] = []

        the value of enum to add if enum is not registered.

      Returns CMD<
          R extends true ? "required" : "optional",
          A & (
              R extends true ? { [P in string]: string } : { [P in string]?: string }
          ),
      >

      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.

      Type Parameters

      • N extends string
      • R extends boolean

      Parameters

      • this: P extends "required" ? CMD<P<P>, A> : R extends false ? CMD<P, A> : never
      • name: N

        the name of this argument.

      • Optionalrequire: R = ...

        is it required or not, required arguments listed first.

      Returns CMD<
          R extends true ? "required" : "optional",
          A & (
              R extends true ? { [P in string]: number } : { [P in string]?: number }
          ),
      >

      this

      if its a required parameters, but added after optional parameters

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

      Type Parameters

      • N extends string
      • R extends boolean

      Parameters

      • this: P extends "required" ? CMD<P<P>, A> : R extends false ? CMD<P, A> : never
      • name: N

        the name of this argument.

      • Optionalrequire: R = ...

        is it required or not, required arguments listed first.

      Returns CMD<
          R extends true ? "required" : "optional",
          A & (
              R extends true ? { [P in string]: number } : { [P in string]?: number }
          ),
      >

      this

      if its a required parameters, but added after optional parameters

    • add argument type item.

      Type Parameters

      • N extends string
      • R extends boolean

      Parameters

      • this: P extends "required" ? CMD<P<P>, A> : R extends false ? CMD<P, A> : never
      • name: N

        the name of this argument.

      • Optionalrequire: R = ...

        is it required or not, required arguments listed first.

      Returns CMD<
          R extends true ? "required" : "optional",
          A & (
              R extends true ? { [P in string]: string } : { [P in string]?: string }
          ),
      >

      this

      if its a required parameters, but added after optional parameters

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

      Type Parameters

      • N extends string
      • R extends boolean

      Parameters

      • this: P extends "required" ? CMD<P<P>, A> : R extends false ? CMD<P, A> : never
      • name: N

        the name of this argument.

      • Optionalrequire: R = ...

        is it required or not, required arguments listed first.

      Returns CMD<
          R extends true ? "required" : "optional",
          A & (
              R extends true
                  ? { [P in string]: Vector3 }
                  : { [P in string]?: Vector3 }
          ),
      >

      this

      if its a required parameters, but added after optional parameters

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

      Type Parameters

      • N extends string
      • R extends boolean

      Parameters

      • this: P extends "required" ? CMD<P<P>, A> : R extends false ? CMD<P, A> : never
      • name: N

        the name of this argument.

      • Optionalrequire: R = ...

        is it required or not, required arguments listed first.

      Returns CMD<
          R extends true ? "required" : "optional",
          A & (
              R extends true ? { [P in string]: Player } : { [P in string]?: Player }
          ),
      >

      this

      if its a required parameters, but added after optional parameters

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

      Type Parameters

      • N extends string
      • R extends boolean

      Parameters

      • this: P extends "required" ? CMD<P<P>, A> : R extends false ? CMD<P, A> : never
      • name: N

        the name of this argument.

      • Optionalrequire: R = ...

        is it required or not, required arguments listed first.

      Returns CMD<
          R extends true ? "required" : "optional",
          A & (
              R extends true ? { [P in string]: string } : { [P in string]?: string }
          ),
      >

      this

      if its a required parameters, but added after optional parameters

    • get this command name alias.

      Returns string[]

      the name of this command.

    • get this command description.

      Returns string

      the description of this command.

    • get this command name.

      Returns string

      the name of this command.

    • get this command permission level.

      Returns string

      permissionLevel.

    • 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<P, A>

      this

    • set this command name alias.

      Parameters

      • a: string[]

        name array.

      Returns CMD<P, A>

      this.

    • set this command description.

      Parameters

      • a: string

        description.

      Returns CMD<P, A>

      this.

    • set this command name.

      Parameters

      • a: string

        name.

      Returns CMD<P, A>

      this.

    • set tab that required when running this command

      Parameters

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

      Returns CMD<P, A>

    • create new instance of custom command creator.

      Parameters

      • name: string

        name of the command

      Returns CMD