Skip to content

IBanList

Namespace Mc.Scripting.Services · Kind interface

public interface IBanList

The server’s ban lists: the vanilla files banned-players.json and banned-ips.json. The engine’s login check reads the same files, so a ban written here, by /ban or by another plugin is enforced the same way; a plugin that replaces this service (a moderation plugin) must write the same files or keep them as its only store. A write does not kick an online player: the caller does that (Player.Kick). Thread: tick thread.

Member Description
bool AddAddress(string address, string? reason, DateTimeOffset? expires, string source) Bans an address (the bare IP; a port is dropped).
AddPlayer Bans a player.
IReadOnlyList<BanEntry> Addresses() The address bans that are still in force.
BanEntry? Check(Uuid player, string? address) The ban that refuses a login of this player or address (the player ban first), null when none.
IReadOnlyList<BanEntry> Players() The player bans that are still in force.
bool RemoveAddress(string address) Removes an address ban.
bool RemovePlayer(Uuid player) Removes a player’s ban.
bool AddAddress(string address, string? reason, DateTimeOffset? expires, string source)

Bans an address (the bare IP; a port is dropped).

Parameters

Name Type Description
address string The address.
reason string? The reason, or null for the default text.
expires DateTimeOffset? When the ban ends; null = forever.
source string Who bans, for the list.

Returns bool: True when a ban was written.

bool AddPlayer(Uuid player, string name, string? reason, DateTimeOffset? expires, string source)

Bans a player. An identical ban that is still in force is kept as it is.

Parameters

Name Type Description
player Uuid The player’s uuid.
name string The player’s name (shown in the list).
reason string? The reason, or null for the default text.
expires DateTimeOffset? When the ban ends; null = forever.
source string Who bans, for the list.

Returns bool: True when a ban was written.

IReadOnlyList<BanEntry> Addresses()

The address bans that are still in force.

Returns IReadOnlyList<BanEntry>: The bans.

BanEntry? Check(Uuid player, string? address)

The ban that refuses a login of this player or address (the player ban first), null when none.

Parameters

Name Type Description
player Uuid The player’s uuid.
address string? The address the login comes from, or null to check the player only.

Returns BanEntry?: The ban, or null.

IReadOnlyList<BanEntry> Players()

The player bans that are still in force.

Returns IReadOnlyList<BanEntry>: The bans.

bool RemoveAddress(string address)

Removes an address ban.

Parameters

Name Type Description
address string The address.

Returns bool: True when there was one.

bool RemovePlayer(Uuid player)

Removes a player’s ban.

Parameters

Name Type Description
player Uuid The player’s uuid.

Returns bool: True when there was one.

BanEntry · Uuid