ItemEnchantmentHandlingTrait
This trait encapsulates all enchantment handling needed for itemstacks. The primary purpose of this trait is providing scope isolation for the methods it contains.
Properties
$enchantments protected
php
protected array $enchantmentsMethods
addEnchantment()
php
public function addEnchantment(\pocketmine\item\enchantment\EnchantmentInstance $enchantment) : selfgetEnchantment()
php
public function getEnchantment(\pocketmine\item\enchantment\Enchantment $enchantment) : ?\pocketmine\item\enchantment\EnchantmentInstancegetEnchantmentLevel()
php
public function getEnchantmentLevel(\pocketmine\item\enchantment\Enchantment $enchantment) : intReturns the level of the enchantment on this item with the specified ID, or 0 if the item does not have the enchantment.
getEnchantments()
php
public function getEnchantments() : arrayhasEnchantment()
php
public function hasEnchantment(\pocketmine\item\enchantment\Enchantment $enchantment, int $level = -1) : boolhasEnchantments()
php
public function hasEnchantments() : boolremoveEnchantment()
php
public function removeEnchantment(\pocketmine\item\enchantment\Enchantment $enchantment, int $level = -1) : selfremoveEnchantments()
php
public function removeEnchantments() : self