hey , am trying to make a Sign Shop plugin but i don't know how to tap the sign and get the item, i know i have to use PlayerInteractEvent for the tap on the sign but i just don't know how , I've looked throw EconomyShop and sell but noting , just hard to read as a beginner.
You could listen for PlayerInteractEvent, and check if the target block is a sign. Then you can get the block and tile if needed to get the transaction information. For example, you could get the Sign tile and see if the first line is "[Shop]" or something like that to know if it is a shop sign.
Something like this might do the trick: PHP: //PlayerInteractEvent $event if($event->getBlock()->getId() === Block::WALL_SIGN || $event->getBlock()->getId() === Block::SIGN_POST) { $tile = $event->getBlock()->getLevel()->getTile($event->getBlock()); if($tile instanceof \pocketmine\tile\Sign) { $line1 = $tile->getText()[0]; if($line1 === "[SHOP]") { } } } You could also save the block's coordinates and compare them when the sign is tapped for added security.
i know this is off topic 100% but to get the item in hand name is PHP: $item->getInventory()->getItemInHand()->getCustomName();
PHP: $player->getInventory()->getItemInHand()->getCustomName(); You need Player instance not Item instance.