The Sign is A tile so make a little search in pmmp files and you can see https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/tile/Sign.php#L120-L125 PHP: //Check if the block is an instanceof Sign$tile = $player->getLevel()->getTile($block);if($tile instanceof Sign){//$text is an array of wht is written in the sign$text= $tile->getText();//$line1 contain what is written in the first line of a sign$line1= $tile->getLine(0)if($line1== "[BUY]"){#Your code
Depends of what event are you using.... $block is a block....... If you want to know what is block i think you did not try to search how to get the block In interact Event its $event->getBlock()
public function onInteract(PlayerInteractEvent $event){ $block = $event->getBlock(); $player = $event->getPlayer(); $tile = $player->getLevel()->getTile($block); if($tile instanceof Sign){ $text = $tile->getText(); $line1 = $tile->getLine(0); if($line1 == "[Buy]") { $player->sendMessage("Dont hit this Sign!"); } } } }
If you dont know there are "[PHP ]" And Send the code entirelly maybe you didt register the Event Or Your "Sign" is an instance of blocks(pocketmine/block/Sign) not an instance of pocketmine/tile/Sign