endstone/ban

Classes

NameDescription
BanEntryA single entry from a ban list.
BanListRepresents a ban list, containing bans.
IpBanEntryRepresents an entry for a banned IP address.
IpBanListRepresents a ban list, containing banned IP addresses.
PlayerBanEntryRepresents an entry for a banned player.
PlayerBanListRepresents a ban list, containing banned players.

classBanEntry

Defined in <endstone/ban/ban_entry.h>

A single entry from a ban list.

Type Aliases

NameDescription
Date

Variables

NameDescription
DateFormat

Methods

NameDescription
getCreatedGets the date this ban entry was created.
setCreatedSets the date this ban entry was created.
getSourceGets the source of this ban.
setSourceSets the source of this ban.
getExpirationGets the date this ban expires on, or std::nullopt for no defined end date.
setExpirationSets the date this ban expires on. std::nullopt values are considered "infinite" bans.
getReasonGets the reason for this ban.
setReasonSets the reason for this ban.

typeDate

varDateFormatstatic

const std::string DateFormat

methgetCreatedconst

Date getCreated() const

Gets the date this ban entry was created.

Returns

TypeDescription
Datethe creation date

methsetCreated

void setCreated(Date created)

Sets the date this ban entry was created.

See also

save() saving changes

Parameters

NameTypeDescription
createdDatethe new created date

methgetSourceconst

std::string getSource() const

Gets the source of this ban.

Returns

TypeDescription
std::stringthe source of the ban

methsetSource

void setSource(std::string source)

Sets the source of this ban.

See also

save() saving changes

Parameters

NameTypeDescription
sourcestd::stringthe new source

methgetExpirationconst

std::optional<Date> getExpiration() const

Gets the date this ban expires on, or std::nullopt for no defined end date.

Returns

TypeDescription
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

NameTypeDescription
expirationstd::optional<Date>the new expiration date, or std::nullopt to indicate an infinite ban

methgetReasonconst

std::string getReason() const

Gets the reason for this ban.

Returns

TypeDescription
std::stringthe ban reason

methsetReason

void setReason(std::string reason)

Sets the reason for this ban.

See also

save() saving changes

Parameters

NameTypeDescription
reasonstd::stringthe new reason, empty values assume the implementation default

classBanList

Defined in <endstone/ban/ban_list.h>

Represents a ban list, containing bans.

Type Aliases

NameDescription
EntryType

Methods

NameDescription
~BanList
getBanEntryGets a BanEntry by target.
addBanAdds a ban to this list. If a previous ban exists, this will update the previous entry.
addBanAdds a ban to this list. If a previous ban exists, this will update the previous entry.
getEntriesGets a vector containing pointers to every BanEntry in this list.
isBannedChecks if a BanEntry exists for the target, indicating an active ban status.
removeBanRemoves the specified target from this list, therefore indicating a "not banned" status.

typeEntryType

T EntryType

meth~BanListvirtual

~BanList() =default

methgetBanEntryabstractconst

Nullable<T> getBanEntry(std::string target) const =0

Gets a BanEntry by target.

Parameters

NameTypeDescription
targetstd::stringThe entry parameter to search for.

Returns

TypeDescription
Nullable<T>T* The corresponding entry, or nullptr if none found.

methaddBanabstract

Adds a ban to this list. If a previous ban exists, this will update the previous entry.

Parameters

NameTypeDescription
targetstd::stringThe target of the ban.
reasonstd::optional<std::string>The reason for the ban, std::nullopt indicates implementation default.
expiresstd::optional<BanEntry::Date>The date for the ban's expiration (unban), or std::nullopt to imply forever.
sourcestd::optional<std::string>The source of the ban, std::nullopt indicates implementation default.

Returns

TypeDescription
NotNull<T>T& The entry for the newly created ban, or the entry for the (updated) previous ban.

methaddBanabstract

Adds a ban to this list. If a previous ban exists, this will update the previous entry.

Parameters

NameTypeDescription
targetstd::stringThe target of the ban.
reasonstd::optional<std::string>The reason for the ban, std::nullopt indicates implementation default.
durationstd::chrono::secondsThe duration of the ban
sourcestd::optional<std::string>The source of the ban, std::nullopt indicates implementation default.

Returns

TypeDescription
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 =0

Gets a vector containing pointers to every BanEntry in this list.

Returns

TypeDescription
std::vector<NotNull<T>>A vector containing pointers to every entry tracked by this list.

methisBannedabstractconst

bool isBanned(std::string target) const =0

Checks if a BanEntry exists for the target, indicating an active ban status.

Parameters

NameTypeDescription
targetstd::stringThe target to find.

Returns

TypeDescription
booltrue If a BanEntry exists for the target, indicating an active ban status. false Otherwise.

methremoveBanabstract

void removeBan(std::string target) =0

Removes the specified target from this list, therefore indicating a "not banned" status.

Parameters

NameTypeDescription
targetstd::stringThe 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

NameDescription
IpBanEntry
getAddressGets the banned IP address.

methIpBanEntryexplicit

IpBanEntry(std::string address)

methgetAddressconst

std::string getAddress() const

Gets the banned IP address.

Returns

TypeDescription
std::stringthe IP address

classIpBanList

Defined in <endstone/ban/ip_ban_list.h>

Bases: BanList<IpBanEntry>

Represents a ban list, containing banned IP addresses.

Methods

NameDescription
getBanEntryGets a BanEntry by IP address.
addBanAdds a ban to this list. If a previous ban exists, this will update the previous entry.
addBanAdds a ban to this list. If a previous ban exists, this will update the previous entry.
getEntriesGets a vector containing pointers to every BanEntry in this list.
isBannedChecks if a BanEntry exists for the target, indicating an active ban status.
removeBanRemoves the specified IP address from this list, therefore indicating a "not banned" status.

methgetBanEntryabstractconstoverride

Nullable<IpBanEntry> getBanEntry(std::string address) const override=0

Gets a BanEntry by IP address.

Parameters

NameTypeDescription
addressstd::stringThe IP address to search for.

Returns

TypeDescription
Nullable<IpBanEntry>IpBanEntry The corresponding entry, or nullptr if none found.

methaddBanabstractoverride

Adds a ban to this list. If a previous ban exists, this will update the previous entry.

Parameters

NameTypeDescription
addressstd::stringThe IP address of the target.
reasonstd::optional<std::string>The reason for the ban, std::nullopt indicates implementation default.
expiresstd::optional<BanEntry::Date>The date for the ban's expiration (unban), or std::nullopt to imply forever.
sourcestd::optional<std::string>The source of the ban, std::nullopt indicates implementation default.

Returns

TypeDescription
NotNull<IpBanEntry>IpBanEntry The entry for the newly created ban, or the entry for the (updated) previous ban.

methaddBanabstract

Adds a ban to this list. If a previous ban exists, this will update the previous entry.

Parameters

NameTypeDescription
addressstd::stringThe IP address of the target.
reasonstd::optional<std::string>The reason for the ban, std::nullopt indicates implementation default.
durationstd::chrono::secondsThe duration of the ban
sourcestd::optional<std::string>The source of the ban, std::nullopt indicates implementation default.

Returns

TypeDescription
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=0

Gets a vector containing pointers to every BanEntry in this list.

Returns

TypeDescription
std::vector<NotNull<IpBanEntry>>A vector containing pointers to every entry tracked by this list.

methisBannedabstractconstoverride

bool isBanned(std::string address) const override=0

Checks if a BanEntry exists for the target, indicating an active ban status.

Parameters

NameTypeDescription
addressstd::stringThe IP address to find.

Returns

TypeDescription
booltrue If a BanEntry exists for the target, indicating an active ban status. false Otherwise.

methremoveBanabstractoverride

void removeBan(std::string address) override=0

Removes the specified IP address from this list, therefore indicating a "not banned" status.

Parameters

NameTypeDescription
addressstd::stringThe 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

NameDescription
PlayerBanEntry
getNameGets the banned player's name.
getUniqueIdGets the banned player's unique id.
getXuidGets 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() const

Gets the banned player's name.

Returns

TypeDescription
std::stringthe player name

methgetUniqueIdconst

std::optional<UUID> getUniqueId() const

Gets the banned player's unique id.

Returns

TypeDescription
std::optional<UUID>the player's unique id, or std::nullopt if not available

methgetXuidconst

std::optional<std::string> getXuid() const

Gets the banned player's xbox user id (xuid).

Returns

TypeDescription
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

NameDescription
getBanEntryGets a BanEntry by player name.
getBanEntryGets a BanEntry by player name, UUID, or XUID.
addBanAdds a ban to this list. If a previous ban exists, this will update the previous entry.
addBanAdds a ban to this list. If a previous ban exists, this will update the previous entry.
addBanAdds a ban to this list. If a previous ban exists, this will update the previous entry.
addBanAdds a ban to this list. If a previous ban exists, this will update the previous entry.
getEntriesGets a vector containing pointers to every BanEntry in this list.
isBannedChecks if a BanEntry exists for the target, indicating an active ban status.
isBannedChecks if a BanEntry exists for the target, indicating an active ban status.
removeBanRemoves the specified player from this list, therefore indicating a "not banned" status.
removeBanRemoves the specified player from this list, therefore indicating a "not banned" status.

methgetBanEntryabstractconstoverride

Nullable<PlayerBanEntry> getBanEntry(std::string name) const override=0

Gets a BanEntry by player name.

Parameters

NameTypeDescription
namestd::stringThe player name to search for.

Returns

TypeDescription
Nullable<PlayerBanEntry>PlayerBanEntry The corresponding entry, or nullptr if none found.

methgetBanEntryabstractconst

Gets a BanEntry by player name, UUID, or XUID.

Parameters

NameTypeDescription
namestd::stringThe player name to search for.
uuidstd::optional<UUID>The UUID of the player to search for, std::nullopt if not used.
xuidstd::optional<std::string>The XUID of the player to search for, std::nullopt if not used.

Returns

TypeDescription
Nullable<PlayerBanEntry>PlayerBanEntry The corresponding entry, or nullptr if none found.

methaddBanabstractoverride

Adds a ban to this list. If a previous ban exists, this will update the previous entry.

Parameters

NameTypeDescription
namestd::stringThe name of the target.
reasonstd::optional<std::string>The reason for the ban, std::nullopt indicates implementation default.
expiresstd::optional<BanEntry::Date>The date for the ban's expiration (unban), or std::nullopt to imply forever.
sourcestd::optional<std::string>The source of the ban, std::nullopt indicates implementation default.

Returns

TypeDescription
NotNull<PlayerBanEntry>PlayerBanEntry The entry for the newly created ban, or the entry for the (updated) previous ban.

methaddBanabstract

Adds a ban to this list. If a previous ban exists, this will update the previous entry.

Parameters

NameTypeDescription
namestd::stringThe name of the target.
uuidstd::optional<UUID>The UUID of the target, std::nullopt if not used.
xuidstd::optional<std::string>The XUID of the target, std::nullopt if not used.
reasonstd::optional<std::string>The reason for the ban, std::nullopt indicates implementation default.
expiresstd::optional<BanEntry::Date>The date for the ban's expiration (unban), or std::nullopt to imply forever.
sourcestd::optional<std::string>The source of the ban, std::nullopt indicates implementation default.

Returns

TypeDescription
NotNull<PlayerBanEntry>PlayerBanEntry The entry for the newly created ban, or the entry for the (updated) previous ban.

methaddBanabstract

Adds a ban to this list. If a previous ban exists, this will update the previous entry.

Parameters

NameTypeDescription
namestd::stringThe name of the target.
reasonstd::optional<std::string>The reason for the ban, std::nullopt indicates implementation default.
durationstd::chrono::secondsThe duration of the ban
sourcestd::optional<std::string>The source of the ban, std::nullopt indicates implementation default.

Returns

TypeDescription
NotNull<PlayerBanEntry>PlayerBanEntry The entry for the newly created ban, or the entry for the (updated) previous ban.

methaddBanabstract

Adds a ban to this list. If a previous ban exists, this will update the previous entry.

Parameters

NameTypeDescription
namestd::stringThe name of the target.
uuidstd::optional<UUID>The UUID of the target, std::nullopt if not used.
xuidstd::optional<std::string>The XUID of the target, std::nullopt if not used.
reasonstd::optional<std::string>The reason for the ban, std::nullopt indicates implementation default.
durationstd::chrono::secondsThe duration of the ban
sourcestd::optional<std::string>The source of the ban, std::nullopt indicates implementation default.

Returns

TypeDescription
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=0

Gets a vector containing pointers to every BanEntry in this list.

Returns

TypeDescription
std::vector<NotNull<PlayerBanEntry>>A vector containing pointers to every entry tracked by this list.

methisBannedabstractconstoverride

bool isBanned(std::string name) const override=0

Checks if a BanEntry exists for the target, indicating an active ban status.

Parameters

NameTypeDescription
namestd::stringThe player name to find.

Returns

TypeDescription
booltrue 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 =0

Checks if a BanEntry exists for the target, indicating an active ban status.

Parameters

NameTypeDescription
namestd::stringThe player name to find.
uuidstd::optional<UUID>The UUID of the target, std::nullopt if not used.
xuidstd::optional<std::string>The XUID of the target, std::nullopt if not used.

Returns

TypeDescription
booltrue If a BanEntry exists for the target, indicating an active ban status. false Otherwise.

methremoveBanabstractoverride

void removeBan(std::string name) override=0

Removes the specified player from this list, therefore indicating a "not banned" status.

Parameters

NameTypeDescription
namestd::stringThe player name to remove from this list.

methremoveBanabstract

void removeBan(std::string name, std::optional<UUID> uuid, std::optional<std::string> xuid) =0

Removes the specified player from this list, therefore indicating a "not banned" status.

Parameters

NameTypeDescription
namestd::stringThe player name to remove from this list.
uuidstd::optional<UUID>The unique id of the player, std::nullopt if not used.
xuidstd::optional<std::string>The xbox user id (xuid) of the player, std::nullopt if not used.

On this page