Ban
endstone.ban
¶
Classes relevant to bans.
Classes:
| Name | Description |
|---|---|
BanEntry |
A single entry from a ban list. |
IpBanEntry |
Represents an entry for a banned IP address. |
IpBanList |
Represents a ban list, containing banned IP addresses. |
PlayerBanEntry |
Represents an entry for a banned player. |
PlayerBanList |
Represents a ban list, containing banned players. |
BanEntry
¶
A single entry from a ban list.
Attributes:
| Name | Type | Description |
|---|---|---|
created |
datetime
|
The date this ban entry was created. |
expiration |
datetime | None
|
The date this ban expires on, or |
reason |
str
|
The reason for this ban. |
source |
str
|
The source of this ban. |
IpBanList
¶
Represents a ban list, containing banned IP addresses.
Methods:
| Name | Description |
|---|---|
add_ban |
Adds a ban to this list. If a previous ban exists, this will update the previous entry. |
get_ban_entry |
Gets a |
is_banned |
Checks if a |
remove_ban |
Removes the specified IP address from this list, therefore indicating a "not banned" status. |
Attributes:
| Name | Type | Description |
|---|---|---|
entries |
list[IpBanEntry]
|
A vector containing pointers to every entry tracked by this list. |
entries
property
¶
entries: list[IpBanEntry]
A vector containing pointers to every entry tracked by this list.
add_ban
¶
add_ban(
address: str,
reason: str | None = None,
expires: datetime | None = None,
source: str | None = None,
) -> IpBanEntry
Adds a ban to this list. If a previous ban exists, this will update the previous entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address
|
str
|
The IP address of the target. |
required |
reason
|
str | None
|
The reason for the ban, |
None
|
expires
|
datetime | None
|
The date for the ban's expiration (unban), or |
None
|
source
|
str | None
|
The source of the ban, |
None
|
Returns:
| Type | Description |
|---|---|
IpBanEntry
|
The entry for the newly created ban, or the entry for the (updated) previous ban. |
get_ban_entry
¶
get_ban_entry(address: str) -> IpBanEntry | None
Gets a BanEntry by IP address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address
|
str
|
The IP address to search for. |
required |
Returns:
| Type | Description |
|---|---|
IpBanEntry | None
|
The corresponding entry, or |
is_banned
¶
PlayerBanEntry
¶
PlayerBanList
¶
Represents a ban list, containing banned players.
Methods:
| Name | Description |
|---|---|
add_ban |
Adds a ban to this list. If a previous ban exists, this will update the previous entry. |
get_ban_entry |
Gets a |
is_banned |
Checks if a |
remove_ban |
Removes the specified player from this list, therefore indicating a "not banned" status. |
Attributes:
| Name | Type | Description |
|---|---|---|
entries |
list[PlayerBanEntry]
|
A vector containing pointers to every entry tracked by this list. |
entries
property
¶
entries: list[PlayerBanEntry]
A vector containing pointers to every entry tracked by this list.
add_ban
¶
add_ban(
name: str,
uuid: UUID | None = None,
xuid: str | None = None,
reason: str | None = None,
expires: datetime | None = None,
source: str | None = None,
) -> PlayerBanEntry
Adds a ban to this list. If a previous ban exists, this will update the previous entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the target. |
required |
uuid
|
UUID | None
|
The UUID of the target, |
None
|
xuid
|
str | None
|
The XUID of the target, |
None
|
reason
|
str | None
|
The reason for the ban, |
None
|
expires
|
datetime | None
|
The date for the ban's expiration (unban), or |
None
|
source
|
str | None
|
The source of the ban, |
None
|
Returns:
| Type | Description |
|---|---|
PlayerBanEntry
|
The entry for the newly created ban, or the entry for the (updated) previous ban. |
get_ban_entry
¶
get_ban_entry(
name: str,
uuid: UUID | None = None,
xuid: str | None = None,
) -> PlayerBanEntry | None
Gets a BanEntry by player name, UUID, or XUID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The player name to search for. |
required |
uuid
|
UUID | None
|
The UUID of the player to search for, |
None
|
xuid
|
str | None
|
The XUID of the player to search for, |
None
|
Returns:
| Type | Description |
|---|---|
PlayerBanEntry | None
|
The corresponding entry, or |
is_banned
¶
Checks if a BanEntry exists for the target, indicating an active ban status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The player name to find. |
required |
uuid
|
UUID | None
|
The UUID of the target, |
None
|
xuid
|
str | None
|
The XUID of the target, |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
|
remove_ban
¶
Removes the specified player from this list, therefore indicating a "not banned" status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The player name to remove from this list. |
required |
uuid
|
UUID | None
|
The unique id of the player, |
None
|
xuid
|
str | None
|
The xbox user id (xuid) of the player, |
None
|