# Warnings

Staff++ created a new way of warning players.

{% hint style="info" %}
To setup the warning configuration checkout the [quick start](https://wiki.staffplusplus.org/features/warnings/quick-start)
{% endhint %}

## Configuration

```yaml
# Requires "permissions.warn" permission.
warnings-module:
  # Whether or not the plugin will use "/warn" features.
  enabled: true

  # The sound that is played to the player when warned.
  # Set to "NONE" to disable.
  sound: ORB_PICKUP


  # Whether or not the player issued the warning will be visible in GUIs.
  show-issuer: true

  # Enables the ability to notify a user when he has warnings
  # User will be notified the moment he comes online.
  user-notifications:
      enabled: false
      # Enable this to show the message every time the user comes online.
      # If Disabled the warnings will be marked as "read" when the player views his warnings 
      # and he will only be notified of new warnings
      always-notify: false
  
  actions: []

  severity-levels:
    - name: MINOR
      score: 1
      # After how much time warnings with this severity should expire.
      # Expired warnings are not counted when doing threshold calculations.
      expiresAfter: 1 WEEK
    - name: MAJOR
      score: 3
      expiresAfter: 1 MONTH
    - name: CRITICAL
      score: 5
  # Define thresholds for the warning system. Whenever the player reaches a threshold the actions are triggered
  thresholds:
    - score: 6
      actions:
        - command: "ban %target% &4Met three warnings. Appeal @ &7www.shithcf.net&4."
          target: target
          target-run-strategy: DELAY
```

### Permissions

View [permissions](https://wiki.staffplusplus.org/permissions-and-commands/permissions) page

### Commands

| Command                              | Description                                                                                                                                                                                                            | Example                               |
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| `/warn [severity] [player] [reason]` | Command to give a player a warning. [Severity ](https://wiki.staffplusplus.org/features/warnings/severity-levels)should be configured inside the configuration file and provided as first argument to the warn command | `/warn MAJOR player1 For some reason` |
| `/warns [get] [player]`              | Command to manage warnings. You can list current warnings                                                                                                                                                              | `/warns get player1`                  |
| `/my-warnings`                       | The command for opening the my warnings GUI                                                                                                                                                                            | `/my-warnings`                        |
| `/manage-warnings [player]`          | Command for opening a GUI showing all the warnings of the give player                                                                                                                                                  | `/manage-warnings player1`            |

## Enable user notifications

You can enable user notifications. This will notify the player that he has warnings. To do so change this part of the warnings-module inside the config file:

```yaml
  # Enables the ability to notify a user when he has warnings
  # User will be notified the moment he comes online.
  user-notifications:
      enabled: true
      # Enable this to show the message every time the user comes online.
      # If Disabled the warnings will be marked as "read" and he will only be notified of new warnings
      always-notify: false
```

Whenever a user opens his warning GUI all his warnings are marked as 'read'. If `always-notify` is disabled, a user will only be notified if he has unread warnings. Keep in mind that to open the warnings GUI the player has to have the following permission: `staff.warn.view-my-warnings`
