# 👮‍♂️ Bans

Provides basic punishment features, such as ban, ban ip, mute, warn and kick. As well as punishements list and history GUIs.

## Commands & Permissions

* [Commands](https://nightexpress.gitbook.io/sunlight/general/commands#bans-module) link.
* [Permissions](https://nightexpress.gitbook.io/sunlight/general/permissions#bans-module) link.

## Features

* ✅ **Dedicated Database**. Allows you to synchronize punishment data across all your servers without affecting SunLight's player data.
* ✅ **Punishment GUIs**. Browse all punishments and player's history with customizable GUIs.
* ✅ **Immunies**. List of player names or IP addresses that can not be punished at all.
* ✅ **Predefined Reasons**. Easily specify a punishment reason in commands using a keyword.
* ✅ **Time Aliases**. Create your own time aliases to use in commands, such as 15min, 2hr, etc.
* ✅ **Mute Commands**. Set commands disabled for muted players.
* ✅ **Rank Priority**. Prevent to punish players that have a better rank than punisher player.
* ✅ **Duration Limit**. Define max. possible punishment type for bans, mutes and warns for certain permission groups.
* ✅ **Warn Commands**. Execute custom commands when player gets X active warns.
* ✅ **Alts Checker**. List online & offline players from same IPs.

## Configuration

### Database

First of all, make sure to check out the database settings. By default it uses local SQLite database.

If you're planning to synchronize punishment data across all your servers, make sure to connect the Bans module on all servers to the same MySQL database and enable `Sync_Interval` setting.

### Immunies

It's highly recommended to add all server staff names to the `General` -> `Immunies` setting. This will prevent them from being punished by each other, or the console.

Of course, this is not necessary if you want keep them punishable.

You can add there IP addresses as well, but since the most people have dynamic IP addresses nowadays, it might be a bit useless.

### Reasons

For organizing purposes, all possible punishment reasons should be defined in the `General` -> `Reasons` config section.

Bans module does not support providing custom reason text in punishment commands, you can only select a reason by their config name.

### Time Aliases

All punishment commands requires you to specify a punishment time. It could be seconds, hours, days, or even years.&#x20;

And to make it easier, there is `General` -> `Time_Aliases` setting, where you can set custom aliases for all supported time units.

**Time Units with Default Aliases:**

* Permanent: `permanent`
* Seconds: `sec`, `s`
* Minutes: `min`
* Hours: `hour`, `h`
* Days: `day`, `d`
* Weeks: `week`, `w`
* Months: `mon`
* Years: `year`, `y`

**Some Examples:**

* Permanent ban: `/ban Player permanent`
* 2-Hour ban: `/ban Player 2h`
* 1-Day mute: `/mute Player 1d`

{% hint style="warning" %}
If invalid time unit provided in a punishment command, the `PERMANENT` one will be used.
{% endhint %}

Feel free to change aliases to your native language or whatever you wish.

### Rank Priority

This feature will prevent punishing players that have a better rank than a player who tries to punish them.

This might be useful to prevent moderators from banning admins, helpers from muting moderators, etc.

You can configure it in `Punishments` -> `Rank` -> `Priority` section. It has very detailed comments, so make sure the read them.

### Duration Limit

Another feature that helps you to control your staff with punishment permissions.

Duration limit allows you to setup max. possible **punishment time** for **bans**, **mutes** and **warns** explicitly based on permission groups.

You can configure it in `Punishments` -> `Rank` -> `Duration_Limit` section. It has very detailed comments, so make sure the read them.

**Setup Example:**

```yaml
Duration_Limit:
  helper:
    MUTE:
      Amount: 1
      TimeUnit: DAYS
    BAN:
      Amount: 2
      TimeUnit: WEEKS
    WARN:
      Amount: 3
      TimeUnit: WEEKS
```

In this example all players with `helper` permission group can: **mute** others for **1 day** or less; **ban** others for **2 weeks** or less; **warn** others for **3 weeks** or less;

You can setup it for as many permission groups as you wish.

Additionally, you can enable the `Duration_Limit_to_Unpunish` option to prevent removing punishments with greater duration than unpunisher's duration limit.


---

# 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://nightexpress.gitbook.io/sunlight/modules/bans.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.
