C# Class fCraft.RankManager

Manages all the ranks on a server. Controls what ranks are available and in what order they exist in.
Show file Open project: fragmer/fCraft Class Usage Examples

Public Properties

Property Type Description
DefaultRank Rank

Private Properties

Property Type Description
CheckIfPlayerDBLoaded void
DefineDefaultRanks XElement
FindRank Rank
FindRank Rank
FindRank Rank
GenerateId string
GetMinRankWithAllPermissions Rank
GetMinRankWithAnyPermission Rank
ParsePermissionLimits void
RankManager System
RebuildIndex void
Reset void
SortRanksByLegacyNumericRank void

Public Methods

Method Description
AddRank ( Rank rank ) : void

Adds a new rank to the list. Checks for duplicates.

AddRank ( [ rank ) : void

Adds a new rank to the list. Checks for duplicates.

AddRank ( [ newRank, int desiredIndex ) : void

Adds a new rank to the list at the desired position in the hierarchy. Checks for duplicates.

CanRenameRank ( Rank rank, string newName ) : bool
CanRenameRank ( [ rank, [ newName ) : bool
DeleteRank ( Rank deletedRank, Rank replacementRank ) : bool
DeleteRank ( [ deletedRank, [ replacementRank ) : bool
GenerateID ( ) : string
GetIndex ( Rank rank ) : int
GetMinRankWithPermission ( ) : Rank

Finds the lowest rank that has all the required permissions.

LowerRank ( Rank rank ) : bool
LowerRank ( [ rank ) : bool
ParseRank ( string name ) : Rank

Parses serialized rank. Accepts either the "name" or "name#ID" format. Uses legacy rank mapping table for unrecognized ranks. Does not autocomple.

RaiseRank ( Rank rank ) : bool
RaiseRank ( [ rank ) : bool
RenameRank ( Rank rank, string newName ) : void
RenameRank ( [ rank, [ newName ) : void
ResetToDefaults ( ) : void

Resets the list of ranks to defaults (guest/builder/op/owner). Warning: This method is not thread-safe, and should never be used on a live server.

Private Methods

Method Description
CheckIfPlayerDBLoaded ( ) : void
DefineDefaultRanks ( ) : XElement
FindRank ( [ name ) : Rank
FindRank ( int index ) : Rank
FindRank ( string name ) : Rank
GenerateId ( ) : string
GetMinRankWithAllPermissions ( ) : Rank
GetMinRankWithAnyPermission ( ) : Rank
ParsePermissionLimits ( ) : void
RankManager ( ) : System
RebuildIndex ( ) : void
Reset ( ) : void

Clears the list of ranks.

SortRanksByLegacyNumericRank ( ) : void

Method Details

AddRank() public static method

Adds a new rank to the list. Checks for duplicates.
public static AddRank ( Rank rank ) : void
rank Rank
return void

AddRank() public static method

Adds a new rank to the list. Checks for duplicates.
public static AddRank ( [ rank ) : void
rank [
return void

AddRank() public static method

Adds a new rank to the list at the desired position in the hierarchy. Checks for duplicates.
If rank is null. If PlayerDB is already loaded. If a rank with this name or ID is already defined.
public static AddRank ( [ newRank, int desiredIndex ) : void
newRank [ Rank to add to the list.
desiredIndex int Desired rank index (zero-based).
return void

CanRenameRank() public static method

public static CanRenameRank ( Rank rank, string newName ) : bool
rank Rank
newName string
return bool

CanRenameRank() public static method

public static CanRenameRank ( [ rank, [ newName ) : bool
rank [
newName [
return bool

DeleteRank() public static method

public static DeleteRank ( Rank deletedRank, Rank replacementRank ) : bool
deletedRank Rank
replacementRank Rank
return bool

DeleteRank() public static method

public static DeleteRank ( [ deletedRank, [ replacementRank ) : bool
deletedRank [
replacementRank [
return bool

GenerateID() public static method

public static GenerateID ( ) : string
return string

GetIndex() public static method

public static GetIndex ( Rank rank ) : int
rank Rank
return int

GetMinRankWithPermission() public static method

Finds the lowest rank that has all the required permissions.
public static GetMinRankWithPermission ( ) : Rank
return Rank

LowerRank() public static method

public static LowerRank ( Rank rank ) : bool
rank Rank
return bool

LowerRank() public static method

public static LowerRank ( [ rank ) : bool
rank [
return bool

ParseRank() public static method

Parses serialized rank. Accepts either the "name" or "name#ID" format. Uses legacy rank mapping table for unrecognized ranks. Does not autocomple.
public static ParseRank ( string name ) : Rank
name string Full rank name
return Rank

RaiseRank() public static method

public static RaiseRank ( Rank rank ) : bool
rank Rank
return bool

RaiseRank() public static method

public static RaiseRank ( [ rank ) : bool
rank [
return bool

RenameRank() public static method

public static RenameRank ( Rank rank, string newName ) : void
rank Rank
newName string
return void

RenameRank() public static method

public static RenameRank ( [ rank, [ newName ) : void
rank [
newName [
return void

ResetToDefaults() public static method

Resets the list of ranks to defaults (guest/builder/op/owner). Warning: This method is not thread-safe, and should never be used on a live server.
public static ResetToDefaults ( ) : void
return void

Property Details

DefaultRank public static property

public static Rank DefaultRank
return Rank