Class PlayerSet
Used by Permissions to keep track of an inclusive or exclusive set of players.
A PlayerSet contains a set of Player objects (the individuals), and uses one of two modes: Allow
and Deny
. These determine
which players are part of the set.
Allow
: Only individuals are included in the setDeny
: Everyone except individuals are included set
Methods
PlayerSet:nobody() | Constructs a new set with mode Allow that contains no players |
PlayerSet:everybody() | Constructs a new set with mode Deny that contains all players |
PlayerSet:new(mode[, players]) | Constructs a new set with given mode and array of players to use as individuals |
PlayerSet:cleanup() | Releases all used resources |
PlayerSet:setMode(newMode) | Change the inclusion/exclusion mode of the set. |
PlayerSet:contains(player) | Returns whether the given player is in the set |
PlayerSet:include(player) | For Allow sets, includes the given player as contained with the set |
PlayerSet:includeAll(players) | For Allow sets, includes all the players given in the array as contained with the set |
PlayerSet:exclude(player) | For Deny sets, excludes the given player as not contained with the set |
PlayerSet:excludeAll(players) | For Deny sets, excludes all the players given in the array as not contained with the set |
PlayerSet:reset() | Resets the individuals on the set so that no players are included/excluded |
PlayerSet:copyFrom(otherPlayerSet) | Copies the configuration of another PlayerSet |
PlayerSet:getPresent() | Returns an array of players currently connected to the server who are contained in the set |
Methods
- PlayerSet:nobody()
-
Constructs a new set with mode
Allow
that contains no players - PlayerSet:everybody()
-
Constructs a new set with mode
Deny
that contains all players - PlayerSet:new(mode[, players])
-
Constructs a new set with given mode and array of players to use as individuals
Parameters:
- mode
Either
Allow
orDeny
- players
An array of players to include/exclude based on
mode
(optional)
- mode
Either
- PlayerSet:cleanup()
- Releases all used resources
- PlayerSet:setMode(newMode)
-
Change the inclusion/exclusion mode of the set.
By changing this, you effectively invert the player set.
Parameters:
- newMode
Either
Allow
orDeny
- newMode
Either
- PlayerSet:contains(player)
-
Returns whether the given player is in the set
Parameters:
- player A player to query
Returns:
-
boolean
Whether the player is contained in the set
- PlayerSet:include(player)
-
For
Allow
sets, includes the given player as contained with the setParameters:
- player The player to include
- PlayerSet:includeAll(players)
-
For
Allow
sets, includes all the players given in the array as contained with the setParameters:
- players Array of players to include
- PlayerSet:exclude(player)
-
For
Deny
sets, excludes the given player as not contained with the setParameters:
- player The player to include
- PlayerSet:excludeAll(players)
-
For
Deny
sets, excludes all the players given in the array as not contained with the setParameters:
- players Array of players to include
- PlayerSet:reset()
- Resets the individuals on the set so that no players are included/excluded
- PlayerSet:copyFrom(otherPlayerSet)
-
Copies the configuration of another PlayerSet
Parameters:
- otherPlayerSet PlayerSet The set to copy configuration from
- PlayerSet:getPresent()
-
Returns an array of players currently connected to the server who are contained in the set
Returns:
-
An array of players