endstone::BanList
Represents a ban list, containing bans.
template <typename T>
Functions:
| Name | Description |
|---|---|
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. |
getBanEntry | Gets a BanEntry by target. |
getBanEntry | Gets a BanEntry by target. |
getEntries | Gets a vector containing pointers to every BanEntry in this list. |
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. |
addBan
T &addBan(std::string target, std::optional<std::string> reason,
std::optional<BanEntry::Date> expires,
std::optional<std::string> source)Adds a ban to this list. If a previous ban exists, this will update the previous entry.
Parameters:
targetThe target of the ban.reasonThe reason for the ban, std::nullopt indicates implementation default.expiresThe date for the ban’s expiration (unban), or std::nullopt to imply forever.sourceThe source of the ban, std::nullopt indicates implementation default.
Returns:
T& The entry for the newly created ban, or the entry for the (updated) previous ban.
T &addBan(std::string target, std::optional<std::string> reason,
std::chrono::seconds duration, std::optional<std::string> source)Adds a ban to this list. If a previous ban exists, this will update the previous entry.
Parameters:
targetThe target of the ban.reasonThe reason for the ban, std::nullopt indicates implementation default.durationThe duration of the bansourceThe source of the ban, std::nullopt indicates implementation default.
Returns:
T& The entry for the newly created ban, or the entry for the (updated) previous ban.
getBanEntry
const T *getBanEntry(std::string target) constGets a BanEntry by target.
Parameters:
targetThe entry parameter to search for.
Returns:
T* The corresponding entry, or nullptr if none found.
T *getBanEntry(std::string target)Gets a BanEntry by target.
Parameters:
targetThe entry parameter to search for.
Returns:
T* The corresponding entry, or nullptr if none found.
getEntries
std::vector<const T *> getEntries() constGets a vector containing pointers to every BanEntry in this list.
Returns:
A vector containing pointers to every entry tracked by this list.
std::vector<T *> getEntries()Gets a vector containing pointers to every BanEntry in this list.
Returns:
A vector containing pointers to every entry tracked by this list.
isBanned
bool isBanned(std::string target) constChecks if a BanEntry exists for the target, indicating an active ban status.
Parameters:
targetThe target to find.
Returns:
true If a BanEntry exists for the target, indicating an active ban status.
Returns:
false Otherwise.
removeBan
void removeBan(std::string target)Removes the specified target from this list, therefore indicating a “not banned” status.
Parameters:
targetThe target to remove from this list.