-
Notifications
You must be signed in to change notification settings - Fork 22
Sessions
Class that manage sessions
$sessionmanager = $ranksystem->getSessionManager();Gets a session through its name.
$session = $sessionmanager->get("IvanCraft236");Get all sessions loaded in cache.
$sessions = $sessionmanager->getAll();Class that contains the data and administrate a player
Because the plugin works asynchronously, it is possible that the player's data has not been loaded at the time of obtaining the session. RankSystem starts loading the player's data during PreLogin, so it is likely that the data has already been loaded if the player has already conected.
In either case you can use the onInitialize function to be sure that what you want is executed once the session is initialized:
$session->onInitialize(function() {
// do something...
});Get the ranks of the session.
$ranks = $session->getRanks();Give a rank to the session.
$session->setRank($rank);Can you provide the time it will expire:
$session->setRank($rank, time() + 60); // rank will expire in a minuteYou can provide a Rank or string argument.
if ($session->hasRank($rank)) {
// do something...
}
// or
if ($session->hasRank("YouTuber")) {
// do something...
}Get the permissions of the session.
$permissions = $session->getPermissions();Give a permission to the session.
$session->setPermission("example.perm");Can you provide the time it will expire:
$session->setPermission("example.perm", time() + 60); // permission will expire in a minuteYou should provide a string argument.
if ($session->hasPermission("example.perm")) {
// do something...
}