◆ __construct()
- Parameters
-
50 $this->opable = $opable;
51 if($opable instanceof Permissible){
52 $this->parent = $opable;
◆ __destruct()
◆ addAttachment()
addAttachment |
( |
Plugin |
$plugin, |
|
|
|
$name = null , |
|
|
|
$value = null |
|
) |
| |
//TODO: tick scheduled attachments
- Parameters
-
Plugin | $plugin | |
string | $name | |
bool | $value | |
- Returns
- PermissionAttachment
- Exceptions
-
Implements Permissible.
130 if($plugin === null){
131 throw new PluginException(
"Plugin cannot be null");
132 }elseif(!$plugin->isEnabled()){
133 throw new PluginException(
"Plugin " . $plugin->getDescription()->getName() .
" is disabled");
136 $result =
new PermissionAttachment($plugin, $this->parent !== null ? $this->parent : $this);
137 $this->attachments[spl_object_hash($result)] = $result;
138 if($name !== null and $value !== null){
139 $result->setPermission($name, $value);
◆ clearPermissions()
191 foreach(array_keys($this->permissions) as $name){
192 Server::getInstance()->getPluginManager()->unsubscribeFromPermission($name, $this->parent !== null ? $this->parent : $this);
195 Server::getInstance()->getPluginManager()->unsubscribeFromDefaultPerms(
false, $this->parent !== null ? $this->parent : $this);
196 Server::getInstance()->getPluginManager()->unsubscribeFromDefaultPerms(
true, $this->parent !== null ? $this->parent : $this);
198 $this->permissions = [];
◆ getEffectivePermissions()
getEffectivePermissions |
( |
| ) |
|
◆ hasPermission()
- Parameters
-
- Returns
- bool
Implements Permissible.
100 if($name instanceof Permission){
101 $name = $name->getName();
105 return $this->permissions[$name]->getValue();
109 $perm = $perm->getDefault();
◆ isOp()
- Returns
- bool
Implements ServerOperator.
65 if($this->opable === null){
68 return $this->opable->isOp();
◆ isPermissionSet()
- Parameters
-
- Returns
- bool
Implements Permissible.
91 return isset($this->permissions[$name instanceof Permission ? $name->getName() : $name]);
◆ recalculatePermissions()
recalculatePermissions |
( |
| ) |
|
- Returns
- void
Implements Permissible.
174 Server::getInstance()->getPluginManager()->subscribeToDefaultPerms($this->
isOp(), $this->parent !== null ? $this->parent : $this);
176 foreach($defaults as $perm){
177 $name = $perm->getName();
178 $this->permissions[$name] =
new PermissionAttachmentInfo($this->parent !== null ? $this->parent : $this, $name, null,
true);
179 Server::getInstance()->getPluginManager()->subscribeToPermission($name, $this->parent !== null ? $this->parent : $this);
180 $this->calculateChildPermissions($perm->getChildren(),
false, null);
183 foreach($this->attachments as $attachment){
184 $this->calculateChildPermissions($attachment->getPermissions(),
false, $attachment);
◆ removeAttachment()
- Parameters
-
- Exceptions
-
Implements Permissible.
153 if($attachment === null){
154 throw new \InvalidStateException(
"Attachment cannot be null");
157 if(isset($this->attachments[spl_object_hash($attachment)])){
158 unset($this->attachments[spl_object_hash($attachment)]);
159 if(($ex = $attachment->getRemovalCallback()) !== null){
160 $ex->attachmentRemoved($attachment);
◆ setOp()
- Parameters
-
- Exceptions
-
Implements ServerOperator.
78 if($this->opable === null){
79 throw new \LogicException(
"Cannot change op value as no ServerOperator is set");
81 $this->opable->setOp($value);
The documentation for this class was generated from the following file:
- src/pocketmine/permission/PermissibleBase.php