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 :

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:

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