|
Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Go to the documentation of this file.
11 #include "SQLiteCpp/Database.h"
12 #include "SQLiteCpp/Transaction.h"
119 const cUUID & a_PlayerUUID,
130 const AString & a_MsgNameColorCode
215 const AString & a_MsgNameColorCode
292 bool DoesColumnExist(
const char * a_TableName,
const char * a_ColumnName);
296 void CreateColumnIfNotExists(
const char * a_TableName,
const char * a_ColumnName,
const char * a_ColumnType =
"");
bool AddPermissionToGroup(const AString &a_Permission, const AString &a_GroupName)
Adds the specified permission to the specified permission group.
AString GetPlayerName(const cUUID &a_PlayerUUID)
Returns the last name that the specified player has.
void AddGroups(const AStringVector &a_GroupNames)
Bulk-adds groups.
void AddRank(const AString &a_RankName, const AString &a_MsgPrefix, const AString &a_MsgSuffix, const AString &a_MsgNameColorCode)
Adds a new rank.
AStringVector GetAllRestrictions(void)
Returns all the distinct restrictions that are stored in the DB.
SQLite::Transaction m_Transaction
AString m_DefaultRank
The name of the default rank.
bool AddGroupToRank(const AString &a_GroupName, const AString &a_RankName)
Adds the specified permission group to the specified rank.
Acquire this lock to perform mass changes.
bool DoesColumnExist(const char *a_TableName, const char *a_ColumnName)
Returns true if the specified column exists in the specified table.
AStringVector GetAllGroups(void)
Returns the names of all permission groups.
bool RenameGroup(const AString &a_OldName, const AString &a_NewName)
Renames the specified group.
AStringVector GetRankGroups(const AString &a_RankName)
Returns the names of groups that the specified rank has assigned to it.
void SetRankVisuals(const AString &a_RankName, const AString &a_MsgPrefix, const AString &a_MsgSuffix, const AString &a_MsgNameColorCode)
Sets the message visuals of an existing rank.
bool RankExists(const AString &a_RankName)
Returns true iff the specified rank exists in the DB.
void CreateDefaults(void)
Creates a default set of ranks / groups / permissions.
bool m_IsInitialized
Set to true once the manager is initialized.
void ClearPlayerRanks(void)
Removes all player ranks from the database.
void AddGroup(const AString &a_GroupName)
Adds a new permission group.
void RemoveRestrictionFromGroup(const AString &a_Restriction, const AString &a_GroupName)
Removes the specified restriction from the specified group.
cMassChangeLock(cRankManager &a_RankManager)
AStringVector GetAllPermissions(void)
Returns all the distinct permissions that are stored in the DB.
void NotifyNameUUID(const AString &a_PlayerName, const cUUID &a_UUID)
Called by cMojangAPI whenever the playername-uuid pairing is discovered.
SQLite::Database m_DB
The database storage for all the data.
bool GetPlayerMsgVisuals(const cUUID &a_PlayerUUID, AString &a_MsgPrefix, AString &a_MsgSuffix, AString &a_MsgNameColorCode)
Returns the message visuals (prefix, postfix, color) for the specified player.
bool GetRankVisuals(const AString &a_RankName, AString &a_MsgPrefix, AString &a_MsgSuffix, AString &a_MsgNameColorCode)
Returns the message visuals of an existing rank.
void RemoveGroupFromRank(const AString &a_GroupName, const AString &a_RankName)
Removes the specified group from the specified rank.
bool SetDefaultRank(const AString &a_RankName)
Sets the specified rank as the default rank.
AStringVector GetRankRestrictions(const AString &a_RankName)
Returns all restrictions that the specified rank has assigned to it, through all its groups.
AStringVector GetPlayerGroups(const cUUID &a_PlayerUUID)
Returns the names of Groups that the specified player has assigned to them.
bool RenameRank(const AString &a_OldName, const AString &a_NewName)
Renames the specified rank.
void CreateColumnIfNotExists(const char *a_TableName, const char *a_ColumnName, const char *a_ColumnType="")
If the specified table doesn't contain the specified column, it is added to the table.
std::vector< cUUID > GetAllPlayerUUIDs(void)
Returns the uuids of all defined players.
bool IsPlayerRankSet(const cUUID &a_PlayerUUID)
Returns true iff the specified player has a rank assigned to them in the DB.
void Initialize(cMojangAPI &a_MojangAPI)
Initializes the rank manager.
bool UpdatePlayerName(const cUUID &a_PlayerUUID, const AString &a_NewPlayerName)
Updates the playername that is saved with this uuid.
bool IsPermissionInGroup(const AString &a_Permission, const AString &a_GroupName)
Returns true iff the specified group contains the specified permission.
AStringVector GetRankPermissions(const AString &a_RankName)
Returns all permissions that the specified rank has assigned to it, through all its groups.
void RemovePermissionFromGroup(const AString &a_Permission, const AString &a_GroupName)
Removes the specified permission from the specified group.
bool AreDBTablesEmpty(void)
Returns true if all the DB tables are empty, indicating a fresh new install.
RAII for cCriticalSection - locks the CS on creation, unlocks on destruction.
void SetPlayerRank(const cUUID &a_PlayerUUID, const AString &a_PlayerName, const AString &a_RankName)
Sets the specified player's rank.
AStringVector GetPlayerPermissions(const cUUID &a_PlayerUUID)
Returns the permissions that the specified player has assigned to them.
bool AddPermissionsToGroup(const AStringVector &a_Permissions, const AString &a_GroupName)
Adds the specified permissions to the specified permission group.
bool AddRestrictionsToGroup(const AStringVector &a_Restrictions, const AString &a_GroupName)
Adds the specified restrictions to the specified group.
AString GetPlayerRankName(const cUUID &a_PlayerUUID)
Returns the name of the rank that the specified player has assigned to them.
bool IsGroupInRank(const AString &a_GroupName, const AString &a_RankName)
Returns true iff the specified rank contains the specified group.
AStringVector GetAllPermissionsRestrictions(void)
Returns all the distinct permissions and restrictions that are stored in the DB.
bool IsRestrictionInGroup(const AString &a_Restriction, const AString &a_GroupName)
Returns true iff the specified group contains the specified restriction.
void RemoveGroup(const AString &a_GroupName)
Removes the specified group completely.
AStringVector GetAllRanks(void)
Returns the names of all defined ranks.
AStringVector GetGroupPermissions(const AString &a_GroupName)
Returns the permissions that the specified group has assigned to it.
cMojangAPI * m_MojangAPI
The MojangAPI instance that is used for keeping player names and UUIDs in sync.
bool GroupExists(const AString &a_GroupName)
Returns true iff the specified group exists in the DB.
bool AddRestrictionToGroup(const AString &a_Restriction, const AString &a_GroupName)
Adds the specified restriction to the specified group.
AStringVector GetGroupRestrictions(const AString &a_GroupName)
Returns the restrictions that the specified group has assigned to it.
bool IsDBTableEmpty(const AString &a_TableName)
Returns true iff the specified DB table is empty.
cRankManager(void)
Creates the rank manager.
const AString & GetDefaultRank(void) const
Returns the name of the default rank.
cCriticalSection m_CS
The mutex protecting m_DB and m_DefaultRank against multi-threaded access.
void RemovePlayerRank(const cUUID &a_PlayerUUID)
Removes the player's rank assignment.
void RemoveRank(const AString &a_RankName, const AString &a_ReplacementRankName)
Removes the specified rank.
std::vector< AString > AStringVector
AStringVector GetPlayerRestrictions(const cUUID &a_PlayerUUID)
Returns the restrictions that the specified player has assigned to them.