Skip to Content
⚠ Under Construction
ReferenceC++ APIBanList

endstone::BanList

Represents a ban list, containing bans.

template <typename T>

Functions:

NameDescription
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.
getBanEntryGets a BanEntry by target.
getBanEntryGets a BanEntry by target.
getEntriesGets a vector containing pointers to every BanEntry in this list.
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.

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:

  • target The target of the ban.
  • reason The reason for the ban, std::nullopt indicates implementation default.
  • expires The date for the ban’s expiration (unban), or std::nullopt to imply forever.
  • source The 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:

  • target The target of the ban.
  • reason The reason for the ban, std::nullopt indicates implementation default.
  • duration The duration of the ban
  • source The 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) const

Gets a BanEntry by target.

Parameters:

  • target The 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:

  • target The entry parameter to search for.

Returns:

T* The corresponding entry, or nullptr if none found.

getEntries

std::vector<const T *> getEntries() const

Gets 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) const

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

Parameters:

  • target The 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:

  • target The target to remove from this list.
Last updated on