mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
PermissibleBase: simplify diff calculation
This commit is contained in:
parent
506e76917e
commit
c5e12bb11f
@ -162,13 +162,11 @@ class PermissibleBase implements Permissible{
|
|||||||
if(!isset($oldPermissions[$name])){
|
if(!isset($oldPermissions[$name])){
|
||||||
$diff[$name] = false;
|
$diff[$name] = false;
|
||||||
}elseif($oldPermissions[$name]->getValue() !== $permissionAttachmentInfo->getValue()){
|
}elseif($oldPermissions[$name]->getValue() !== $permissionAttachmentInfo->getValue()){
|
||||||
//permission was previously unset OR the value of the permission changed
|
continue;
|
||||||
//we don't care who assigned the permission, only that the result is different
|
|
||||||
$diff[$name] = $oldPermissions[$name]->getValue();
|
|
||||||
}
|
}
|
||||||
unset($oldPermissions[$name]);
|
unset($oldPermissions[$name]);
|
||||||
}
|
}
|
||||||
//oldPermissions now only contains permissions that are no longer set after recalculation
|
//oldPermissions now only contains permissions that changed or are no longer set
|
||||||
foreach($oldPermissions as $permissionAttachmentInfo){
|
foreach($oldPermissions as $permissionAttachmentInfo){
|
||||||
$diff[$permissionAttachmentInfo->getPermission()] = $permissionAttachmentInfo->getValue();
|
$diff[$permissionAttachmentInfo->getPermission()] = $permissionAttachmentInfo->getValue();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user