# 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](https://wiki.staffplusplus.org/master/features/warnings/..#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](https://wiki.staffplusplus.org/master/features/warnings/appealing).

Filters can be used to further specify when a command should be run.\
Currently only a [severity ](https://wiki.staffplusplus.org/master/features/warnings/..#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.
