Class endstone::BanEntry¶
template <typename T>
ClassList > endstone > BanEntry
A single entry from a ban list. This may represent either a player ban or an IP ban. More...
#include <endstone/ban/ban_entry.h>
Public Functions¶
Type | Name |
---|---|
virtual std::chrono::system_clock::time_point | getCreated () const = 0 Gets the date this ban entry was created. |
virtual std::optional< std::chrono::system_clock::time_point > | getExpiration () const = 0 Gets the date this ban expires on, or std::nullopt for no defined end date. |
virtual std::optional< std::string > | getReason () const = 0 Gets the reason for this ban. |
virtual std::string | getSource () const = 0 Gets the source of this ban. |
virtual T & | getTarget () const = 0 Gets the target involved. |
virtual void | remove () = 0 Removes this ban entry from the appropriate ban list. |
virtual void | save () = 0 Saves the ban entry, overwriting any previous data in the ban list. |
virtual void | setCreated (std::chrono::system_clock::time_point created) = 0 Sets the date this ban entry was created. |
virtual void | setExpiration (std::optional< std::chrono::system_clock::time_point > expiration) = 0 Sets the date this ban expires on. std::nullopt values are considered "infinite" bans. |
virtual void | setReason (std::optional< std::string > reason) = 0 Sets the reason for this ban. |
virtual void | setSource (std::string source) = 0 Sets the source of this ban. |
virtual | ~BanEntry () = default |
Detailed Description¶
Unsaved information is not automatically written to the implementation's ban list, instead, the save() method must be called to write the changes to the ban list. If this ban entry has expired (such as from an unban) and is no longer found in the list, the save() call will re-add it to the list, therefore banning the victim specified.
Likewise, changes to the associated BanList or other entries may or may not be reflected in this entry.
Template parameters:
T
The ban target
Public Functions Documentation¶
function getCreated¶
Gets the date this ban entry was created.
Returns:
the creation date
function getExpiration¶
Gets the date this ban expires on, or std::nullopt for no defined end date.
virtual std::optional< std::chrono::system_clock::time_point > endstone::BanEntry::getExpiration () const = 0
Returns:
the expiration date
function getReason¶
Gets the reason for this ban.
Returns:
the ban reason, or std::nullopt if not set
function getSource¶
Gets the source of this ban.
Returns:
the source of the ban
function getTarget¶
Gets the target involved.
Returns:
the target, e.g. profile or IP address
function remove¶
function save¶
Saves the ban entry, overwriting any previous data in the ban list.
Saving the ban entry of an unbanned player will cause the player to be banned once again.
function setCreated¶
Sets the date this ban entry was created.
Parameters:
created
the new created date
See also: save() saving changes
function setExpiration¶
Sets the date this ban expires on. std::nullopt values are considered "infinite" bans.
virtual void endstone::BanEntry::setExpiration (
std::optional< std::chrono::system_clock::time_point > expiration
) = 0
Parameters:
expiration
the new expiration date, or std::nullopt to indicate an eternity
See also: save() saving changes
function setReason¶
Sets the reason for this ban.
Parameters:
reason
the new reason, std::nullopt values assume the implementation default
See also: save() saving changes
function setSource¶
Sets the source of this ban.
Parameters:
source
the new source
See also: save() saving changes
function ~BanEntry¶
The documentation for this class was generated from the following file include/endstone/ban/ban_entry.h