/**
  * @param Permission $perm
  * @param Permission $parent
  *
  * @return Permission
  */
 public static function registerPermission(Permission $perm, Permission $parent = null)
 {
     if ($parent instanceof Permission) {
         $parent->getChildren()[$perm->getName()] = true;
         return self::registerPermission($perm);
     }
     Server::getInstance()->getPluginManager()->addPermission($perm);
     return Server::getInstance()->getPluginManager()->getPermission($perm->getName());
 }
 /**
  * @param Permission|string $name
  *
  * @return bool
  */
 public function isPermissionSet($name)
 {
     return isset($this->permissions[$name instanceof Permission ? $name->getName() : $name]);
 }
Example #3
0
 /**
  * @param Permission $permission
  */
 private function calculatePermissionDefault(Permission $permission)
 {
     Timings::$permissionDefaultTimer->startTiming();
     if ($permission->getDefault() === Permission::DEFAULT_OP or $permission->getDefault() === Permission::DEFAULT_TRUE) {
         $this->defaultPermsOp[$permission->getName()] = $permission;
         $this->dirtyPermissibles(true);
     }
     if ($permission->getDefault() === Permission::DEFAULT_NOT_OP or $permission->getDefault() === Permission::DEFAULT_TRUE) {
         $this->defaultPerms[$permission->getName()] = $permission;
         $this->dirtyPermissibles(false);
     }
     Timings::$permissionDefaultTimer->startTiming();
 }