How do you do that after destroying Stone with a golden pick, you cancel the task of renewing? public function onBreak(BlockBreakEvent $event){ $blok = $event->getBlock(); $gracz = $event->getPlayer(); $y = $blok->getFloorY(); $x = $blok->getFloorX(); $z = $blok->getFloorZ(); if($blok->getId() == 1){ $task = new Task($this, $event->getBlock()->getFloorX(), $event->getBlock()->getFloorY(), $event->getBlock()->getFloorZ()); $this->getServer()->getScheduler()->scheduleDelayedTask($task, 30); } } } Task.php <?php namespace StoneFarm; use pocketmine\block\Block; use pocketmine\block\Air; use pocketmine\block\Stone; use pocketmine\math\Vector3; use pocketmine\scheduler\PluginTask; class Task extends PluginTask{ private $z; private $y; private $x; private $gracz; public function __construct($gracz, $x, $y, $z){ parent::__construct($gracz); $this->x = $x; $this->y = $y; $this->z = $z; $this->gracz = $gracz; } public function onRun($currentTick){ $level = $this->gracz->getServer()->getLevelByName("world"); if($level->getBlock(new Vector3($this->x, $this->y, $this->z))->getId() == 0) { $level->setBlock(new Vector3($this->x, $this->y, $this->z), new Stone()); } } }
or do it for them, it's frankly quite easy PHP: <?phppublic function onBreak(BlockBreakEvent $event){$blok = $event->getBlock();$gracz = $event->getPlayer();$y = $blok->getFloorY();$x = $blok->getFloorX();$z = $blok->getFloorZ();if($blok->getId() == 1){$task = new Task($this, $event->getBlock()->getFloorX(), $event->getBlock()->getFloorY(), $event->getBlock()->getFloorZ());$this->getServer()->getScheduler()->scheduleDelayedTask($task, 30);}}}//Task.php<?phpnamespace StoneFarm;use pocketmine\block\Block;use pocketmine\block\Air;use pocketmine\block\Stone;use pocketmine\math\Vector3;use pocketmine\scheduler\PluginTask;class Task extends PluginTask{private $z;private $y;private $x;private $gracz;public function __construct($gracz, $x, $y, $z){parent::__construct($gracz);$this->x = $x;$this->y = $y;$this->z = $z;$this->gracz = $gracz;}public function onRun($currentTick){$level = $this->gracz->getServer()->getLevelByName("world");if($level->getBlock(new Vector3($this->x, $this->y, $this->z))->getId() == 0) {$level->setBlock(new Vector3($this->x, $this->y, $this->z), new Stone());}}} there done!