Configuring command hooks

You can configure commands to execute for different parts of the staff++ configuration. For example when entering/exiting staff mode or on report lifecycle change

This part of the documentation explains how to configure commands.

An example of the report commands configuration.

accept-commands:
    - command: "tell %culprit% You have been reported. %assigned% will handle the case."
      target: "culprit"
      target-run-strategy: ONLINE
      filters: "hasculprit=true"

A command consists of :

property

description

required

default value

command

The command to be executed

true

executor

Determines by who the command will be executed. If not filled in this will default to "console". Which values you can use for executor is determined by the context in which the command is used.

false

console

executor-run-strategy

If the executor is not online when the command should be invoked, you can delay the execution by specifying DELAY as run strategy

false

ONLINE

target

If this command is targeting a specific player you can define the player to be targeted here. If not filled on no target is defined. This should only be used in combination with the target-run-strategy.

false

target-run-strategy

If target is filled in you also need to provide a run strategy

Required if target is provided

filters

Depending on the context in which the command is executed one or more filters may be configured. If all filters are valid the command will be executed.

false

empty

Basics

The most basic command configuration is as such:

- command: "mycommand here"

The command will be executed by console.

Custom executor

If you want the command to be executed by someone else other than the console you can specify the executor here. Valid values depend on the context of the command. For example for report commands you can use the "reporter" as executor. To know which executor can be used in which context check the documentation page of the corresponding functionality

- command: "mycommand here"
  executor: reporter

executor-run-strategy

This property defaults to ONLINE, which means the executor must be online for the command to be run. If he is not online the command will be skipped. If you would like to wait for the executor to come online, it's possible to define DELAY as run strategy. If the executor is offline, the command will run the next time the executor comes online. If the executor is online the command will run immediately.

- command: "mycommand here"
  executor: reporter
  executor-run-strategy: DELAY

Target

It's possible to define a target and target-run-strategy. These 2 properties must always be used together.

Using these properties we can choose the either not run a command if the target player is offline or to delay the command until the target comes online. Valid values depend on the context of the command. For example for report commands you can use the "culprit" as target. To know which targets can be used in which context check the documentation page of the corresponding functionality

If you would like to wait for the target to come online, it's possible to define DELAY as run strategy. If the target is offline, the command will run the next time the target comes online. If the target is online the command will run immediately.

- command: "freeze %culprit%"
  target: culprit
  target-run-strategy: DELAY

Filters

You can specify filters to determine if a command must be executed. Valid filters depend on the context of the command. To know which filters can be used in which context check the documentation page of the corresponding functionality

For example for commands executed by warnings you can use the severity filter.

- command: "freeze %culprit%"
  filters: 'severity=CRITICAL'

Permission filter

However one filter is always available:

filter

possible values

Description

permission

Any permission

Only run the command if the executor has the given permission

placeholders

Different placeholders can be used inside the commands. The placeholders that you can use is depended in the context of the command. To know which placeholders can be used in which context check the documentation page of the corresponding functionality

Last updated