diff --git a/src/pocketmine/plugin/PluginManager.php b/src/pocketmine/plugin/PluginManager.php index 202c472a8..2f042d35a 100644 --- a/src/pocketmine/plugin/PluginManager.php +++ b/src/pocketmine/plugin/PluginManager.php @@ -500,23 +500,7 @@ class PluginManager{ * @return array|Permissible[] */ public function getPermissionSubscriptions(string $permission) : array{ - if(isset($this->permSubs[$permission])){ - return $this->permSubs[$permission]; - $subs = []; - foreach($this->permSubs[$permission] as $k => $perm){ - /** @var \WeakRef $perm */ - if($perm->acquire()){ - $subs[] = $perm->get(); - $perm->release(); - }else{ - unset($this->permSubs[$permission][$k]); - } - } - - return $subs; - } - - return []; + return $this->permSubs[$permission] ?? []; } /** @@ -549,33 +533,11 @@ class PluginManager{ * @return Permissible[] */ public function getDefaultPermSubscriptions(bool $op) : array{ - $subs = []; - if($op === true){ return $this->defSubsOp; - foreach($this->defSubsOp as $k => $perm){ - /** @var \WeakRef $perm */ - if($perm->acquire()){ - $subs[] = $perm->get(); - $perm->release(); - }else{ - unset($this->defSubsOp[$k]); - } - } - }else{ - return $this->defSubs; - foreach($this->defSubs as $k => $perm){ - /** @var \WeakRef $perm */ - if($perm->acquire()){ - $subs[] = $perm->get(); - $perm->release(); - }else{ - unset($this->defSubs[$k]); - } - } } - return $subs; + return $this->defSubs; } /**