Users clan structure. Cache server version.

Note: The contents and methods of this class are not thread-safe, you should always acquire the clan module mutex with snipe.cache.modules.ClanModuleCacheCore.acquireMutex() before each operation and release it afterwards with snipe.cache.modules.ClanModuleCacheCore.releaseMutex().

Constructor

Fields

read only id:Int

read only leaderID:Int

Methods

acceptRequest (userID:Int):String

Accepts request to join this clan.

Parameters:

userID

User ID.

Returns:

Operation status. ok - operation successful. noRequest - no request for this user. userInClan - user already in another clan.

addRequest (userID:Int):Void

Adds request to join this clan.

Parameters:

userID

User ID.

addUser (userID:Int):String

Adds user to clan.

Parameters:

userID

User ID.

Returns:

Operation status. ok - operation successful. userInClan - this user ID is already in this clan.

getUser (userID:Int):ClanUserCore

Returns clan user with this user ID. Each time this method is called, a new instance of snipe.cache.data.ClanUserCore is created.

Parameters:

userID

User ID.

Returns:

Clan user instance. Returns null if the user is not in this clan.

inline getUsersRaw ():Array<Dynamic>

Returns array of raw user records in clan. If you modify it directly, don't forget to call updated() afterwards.

Returns:

Array of raw user records in clan.

hasRequest (userID:Int):Bool

Returns true if clan has request to join from this user.

Parameters:

userID

User ID.

hasUser (userID:Int):Bool

Returns true if this user belongs to this clan.

Parameters:

userID

User ID.

refuseRequest (userID:Int):Void

Refuses request to join this clan.

Parameters:

userID

User ID.

removeUser (userID:Int):String

Removes user from clan.

Parameters:

userID

User ID.

Returns:

Operation status. ok - operation successful. isLeader - cannot remove leader.

inline setAttr (key:String, val:Dynamic):Void

Sets clan attribute value. Value has to have a simple database-usable type like number, boolean or string. The corresponding field has to exist in the "Clans" database table.

Parameters:

key

Attribute key. Has to be lowercase for database reasons. Setting "id", "leaderid" or "params" attributes directly is disallowed.

val

Attribute value.

inline setAttrs (obj:Dynamic):Void

Sets multiple clan attribute values. All values have to have simple database-usable types like numbers, booleans or strings.

Parameters:

obj

Anonymous object with fields acting as attribute keys. All attributes have to be lowercase for database reasons. Setting "id", "leaderid" or "params" attributes directly is disallowed.

setLeader (userID:Int):String

Sets new leader for this clan.

Parameters:

userID

User ID.

Returns:

Operation status. ok - Operation successful. userNotInClan - This user ID is not in this clan.

inline setVar (key:String, val:Dynamic):Void

Sets clan variable value. Value has to have a simple database-usable type like number, boolean or string. The corresponding field has to exist in the "Clans" database table.

Parameters:

key

Variable key. Has to be lowercase for database reasons. Setting "id", "leaderid" or "params" variables directly is disallowed.

val

Variable value.