I want to make a one block survival plugin, where if a player destroys a block at certain coordinates , a random block will appear where the block was broken. My question: how to get player break block at certain cordinates and setblock where the block was broken (like one block survival) sorry with my english, I'm not really able to speak English perfectly
1. Specify the location of the block PHP: private $theBlock = new Vector3(x, y, z); 2. Make pre-defined list of "random" blocks. You don't want to replace it with lava for instance. PHP: const BLOCK_LIST = [ BlockIds::STONE, BlockIds::DIRT, BlockIds::DIAMOND_BLOCK // etc. ...] 3. Listen for block break event (Remember to register the listener, search it up. PluginManager::registerEvents()) PHP: public function onBlockBreak(BlockBreakEvent $event) { // Check if the block broken was the "special" one if($event->getBlock()->asVector3()->equals($this->theBlock)) { // Cancel the event $event->setCancelled(true); // 3.1 Break the block // 3.2 Give player the drops // 3.3 Replace the block, with random one from the list }} Not much of a code to see, but I hope this points you in the right direction. You might face a problem if the server gets too laggy. Make sure you prevent them from falling through the block.