pocketmine\Player::addAttachment PHP Method

addAttachment() public method

public addAttachment ( pocketmine\plugin\Plugin $plugin, string $name = null, boolean $value = null ) : PermissionAttachment
$plugin pocketmine\plugin\Plugin
$name string
$value boolean
return pocketmine\permission\PermissionAttachment
    public function addAttachment(Plugin $plugin, $name = null, $value = null)
    {
        if ($this->perm == null) {
            return false;
        }
        return $this->perm->addAttachment($plugin, $name, $value);
    }

Usage Example

 /**
  * @param Player $player
  * @return mixed
  */
 public function getAttachment(Player $player)
 {
     if (!isset($this->attachments[$player->getName()])) {
         $this->attachments[$player->getName()] = $player->addAttachment($this);
     }
     return $this->attachments[$player->getName()];
 }
All Usage Examples Of pocketmine\Player::addAttachment
Player