Skip to content

Class endstone::BanList

template <typename T>

ClassList > endstone > BanList

A class that represents a ban list, containing bans of some target type. More...

  • #include <endstone/ban/ban_list.h>

Public Functions

Type Name
virtual BanEntry< T > & addBan (T target, std::optional< std::string > reason, std::optional< std::chrono::system_clock::time_point > expires, std::optional< std::string > source) = 0
Adds a ban to this list. If a previous ban exists, this will update the previous entry.
virtual BanEntry< T > & addBan (T target, std::optional< std::string > reason, std::optional< std::chrono::seconds > duration, std::optional< std::string > source) = 0
Adds a ban to this list. If a previous ban exists, this will update the previous entry.
virtual BanEntry< T > * getBanEntry (T target) const = 0
Gets a BanEntry by the target.
virtual std::vector< BanEntry< T > * > getEntries () const = 0
Gets a vector containing pointers to every BanEntry in this list.
virtual bool isBanned (T target) const = 0
Checks if a BanEntry exists for the target, indicating an active ban status.
virtual void removeBan (T target) = 0
Removes the specified target from this list, therefore indicating a "not banned" status.
virtual ~BanList () = default

Detailed Description

Template parameters:

  • T The ban target type

Public Functions Documentation

function addBan [½]

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

virtual BanEntry < T > & endstone::BanList::addBan (
    T target,
    std::optional< std::string > reason,
    std::optional< std::chrono::system_clock::time_point > expires,
    std::optional< std::string > source
) = 0

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:

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


function addBan [2/2]

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

virtual BanEntry < T > & endstone::BanList::addBan (
    T target,
    std::optional< std::string > reason,
    std::optional< std::chrono::seconds > duration,
    std::optional< std::string > source
) = 0

Parameters:

  • target The target of the ban
  • reason The reason for the ban, std::nullopt indicates implementation default
  • duration The duration of the ban, or std::nullopt to imply forever
  • source The source of the ban, std::nullopt indicates implementation default

Returns:

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


function getBanEntry

Gets a BanEntry by the target.

virtual BanEntry < T > * endstone::BanList::getBanEntry (
    T target
) const = 0

Parameters:

  • target The entry parameter to search for

Returns:

BanEntry<T>* The corresponding entry, or nullptr if none found


function getEntries

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

virtual std::vector< BanEntry < T > * > endstone::BanList::getEntries () const = 0

Returns:

std::vector<BanEntry<T>*> A vector containing pointers to every entry tracked by this list


function isBanned

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

virtual bool endstone::BanList::isBanned (
    T target
) const = 0

Parameters:

  • target The target to find

Returns:

true If a BanEntry exists for the target, indicating an active ban status

Returns:

false Otherwise


function removeBan

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

virtual void endstone::BanList::removeBan (
    T target
) = 0

Parameters:

  • target The target to remove from this list

function ~BanList

virtual endstone::BanList::~BanList () = default


The documentation for this class was generated from the following file include/endstone/ban/ban_list.h