public addAttachment ( pocketmine\plugin\Plugin $plugin, string $name = null, boolean $value = null ) : |
||
$plugin | pocketmine\plugin\Plugin | |
$name | string | |
$value | boolean | |
return |
public function addAttachment(Plugin $plugin, $name = null, $value = null)
{
if ($plugin === null) {
throw new PluginException("Plugin cannot be null");
} elseif (!$plugin->isEnabled()) {
throw new PluginException("Plugin " . $plugin->getDescription()->getName() . " is disabled");
}
$result = new PermissionAttachment($plugin, $this->parent !== null ? $this->parent : $this);
$this->attachments[spl_object_hash($result)] = $result;
if ($name !== null and $value !== null) {
$result->setPermission($name, $value);
}
$this->recalculatePermissions();
return $result;
}
/** * @param Plugin $plugin * @param string $name * @param bool $value * * @return permission\PermissionAttachment */ public function addAttachment(Plugin $plugin, $name = null, $value = null) { return $this->perm->addAttachment($plugin, $name, $value); }