endstone/ban
Classes
| Name | Description |
|---|---|
BanEntry | A single entry from a ban list. |
BanList | Represents a ban list, containing bans. |
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. |
classBanEntry
Defined in <endstone/ban/ban_entry.h>
A single entry from a ban list.
Type Aliases
| Name | Description |
|---|---|
Date |
Variables
| Name | Description |
|---|---|
DateFormat |
Methods
| Name | Description |
|---|---|
getCreated | Gets the date this ban entry was created. |
setCreated | Sets the date this ban entry was created. |
getSource | Gets the source of this ban. |
setSource | Sets the source of this ban. |
getExpiration | Gets the date this ban expires on, or std::nullopt for no defined end date. |
setExpiration | Sets the date this ban expires on. std::nullopt values are considered "infinite" bans. |
getReason | Gets the reason for this ban. |
setReason | Sets the reason for this ban. |
typeDate
varDateFormatstatic
const std::string DateFormatmethgetCreatedconst
Date getCreated() constGets the date this ban entry was created.
Returns
| Type | Description |
|---|---|
Date | the creation date |
methsetCreated
void setCreated(Date created)Sets the date this ban entry was created.
See also
save() saving changes
Parameters
| Name | Type | Description |
|---|---|---|
created | Date | the new created date |
methgetSourceconst
std::string getSource() constGets the source of this ban.
Returns
| Type | Description |
|---|---|
std::string | the source of the ban |
methsetSource
void setSource(std::string source)Sets the source of this ban.
See also
save() saving changes
Parameters
| Name | Type | Description |
|---|---|---|
source | std::string | the new source |
methgetExpirationconst
std::optional<Date> getExpiration() constGets the date this ban expires on, or std::nullopt for no defined end date.
Returns
| Type | Description |
|---|---|
std::optional<Date> | the expiration date |
methsetExpiration
void setExpiration(std::optional<Date> expiration)Sets the date this ban expires on. std::nullopt values are considered "infinite" bans.
Parameters
| Name | Type | Description |
|---|---|---|
expiration | std::optional<Date> | the new expiration date, or std::nullopt to indicate an infinite ban |
methgetReasonconst
std::string getReason() constGets the reason for this ban.
Returns
| Type | Description |
|---|---|
std::string | the ban reason |
methsetReason
void setReason(std::string reason)Sets the reason for this ban.
See also
save() saving changes
Parameters
| Name | Type | Description |
|---|---|---|
reason | std::string | the new reason, empty values assume the implementation default |
classBanList
Defined in <endstone/ban/ban_list.h>
Represents a ban list, containing bans.
Type Aliases
| Name | Description |
|---|---|
EntryType |
Methods
| Name | Description |
|---|---|
~BanList | |
getBanEntry | Gets a BanEntry by target. |
addBan | Adds a ban to this list. If a previous ban exists, this will update the previous entry. |
addBan | Adds a ban to this list. If a previous ban exists, this will update the previous entry. |
getEntries | Gets a vector containing pointers to every BanEntry in this list. |
isBanned | Checks if a BanEntry exists for the target, indicating an active ban status. |
removeBan | Removes the specified target from this list, therefore indicating a "not banned" status. |
typeEntryType
T EntryTypemeth~BanListvirtual
~BanList() =defaultmethgetBanEntryabstractconst
Nullable<T> getBanEntry(std::string target) const =0Gets a BanEntry by target.
Parameters
| Name | Type | Description |
|---|---|---|
target | std::string | The entry parameter to search for. |
Returns
| Type | Description |
|---|---|
Nullable<T> | T* The corresponding entry, or nullptr if none found. |
methaddBanabstract
NotNull<T> addBan(std::string target, std::optional<std::string> reason, std::optional<BanEntry::Date> expires, std::optional<std::string> source) =0Adds a ban to this list. If a previous ban exists, this will update the previous entry.
Parameters
| Name | Type | Description |
|---|---|---|
target | std::string | The target of the ban. |
reason | std::optional<std::string> | The reason for the ban, std::nullopt indicates implementation default. |
expires | std::optional<BanEntry::Date> | The date for the ban's expiration (unban), or std::nullopt to imply forever. |
source | std::optional<std::string> | The source of the ban, std::nullopt indicates implementation default. |
Returns
| Type | Description |
|---|---|
NotNull<T> | T& The entry for the newly created ban, or the entry for the (updated) previous ban. |
methaddBanabstract
NotNull<T> addBan(std::string target, std::optional<std::string> reason, std::chrono::seconds duration, std::optional<std::string> source) =0Adds a ban to this list. If a previous ban exists, this will update the previous entry.
Parameters
| Name | Type | Description |
|---|---|---|
target | std::string | The target of the ban. |
reason | std::optional<std::string> | The reason for the ban, std::nullopt indicates implementation default. |
duration | std::chrono::seconds | The duration of the ban |
source | std::optional<std::string> | The source of the ban, std::nullopt indicates implementation default. |
Returns
| Type | Description |
|---|---|
NotNull<T> | T& The entry for the newly created ban, or the entry for the (updated) previous ban. |
methgetEntriesabstractconst
std::vector<NotNull<T>> getEntries() const =0Gets a vector containing pointers to every BanEntry in this list.
Returns
| Type | Description |
|---|---|
std::vector<NotNull<T>> | A vector containing pointers to every entry tracked by this list. |
methisBannedabstractconst
bool isBanned(std::string target) const =0Checks if a BanEntry exists for the target, indicating an active ban status.
Parameters
| Name | Type | Description |
|---|---|---|
target | std::string | The target to find. |
Returns
| Type | Description |
|---|---|
bool | true If a BanEntry exists for the target, indicating an active ban status. false Otherwise. |
methremoveBanabstract
void removeBan(std::string target) =0Removes the specified target from this list, therefore indicating a "not banned" status.
Parameters
| Name | Type | Description |
|---|---|---|
target | std::string | The target to remove from this list. |
classIpBanEntry
Defined in <endstone/ban/ip_ban_entry.h>
Bases: BanEntry
Represents an entry for a banned IP address.
Methods
| Name | Description |
|---|---|
IpBanEntry | |
getAddress | Gets the banned IP address. |
methIpBanEntryexplicit
IpBanEntry(std::string address)methgetAddressconst
std::string getAddress() constGets the banned IP address.
Returns
| Type | Description |
|---|---|
std::string | the IP address |
classIpBanList
Defined in <endstone/ban/ip_ban_list.h>
Bases: BanList<IpBanEntry>
Represents a ban list, containing banned IP addresses.
Methods
| Name | Description |
|---|---|
getBanEntry | Gets a BanEntry by IP address. |
addBan | Adds a ban to this list. If a previous ban exists, this will update the previous entry. |
addBan | Adds a ban to this list. If a previous ban exists, this will update the previous entry. |
getEntries | Gets a vector containing pointers to every BanEntry in this list. |
isBanned | Checks if a BanEntry exists for the target, indicating an active ban status. |
removeBan | Removes the specified IP address from this list, therefore indicating a "not banned" status. |
methgetBanEntryabstractconstoverride
Nullable<IpBanEntry> getBanEntry(std::string address) const override=0Gets a BanEntry by IP address.
Parameters
| Name | Type | Description |
|---|---|---|
address | std::string | The IP address to search for. |
Returns
| Type | Description |
|---|---|
Nullable<IpBanEntry> | IpBanEntry The corresponding entry, or nullptr if none found. |
methaddBanabstractoverride
NotNull<IpBanEntry> addBan(std::string address, std::optional<std::string> reason, std::optional<BanEntry::Date> expires, std::optional<std::string> source) override=0Adds a ban to this list. If a previous ban exists, this will update the previous entry.
Parameters
| Name | Type | Description |
|---|---|---|
address | std::string | The IP address of the target. |
reason | std::optional<std::string> | The reason for the ban, std::nullopt indicates implementation default. |
expires | std::optional<BanEntry::Date> | The date for the ban's expiration (unban), or std::nullopt to imply forever. |
source | std::optional<std::string> | The source of the ban, std::nullopt indicates implementation default. |
Returns
| Type | Description |
|---|---|
NotNull<IpBanEntry> | IpBanEntry The entry for the newly created ban, or the entry for the (updated) previous ban. |
methaddBanabstract
NotNull<IpBanEntry> addBan(std::string address, std::optional<std::string> reason, std::chrono::seconds duration, std::optional<std::string> source) override=0Adds a ban to this list. If a previous ban exists, this will update the previous entry.
Parameters
| Name | Type | Description |
|---|---|---|
address | std::string | The IP address of the target. |
reason | std::optional<std::string> | The reason for the ban, std::nullopt indicates implementation default. |
duration | std::chrono::seconds | The duration of the ban |
source | std::optional<std::string> | The source of the ban, std::nullopt indicates implementation default. |
Returns
| Type | Description |
|---|---|
NotNull<IpBanEntry> | IpBanEntry The entry for the newly created ban, or the entry for the (updated) previous ban. |
methgetEntriesabstractconstoverride
std::vector<NotNull<IpBanEntry>> getEntries() const override=0Gets a vector containing pointers to every BanEntry in this list.
Returns
| Type | Description |
|---|---|
std::vector<NotNull<IpBanEntry>> | A vector containing pointers to every entry tracked by this list. |
methisBannedabstractconstoverride
bool isBanned(std::string address) const override=0Checks if a BanEntry exists for the target, indicating an active ban status.
Parameters
| Name | Type | Description |
|---|---|---|
address | std::string | The IP address to find. |
Returns
| Type | Description |
|---|---|
bool | true If a BanEntry exists for the target, indicating an active ban status. false Otherwise. |
methremoveBanabstractoverride
void removeBan(std::string address) override=0Removes the specified IP address from this list, therefore indicating a "not banned" status.
Parameters
| Name | Type | Description |
|---|---|---|
address | std::string | The IP address to remove from this list. |
classPlayerBanEntry
Defined in <endstone/ban/player_ban_entry.h>
Bases: BanEntry
Represents an entry for a banned player.
Methods
| Name | Description |
|---|---|
PlayerBanEntry | |
getName | Gets the banned player's name. |
getUniqueId | Gets the banned player's unique id. |
getXuid | Gets the banned player's xbox user id (xuid). |
methPlayerBanEntryexplicit
PlayerBanEntry(std::string name, std::optional<UUID> uuid = std::nullopt, std::optional<std::string> xuid = std::nullopt)methgetNameconst
std::string getName() constGets the banned player's name.
Returns
| Type | Description |
|---|---|
std::string | the player name |
methgetUniqueIdconst
std::optional<UUID> getUniqueId() constGets the banned player's unique id.
Returns
| Type | Description |
|---|---|
std::optional<UUID> | the player's unique id, or std::nullopt if not available |
methgetXuidconst
std::optional<std::string> getXuid() constGets the banned player's xbox user id (xuid).
Returns
| Type | Description |
|---|---|
std::optional<std::string> | the player's xbox user id (xuid), or std::nullopt if not available |
classPlayerBanList
Defined in <endstone/ban/player_ban_list.h>
Bases: BanList<PlayerBanEntry>
Represents a ban list, containing banned players.
Methods
| Name | Description |
|---|---|
getBanEntry | Gets a BanEntry by player name. |
getBanEntry | Gets a BanEntry by player name, UUID, or XUID. |
addBan | Adds a ban to this list. If a previous ban exists, this will update the previous entry. |
addBan | Adds a ban to this list. If a previous ban exists, this will update the previous entry. |
addBan | Adds a ban to this list. If a previous ban exists, this will update the previous entry. |
addBan | Adds a ban to this list. If a previous ban exists, this will update the previous entry. |
getEntries | Gets a vector containing pointers to every BanEntry in this list. |
isBanned | Checks if a BanEntry exists for the target, indicating an active ban status. |
isBanned | Checks if a BanEntry exists for the target, indicating an active ban status. |
removeBan | Removes the specified player from this list, therefore indicating a "not banned" status. |
removeBan | Removes the specified player from this list, therefore indicating a "not banned" status. |
methgetBanEntryabstractconstoverride
Nullable<PlayerBanEntry> getBanEntry(std::string name) const override=0Gets a BanEntry by player name.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | The player name to search for. |
Returns
| Type | Description |
|---|---|
Nullable<PlayerBanEntry> | PlayerBanEntry The corresponding entry, or nullptr if none found. |
methgetBanEntryabstractconst
Nullable<PlayerBanEntry> getBanEntry(std::string name, std::optional<UUID> uuid, std::optional<std::string> xuid) const =0Gets a BanEntry by player name, UUID, or XUID.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | The player name to search for. |
uuid | std::optional<UUID> | The UUID of the player to search for, std::nullopt if not used. |
xuid | std::optional<std::string> | The XUID of the player to search for, std::nullopt if not used. |
Returns
| Type | Description |
|---|---|
Nullable<PlayerBanEntry> | PlayerBanEntry The corresponding entry, or nullptr if none found. |
methaddBanabstractoverride
NotNull<PlayerBanEntry> addBan(std::string name, std::optional<std::string> reason, std::optional<BanEntry::Date> expires, std::optional<std::string> source) override=0Adds a ban to this list. If a previous ban exists, this will update the previous entry.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | The name of the target. |
reason | std::optional<std::string> | The reason for the ban, std::nullopt indicates implementation default. |
expires | std::optional<BanEntry::Date> | The date for the ban's expiration (unban), or std::nullopt to imply forever. |
source | std::optional<std::string> | The source of the ban, std::nullopt indicates implementation default. |
Returns
| Type | Description |
|---|---|
NotNull<PlayerBanEntry> | PlayerBanEntry The entry for the newly created ban, or the entry for the (updated) previous ban. |
methaddBanabstract
NotNull<PlayerBanEntry> addBan(std::string name, std::optional<UUID> uuid, std::optional<std::string> xuid, std::optional<std::string> reason, std::optional<BanEntry::Date> expires, std::optional<std::string> source) =0Adds a ban to this list. If a previous ban exists, this will update the previous entry.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | The name of the target. |
uuid | std::optional<UUID> | The UUID of the target, std::nullopt if not used. |
xuid | std::optional<std::string> | The XUID of the target, std::nullopt if not used. |
reason | std::optional<std::string> | The reason for the ban, std::nullopt indicates implementation default. |
expires | std::optional<BanEntry::Date> | The date for the ban's expiration (unban), or std::nullopt to imply forever. |
source | std::optional<std::string> | The source of the ban, std::nullopt indicates implementation default. |
Returns
| Type | Description |
|---|---|
NotNull<PlayerBanEntry> | PlayerBanEntry The entry for the newly created ban, or the entry for the (updated) previous ban. |
methaddBanabstract
NotNull<PlayerBanEntry> addBan(std::string name, std::optional<std::string> reason, std::chrono::seconds duration, std::optional<std::string> source) override=0Adds a ban to this list. If a previous ban exists, this will update the previous entry.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | The name of the target. |
reason | std::optional<std::string> | The reason for the ban, std::nullopt indicates implementation default. |
duration | std::chrono::seconds | The duration of the ban |
source | std::optional<std::string> | The source of the ban, std::nullopt indicates implementation default. |
Returns
| Type | Description |
|---|---|
NotNull<PlayerBanEntry> | PlayerBanEntry The entry for the newly created ban, or the entry for the (updated) previous ban. |
methaddBanabstract
NotNull<PlayerBanEntry> addBan(std::string name, std::optional<UUID> uuid, std::optional<std::string> xuid, std::optional<std::string> reason, std::chrono::seconds duration, std::optional<std::string> source) =0Adds a ban to this list. If a previous ban exists, this will update the previous entry.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | The name of the target. |
uuid | std::optional<UUID> | The UUID of the target, std::nullopt if not used. |
xuid | std::optional<std::string> | The XUID of the target, std::nullopt if not used. |
reason | std::optional<std::string> | The reason for the ban, std::nullopt indicates implementation default. |
duration | std::chrono::seconds | The duration of the ban |
source | std::optional<std::string> | The source of the ban, std::nullopt indicates implementation default. |
Returns
| Type | Description |
|---|---|
NotNull<PlayerBanEntry> | PlayerBanEntry The entry for the newly created ban, or the entry for the (updated) previous ban. |
methgetEntriesabstractconstoverride
std::vector<NotNull<PlayerBanEntry>> getEntries() const override=0Gets a vector containing pointers to every BanEntry in this list.
Returns
| Type | Description |
|---|---|
std::vector<NotNull<PlayerBanEntry>> | A vector containing pointers to every entry tracked by this list. |
methisBannedabstractconstoverride
bool isBanned(std::string name) const override=0Checks if a BanEntry exists for the target, indicating an active ban status.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | The player name to find. |
Returns
| Type | Description |
|---|---|
bool | true If a BanEntry exists for the target, indicating an active ban status. false Otherwise. |
methisBannedabstractconst
bool isBanned(std::string name, std::optional<UUID> uuid, std::optional<std::string> xuid) const =0Checks if a BanEntry exists for the target, indicating an active ban status.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | The player name to find. |
uuid | std::optional<UUID> | The UUID of the target, std::nullopt if not used. |
xuid | std::optional<std::string> | The XUID of the target, std::nullopt if not used. |
Returns
| Type | Description |
|---|---|
bool | true If a BanEntry exists for the target, indicating an active ban status. false Otherwise. |
methremoveBanabstractoverride
void removeBan(std::string name) override=0Removes the specified player from this list, therefore indicating a "not banned" status.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | The player name to remove from this list. |
methremoveBanabstract
void removeBan(std::string name, std::optional<UUID> uuid, std::optional<std::string> xuid) =0Removes the specified player from this list, therefore indicating a "not banned" status.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | The player name to remove from this list. |
uuid | std::optional<UUID> | The unique id of the player, std::nullopt if not used. |
xuid | std::optional<std::string> | The xbox user id (xuid) of the player, std::nullopt if not used. |