How can I make a player execute a command using PlayerInteractEvent when tapping an iron ingot on the floor?
PHP: public function onUseItem(PlayerInteractEvent $event){ $player = $event->getPlayer(); $item = $event->getItem(); if($item->getId() == 256){ $this->getServer()->dispatchCommand($player, "command"); }} is it right ?
This will execute a command named 'Kohi' on the player interact? PHP: elseif ($item->getName() == C::BOLD . C::GREEN . "Kohi"){ $this->MainItems($player); $this->getServer()->dispatchCommand($player, "kohi"); }