Hey does anyone know how to get a block which a custom name example a chest which has a custom name called "hai" and when placing it it sends a message but if it's a normal chest it doesn't do anything. I want it to be on the function BlockBreakEvent.
PHP: Public function onPlace (Blockplaceevent $ev){ $player = $ev->getPlayer(); $hand = $player->getInventory()->getItemInHand(); If($hand->getId() == 54){ If ($hand->getCustomName() === "hai"){ $player->sendMessage("hai"); } }}
PHP: Public function onPlace (Blockplaceevent $ev) { $hand = $ev->getPlayer()->getInventory()->getItemInHand(); if($hand->getId() === Block::CHEST and $hand->getName() === "hai") { $player->sendMessage("hai"); }}