Commands

Custom commands

modules/custom-commands.yml is where /discord, /rules and the rest of your server's own commands go.

enabled: true

custom:

  discord:
    description: Shows the Discord invite.
    permission: ''
    aliases: [ dc ]
    cooldown-seconds: 0
    messages:
      - '%prefix%<gray>Come talk to us:'
      - '<dark_gray><aqua><underlined>discord.gg/yourserver'
    run-as-player: [ ]
    run-as-console: [ ]
    sound:
      key: ui.button.click
      volume: 0.5
      pitch: 1.4
Key What it does
description Shown in /help.
permission Who may use it. Empty means everyone.
aliases Extra names for it. These live here, not in aliases.yml.
cooldown-seconds How long before the same player may repeat it. chorus.bypass.cooldown ignores it.
messages Lines sent to whoever ran it, in MiniMessage. %prefix% and %player% both work.
run-as-player Commands run as the player, with their permissions.
run-as-console Commands run as the console, with full permissions.
sound Played to the player who ran it.

A command with no messages and nothing to run is skipped with a warning, since it would do nothing at all.

run-as-console#

This is the useful one, and the one to be careful with. It lets a player trigger something they have no permission to do themselves.

  daily:
    description: The daily reward.
    permission: ''
    cooldown-seconds: 86400
    messages:
      - '%prefix%<gray>Here you go.'
    run-as-console:
      - 'give %player% diamond 3'

Treat it as you would treat op. A cooldown on a command that runs as console is the only thing between it and being run a thousand times.

%player% is the name of whoever ran the command.

Adding one needs a restart#

Adding, renaming or removing a custom command needs a server restart, because the command has to be registered with Bukkit before anything can call it.

Changing what an existing one says or does is picked up by /chorus reload.

Examples#

A plain information command:

  website:
    description: Shows the website.
    permission: ''
    aliases: [ web ]
    cooldown-seconds: 5
    messages:
      - '%prefix%<gray>Find us at <aqua><underlined>example.com'
    run-as-player: [ ]
    run-as-console: [ ]
    sound:
      key: ui.button.click
      volume: 0.5
      pitch: 1.2

A staff-only shortcut that chains real commands:

  cleanup:
    description: Clears the ground and reports.
    permission: chorus.admin
    cooldown-seconds: 30
    messages:
      - '%prefix%<gray>Sweeping.'
    run-as-player:
      - 'sweep drops'
      - 'tps'
    run-as-console: [ ]

A rank shop button, for a plugin that has no command of its own:

  claimvip:
    description: Claims VIP after buying it.
    permission: server.boughtvip
    cooldown-seconds: 0
    messages:
      - '%prefix%<gold>Welcome to VIP.'
    run-as-console:
      - 'lp user %player% parent add vip'

What it is not#

There is no condition, no requirement and no menu here. A command that needs any of those is a kit — see Kits, which has requirements, claim actions and fail actions, all of which take console commands too.