pocketmine\entity\Attribute::getAttribute PHP Method

getAttribute() public static method

public static getAttribute ( $id ) : null | Attribute
$id
return null | Attribute
    public static function getAttribute($id)
    {
        return isset(self::$attributes[$id]) ? clone self::$attributes[$id] : null;
    }

Usage Example

Example #1
0
 public function setMaxHealth($amount)
 {
     if (is_null($this->attributeMap->getAttribute(Attribute::HEALTH))) {
         $this->attributeMap->addAttribute(Attribute::getAttribute(Attribute::HEALTH));
     }
     $this->attributeMap->getAttribute(Attribute::HEALTH)->setMaxValue($amount);
 }
All Usage Examples Of pocketmine\entity\Attribute::getAttribute