I would like know how to make a player just can break a specific block? Like in a minigame can break just TNT but no others block, thanks
You would need to handle BlockBreakEvent, which is fired when a block is broken by a player. Then check if the block is a TNT block. If it is, allow the player to break it. If it is not, cancel the event.
I don't tested. PHP: public function onBreak(BlockBreakEvent $event){ if(!$event->getBlock()->getID() == 46){ $player = $event->getPlayer(); $player->sendMessage("You can't break this block!"); }}
Why use !() and == if you can use !=? And why you store $event->getPlayer() if you only use it one time?