Skip to content

PlayerItemEnchantEvent ​

class · pocketmine\event\player\PlayerItemEnchantEvent · source

Extends PlayerEvent
Implements Cancellable

Called when a player enchants an item using an enchanting table.

Methods ​

__construct() ​

php
public function __construct(\pocketmine\player\Player $player, \pocketmine\inventory\transaction\EnchantingTransaction $transaction, \pocketmine\item\enchantment\EnchantingOption $option, \pocketmine\item\Item $inputItem, \pocketmine\item\Item $outputItem, int $cost)

getCost() ​

php
public function getCost() : int

Returns the number of XP levels and lapis that will be subtracted after enchanting if the player is not in creative mode.

getInputItem() ​

php
public function getInputItem() : \pocketmine\item\Item

Returns the item to be enchanted.

getOption() ​

php
public function getOption() : \pocketmine\item\enchantment\EnchantingOption

Returns the enchantment option used.

getOutputItem() ​

php
public function getOutputItem() : \pocketmine\item\Item

Returns the enchanted item.

getTransaction() ​

php
public function getTransaction() : \pocketmine\inventory\transaction\EnchantingTransaction

Returns the inventory transaction involved in this enchant event.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.