cRankManager


Index:
Articles
Classes
Hooks

Quick navigation:
BannerPattern
BossBarColor
BossBarDivisionType
cArrowEntity
cBeaconEntity
cBedEntity
cBlockArea
cBlockEntity
cBlockEntityWithItems
cBlockInfo
cBoat
cBoundingBox
cBrewingstandEntity
cChatColor
cChestEntity
cChunkDesc
cClientHandle
cColor
cCommandBlockEntity
cCompositeChat
cCraftingGrid
cCraftingRecipe
cCryptoHash
cCuboid
cDispenserEntity
cDropperEntity
cDropSpenserEntity
cEnchantments
cEnderCrystal
cEntity
cEntityEffect
cExpBottleEntity
cExpOrb
cFallingBlock
cFile
cFireChargeEntity
cFireworkEntity
cFloater
cFlowerPotEntity
cFurnaceEntity
cGhastFireballEntity
cHangingEntity
cHopperEntity
cIniFile
cInventory
cItem
cItemFrame
cItemGrid
cItems
cJson
cJukeboxEntity
cLeashKnot
cLineBlockTracer
cLuaWindow
cMap
cMapManager
cMobHeadEntity
cMobSpawnerEntity
cMojangAPI
cMonster
cNetwork
cNoteEntity
cObjective
cPainting
cPawn
cPickup
cPlayer
cPlugin
cPluginLua
cPluginManager
cProjectileEntity
cRankManager
cRoot
cScoreboard
cServer
cServerHandle
cSignEntity
cSplashPotionEntity
cStringCompression
cTCPLink
cTeam
cThrownEggEntity
cThrownEnderPearlEntity
cThrownSnowballEntity
cTNTEntity
cUDPEndpoint
cUrlClient
cUrlParser
CustomStatistic
cUUID
cWebAdmin
cWindow
cWitherSkullEntity
cWorld
EffectID
HTTPFormData
HTTPRequest
HTTPTemplateRequest
ItemCategory
lxp
SmokeDirection
sqlite3
StatisticsManager
TakeDamageInfo
tolua
Vector3d
Vector3f
Vector3i
Globals

Contents


cRankManager class

Manages the players' permissions. The players are assigned a single rank, which contains groups of permissions and restrictions. The functions in this class query or modify these.

All the functions are static, call them using the cRankManager:Function() convention.

The players are identified by their UUID, to support player renaming.

The rank also contains specific "mesage visuals" - bits that are used for formatting messages from the players. There's a message prefix, which is put in front of every message the player sends, and the message suffix that is appended to each message. There's also a PlayerNameColorCode, which holds the color that is used for the player's name in the messages.

Each rank can contain any number of permission groups. These groups allow for an easier setup of the permissions - you can share groups among ranks, so the usual approach is to group similar permissions together and add that group to any rank that should use those permissions.

Permissions are added to individual groups. Each group can support unlimited permissions. Note that adding a permission to a group will make the permission available to all the ranks that contain that permission group.

One rank is reserved as the Default rank. All players that don't have an explicit rank assigned to them will behave as if assigned to this rank. The default rank can be changed to any other rank at any time. Note that the default rank cannot be removed from the RankManager - RemoveRank() will change the default rank to the replacement rank, if specified, and fail if no replacement rank is specified. Renaming the default rank using RenameRank() will change the default rank to the new name.


Functions

NameParametersReturn valueNotes
AddGroup
GroupNamestring
(STATIC) Adds the group of the specified name. Logs a warning and does nothing if the group already exists.
AddGroupToRank
GroupNamestring
RankNamestring
boolean
(STATIC) Adds the specified group to the specified rank. Returns true on success, false on failure - if the group name or the rank name is not found.
AddPermissionToGroup
Permissionstring
GroupNamestring
boolean
(STATIC) Adds the specified permission to the specified group. Returns true on success, false on failure - if the group name is not found.
AddRank
RankNamestring
MsgPrefixstring
MsgSuffixstring
MsgNameColorCodestring
(STATIC) Adds a new rank of the specified name and with the specified message visuals. Logs an info message and does nothing if the rank already exists.
AddRestrictionToGroup
Permissionstring
GroupNamestring
boolean
(STATIC) Adds a new restriction to the specified group. Returns true if successful, false if it fails (no such group). No action if the group already has the restriction.
ClearPlayerRanks (STATIC) Removes all player ranks from the database. Note that this doesn't change the cPlayer instances for the already connected players, you need to update all the instances manually.
GetAllGroups
table
(STATIC) Returns an array-table containing the names of all the groups that are known to the manager.
GetAllPermissions
table
(STATIC) Returns an array-table containing all the permissions that are known to the manager.
GetAllPermissionsRestrictions
table
(STATIC) Returns an array-table containing all the permissions and restrictions (intermixed together) that are known to the manager.
GetAllPlayerUUIDs
table
(STATIC) Returns the short uuids of all players stored in the rank DB, sorted by the players' names (case insensitive).
GetAllRanks
table
(STATIC) Returns an array-table containing the names of all the ranks that are known to the manager.
GetAllRestrictions
table
(STATIC) Returns an array-table containing all the restrictions that are known to the manager.
GetDefaultRank
string
(STATIC) Returns the name of the default rank.
GetGroupPermissions
GroupNamestring
table
(STATIC) Returns an array-table containing the permissions that the specified group contains.
GetGroupRestrictions
GroupNamestring
table
(STATIC) Returns an array-table containing the restrictions that the specified group contains.
GetPlayerGroups
PlayerUUIDcUUID
table
(STATIC) Returns an array-table of the names of the groups that are assigned to the specified player through their rank. Returns an empty table if the player is not known or has no rank or groups assigned to them.
GetPlayerMsgVisuals
PlayerUUIDcUUID
MsgPrefixstring
MsgSuffixstring
MsgNameColorCodestring
(STATIC) Returns the message visuals assigned to the player. If the player is not explicitly assigned a rank, the default rank's visuals are returned. If there is an error, no value is returned at all.
GetPlayerName
PlayerUUIDcUUID
PlayerNamestring
(STATIC) Returns the last name that the specified player has, for a player in the ranks database. An empty string is returned if the player isn't in the database.
GetPlayerPermissions
PlayerUUIDcUUID
table
(STATIC) Returns an array-table containing all permissions that the specified player is assigned through their rank. Returns the default rank's permissions if the player has no explicit rank assigned to them. Returns an empty array on error.
GetPlayerRankName
PlayerUUIDcUUID
RankNamestring
(STATIC) Returns the name of the rank that is assigned to the specified player. An empty string (NOT the default rank) is returned if the player has no rank assigned to them.
GetRankGroups
RankNamestring
table
(STATIC) Returns an array-table of the names of all the groups that are assigned to the specified rank. Returns an empty table if there is no such rank.
GetRankPermissions
RankNamestring
table
(STATIC) Returns an array-table of all the permissions that are assigned to the specified rank through its groups. Returns an empty table if there is no such rank.
GetRankRestrictions
RankNamestring
table
(STATIC) Returns an array-table of all the restrictions that are assigned to the specified rank through its groups. Returns an empty table if there is no such rank.
GetRankVisuals
RankNamestring
MsgPrefixstring
MsgSuffixstring
MsgNameColorCodestring
(STATIC) Returns the message visuals for the specified rank. Returns no value if the specified rank does not exist.
GroupExists
GroupNamestring
boolean
(STATIC) Returns true iff the specified group exists.
IsGroupInRank
GroupNamestring
RankNamestring
boolean
(STATIC) Returns true iff the specified group is assigned to the specified rank.
IsPermissionInGroup
Permissionstring
GroupNamestring
boolean
(STATIC) Returns true iff the specified permission is assigned to the specified group.
IsPlayerRankSet
PlayerUUIDcUUID
boolean
(STATIC) Returns true iff the specified player has a rank assigned to them.
IsRestrictionInGroup
Restrictionstring
GroupNamestring
boolean
(STATIC) Returns true iff the specified restriction is assigned to the specified group.
RankExists
RankNamestring
boolean
(STATIC) Returns true iff the specified rank exists.
RemoveGroup
GroupNamestring
(STATIC) Removes the specified group completely. The group will be removed from all the ranks using it and then erased from the manager. Logs an info message and does nothing if the group doesn't exist.
RemoveGroupFromRank
GroupNamestring
RankNamestring
(STATIC) Removes the specified group from the specified rank. The group will still exist, even if it isn't assigned to any rank. Logs an info message and does nothing if the group or rank doesn't exist.
RemovePermissionFromGroup
Permissionstring
GroupNamestring
(STATIC) Removes the specified permission from the specified group. Logs an info message and does nothing if the group doesn't exist.
RemovePlayerRank
PlayerUUIDcUUID
(STATIC) Removes the player's rank; the player's left without a rank. Note that this doesn't change the cPlayer instances for the already connected players, you need to update all the instances manually. No action if the player has no rank assigned to them already.
RemoveRank
RankNamestring
ReplacementRankNamestring
(STATIC) Removes the specified rank. If ReplacementRankName is given, the players that have RankName will get their rank set to ReplacementRankName. If it isn't given, or is an invalid rank, the players will be removed from the manager, their ranks will be unset completely. Logs an info message and does nothing if the rank is not found.
RemoveRestrictionFromGroup
Restrictionstring
GroupNamestring
(STATIC) Removes the specified restriction from the specified group.
RenameGroup
OldNamestring
NewNamestring
(STATIC) Renames the specified group. Logs an info message and does nothing if the group is not found or the new name is already used.
RenameRank
OldNamestring
NewNamestring
(STATIC) Renames the specified rank. Logs an info message and does nothing if the rank is not found or the new name is already used.
SetDefaultRank
RankNamestring
boolean
(STATIC) Sets the specified rank as the default rank. Returns true on success, false on failure (rank doesn't exist).
SetPlayerRank
PlayerUUIDcUUID
PlayerNamestring
RankNamestring
(STATIC) Updates the rank for the specified player. The player name is provided for reference, the UUID is used for identification. Logs a warning and does nothing if the rank is not found.
SetRankVisuals
RankNamestring
MsgPrefixstring
MsgSuffixstring
MsgNameColorCodestring
(STATIC) Updates the rank's message visuals. Logs an info message and does nothing if rank not found.
Generated by APIDump on 2024-12-05 00:47:58, Build ID 88, Commit 4b2b02a8ba1cf259ead477cc256c4ac2a994809c