mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 03:51:37 +00:00
Implemented a better method for detecting permission recalculation
this allows anyone to listen to permissions being recalculated, which is useful for stuff like broadcast channel subscriptions.
This commit is contained in:
@@ -250,6 +250,16 @@ class NetworkSession{
|
||||
$effectManager->getEffectAddHooks()->remove($effectAddHook);
|
||||
$effectManager->getEffectRemoveHooks()->remove($effectRemoveHook);
|
||||
});
|
||||
|
||||
$permissionHooks = $this->player->getPermissionRecalculationCallbacks();
|
||||
$permissionHooks->add($permHook = function() : void{
|
||||
$this->logger->debug("Syncing available commands and adventure settings due to permission recalculation");
|
||||
$this->syncAdventureSettings($this->player);
|
||||
$this->syncAvailableCommands();
|
||||
});
|
||||
$this->disposeHooks->add(static function() use ($permissionHooks, $permHook) : void{
|
||||
$permissionHooks->remove($permHook);
|
||||
});
|
||||
}
|
||||
|
||||
public function getPlayer() : ?Player{
|
||||
|
Reference in New Issue
Block a user