bans.list
Returns the server’s address bans that have not expired.
Signature
Section titled “Signature”bans.list(): readonly BanRecord[]Parameters
Section titled “Parameters”None.
Returns
Section titled “Returns”An array of ban records, as below. It is a copy: it does not change as bans come and go.
Example
Section titled “Example”A /bans command.
import { bans, chat, commands } from "nativemp";
commands.register("bans", (player) => { for (const ban of bans.list()) chat.sendServerMessage(`${ban.id}: ${ban.reason}`, player);});BanRecord
Section titled “BanRecord”| Field | Type | Description |
|---|---|---|
id |
string |
The ban’s ID, for bans.remove. |
address |
string |
The banned network address. |
reason |
string |
What the player was told. |
createdAtUnixSeconds |
number |
When it was made, in Unix seconds. |
expiresAtUnixSeconds |
number | null |
When it ends, in Unix seconds; null for good. |
Related
Section titled “Related”bans.remove: lift a banplayers.banAddress: make one