# Actions (punishments)

We can define actions inside the warnings-module. Actions will be executed whenever a warning is issued. Every action must at least consist of a command and [run-strategy](/master/features/warnings.md#run-strategy). The command will get executed when the warning is issued.

Besides the general command, a **rollback-command** can be specified. The rollback command gets executed whenever a warning is deleted or has been successfully [appealed](/master/features/warnings/appealing.md).

Filters can be used to further specify when a command should be run.\
Currently only a [severity ](/master/features/warnings.md#severity-levels-and-thresholds)filter is available. If no filters are applied the command will get executed with every warning issued.\
\
**Example configuration:**

```yaml
warnings-module:
  actions:
    - command: 'eco take %player% 2000'
      rollback-command: 'eco give %player% 2000'
      run-strategy: ALWAYS
      filters: 'severity=MINOR,MAJOR'
    - command: 'eco take %player% 5000'
      rollback-command: 'eco give %player% 5000'
      run-strategy: ALWAYS
      filters: 'severity=CRITICAL'
    - command: 'freeze enabled %player%'
      rollback-command: 'freeze disabled %player%'
      run-strategy: DELAY
      filters: 'severity=CRITICAL'
```

In the above example configuration the following will happen:

If a MINOR or MAJOR warning is issued. \
&#x20;        \- The player will be deducted $2000 from his balance.\
If a CRITICAL warning is issued. \
&#x20;        \- The player will be deducted $5000 from his balance.\
&#x20;        \- The player will get frozen if he is online, or the next time he comes online.\
\
If the warning gets rollbacked the player will get automatically reimbursed.&#x20;

{% hint style="warning" %}
It's important to not that actions get linked to the warning the moment the warning is created.\
Changing the action configuration will not impact existing warnings.
{% endhint %}

## Run strategy

As you can see in the above configuration, we can define a run strategy for each command. This is useful when we want to only execute the command in a certain situation.

Possible strategies:

* `ALWAYS` Run the command regardless if the player is on- or offline. This will always try to run the command immediately
* `ONLINE` Run the command only if the player is online. Should the player be offline when the threshold is reached the configured command wont be executed.
* `DELAY` If the player is online, run the command immediately. If the player is offline, delay the command until his next login.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.staffplusplus.org/master/features/warnings/actions-punishments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
