some improvements to the horrendous mess that is the handling of joining and quitting, fixed some crashes, probably caused some other crashes

I can't fix this completely because it's just too much of a fucking mess. NEED to separate network stuff from Player.
This commit is contained in:
Dylan K. Taylor
2017-03-30 19:33:47 +01:00
parent 45e5b6b04c
commit 69ac80518c
4 changed files with 64 additions and 57 deletions

View File

@ -188,12 +188,13 @@ class PermissibleBase implements Permissible{
}
public function clearPermissions(){
$pluginManager = Server::getInstance()->getPluginManager();
foreach(array_keys($this->permissions) as $name){
Server::getInstance()->getPluginManager()->unsubscribeFromPermission($name, $this->parent !== null ? $this->parent : $this);
$pluginManager->unsubscribeFromPermission($name, $this->parent ?? $this);
}
Server::getInstance()->getPluginManager()->unsubscribeFromDefaultPerms(false, $this->parent !== null ? $this->parent : $this);
Server::getInstance()->getPluginManager()->unsubscribeFromDefaultPerms(true, $this->parent !== null ? $this->parent : $this);
$pluginManager->unsubscribeFromDefaultPerms(false, $this->parent ?? $this);
$pluginManager->unsubscribeFromDefaultPerms(true, $this->parent ?? $this);
$this->permissions = [];
}