Skip to Content
⚠ Under Construction
ReferenceC++ APIPlayerBanList

endstone::PlayerBanList

Represents a ban list, containing banned players.

Bases: endstone::BanList< PlayerBanEntry >

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.
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 player name.
getBanEntryGets a BanEntry by player name.
getBanEntryGets a BanEntry by player name, UUID , or XUID.
getBanEntryGets a BanEntry by player name, UUID , or XUID.
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.
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.

addBan

PlayerBanEntry &addBan(std::string name, 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:

  • name The name of the target.
  • 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:

PlayerBanEntry& The entry for the newly created ban, or the entry for the (updated) previous ban.

PlayerBanEntry &addBan(std::string name, std::optional<UUID> uuid, std::optional<std::string> xuid, 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:

  • name The name of the target.
  • uuid The UUID of the target, std::nullopt if not used.
  • xuid The XUID of the target, std::nullopt if not used.
  • 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:

PlayerBanEntry& The entry for the newly created ban, or the entry for the (updated) previous ban.

PlayerBanEntry &addBan(std::string name, 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:

  • name The name of the target.
  • 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:

PlayerBanEntry& The entry for the newly created ban, or the entry for the (updated) previous ban.

PlayerBanEntry &addBan(std::string name, std::optional<UUID> uuid, std::optional<std::string> xuid, 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:

  • name The name of the target.
  • uuid The UUID of the target, std::nullopt if not used.
  • xuid The XUID of the target, std::nullopt if not used.
  • 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:

PlayerBanEntry& The entry for the newly created ban, or the entry for the (updated) previous ban.

getBanEntry

const PlayerBanEntry *getBanEntry(std::string name) const

Gets a BanEntry by player name.

Parameters:

  • name The player name to search for.

Returns:

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

PlayerBanEntry *getBanEntry(std::string name)

Gets a BanEntry by player name.

Parameters:

  • name The player name to search for.

Returns:

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

const PlayerBanEntry *getBanEntry(std::string name, std::optional<UUID> uuid, std::optional<std::string> xuid) const

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

Parameters:

  • name The player name to search for.
  • uuid The UUID of the player to search for, std::nullopt if not used.
  • xuid The XUID of the player to search for, std::nullopt if not used.

Returns:

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

PlayerBanEntry *getBanEntry(std::string name, std::optional<UUID> uuid, std::optional<std::string> xuid)

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

Parameters:

  • name The player name to search for.
  • uuid The UUID of the player to search for, std::nullopt if not used.
  • xuid The XUID of the player to search for, std::nullopt if not used.

Returns:

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

getEntries

std::vector<const PlayerBanEntry *> 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<PlayerBanEntry *> 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 name) const

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

Parameters:

  • name The player name to find.

Returns:

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

Returns:

false Otherwise.

bool isBanned(std::string name, std::optional<UUID> uuid, std::optional<std::string> xuid) const

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

Parameters:

  • name The player name to find.
  • uuid The UUID of the target, std::nullopt if not used.
  • xuid The XUID of the target, std::nullopt if not used.

Returns:

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

Returns:

false Otherwise.

removeBan

void removeBan(std::string name)

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

Parameters:

  • name The player name to remove from this list.
void removeBan(std::string name, std::optional<UUID> uuid, std::optional<std::string> xuid)

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

Parameters:

  • name The player name to remove from this list.
  • uuid The unique id of the player, std::nullopt if not used.
  • xuid The xbox user id (xuid) of the player, std::nullopt if not used.
Last updated on