Options
All
  • Public
  • Public/Protected
  • All
Menu

Wrapper for Command, CommandOrigin and CommandOutput native classes at the same time used in custom chat command execute callbacks allowing you to access the values of the specified arguments and the entity or another source that called the command, and also to print command's successfull or failed result.

since

3.0

Hierarchy

  • CommandContext

Index

Methods

  • Prints the error (red color) message and marks that the command call has failed.

    since

    3.0

    Parameters

    Returns void

  • throws

    java.lang.IllegalArgumentException if the argument by given name doesn't exist in the current command overload, or it's not of player selector type

    since

    3.0

    Parameters

    Returns Player

    a single player chosen using player selector argument by given name, or null if there was more than one or no player chosen

  • getRelativeFloat(name: any_string, center: number): number
  • throws

    java.lang.IllegalArgumentException if the argument by given name doesn't exist in the current command overload, or it's not of relative float type

    since

    3.0

    Parameters

    • name: any_string
    • center: number

      the value to add to the specified floating point value, if the caller used ~ token before it

    Returns number

    value of relative float argument by given name

  • getSourceBlockPosition(): Vector
  • since

    3.0

    Returns Actor

    command caller's entity object, or null if the caller is not an entity (for example, command block)

  • since

    3.0

    Returns Level

    command caller's Level, or null if it doesn't have it for some reason

  • since

    3.0

    Returns Player

    command caller's player object, or null if the caller is not a player

  • getSourceWorldPosition(): Vector
  • since

    3.0

    Returns Vector

    exact floating point position of the command caller

  • Prints the message of successful command call to the chat. You can omit msg param if you just want to mark that the command call went without errors. However, calling this method is optional.

    since

    3.0

    Parameters

    Returns void

Generated using TypeDoc