mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 22:15:30 +00:00
PermissionAttachmentInfo no longer references Permissible
since the only way to obtain PermissionAttachmentInfo via the API is from the Permissible API, it makes zero sense to ask the attachmentinfo for its permissible, since we obviously already had it to be able to get the info in the first place. Therefore, this is just another useless reference stopping Permissibles from being garbage-collected.
This commit is contained in:
parent
d48af3f4ca
commit
d602547941
@ -140,7 +140,7 @@ class PermissibleBase implements Permissible{
|
||||
if($perm === null){
|
||||
throw new \InvalidStateException("Unregistered root permission $name");
|
||||
}
|
||||
$this->permissions[$name] = new PermissionAttachmentInfo($this->getRootPermissible(), $name, null, $isGranted);
|
||||
$this->permissions[$name] = new PermissionAttachmentInfo($name, null, $isGranted);
|
||||
$permManager->subscribeToPermission($name, $this->getRootPermissible());
|
||||
$this->calculateChildPermissions($perm->getChildren(), false, null);
|
||||
}
|
||||
@ -166,7 +166,7 @@ class PermissibleBase implements Permissible{
|
||||
foreach($children as $name => $v){
|
||||
$perm = $permManager->getPermission($name);
|
||||
$value = ($v xor $invert);
|
||||
$this->permissions[$name] = new PermissionAttachmentInfo($this->getRootPermissible(), $name, $attachment, $value);
|
||||
$this->permissions[$name] = new PermissionAttachmentInfo($name, $attachment, $value);
|
||||
$permManager->subscribeToPermission($name, $this->getRootPermissible());
|
||||
|
||||
if($perm instanceof Permission){
|
||||
|
@ -24,9 +24,6 @@ declare(strict_types=1);
|
||||
namespace pocketmine\permission;
|
||||
|
||||
class PermissionAttachmentInfo{
|
||||
/** @var Permissible */
|
||||
private $permissible;
|
||||
|
||||
/** @var string */
|
||||
private $permission;
|
||||
|
||||
@ -36,17 +33,12 @@ class PermissionAttachmentInfo{
|
||||
/** @var bool */
|
||||
private $value;
|
||||
|
||||
public function __construct(Permissible $permissible, string $permission, ?PermissionAttachment $attachment, bool $value){
|
||||
$this->permissible = $permissible;
|
||||
public function __construct(string $permission, ?PermissionAttachment $attachment, bool $value){
|
||||
$this->permission = $permission;
|
||||
$this->attachment = $attachment;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function getPermissible() : Permissible{
|
||||
return $this->permissible;
|
||||
}
|
||||
|
||||
public function getPermission() : string{
|
||||
return $this->permission;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user