PHP: public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this,$this); } public function onPlace(BlockPlaceEvent $event){ $block = $event->getBlock(); $pos = $block->add(0, 1); if(($block->getId() === Block::GLASS) && ($block->getLevel()->getBlock($pos)->getId() === Block::AIR)) { $this->getScheduler()->scheduleRepeatingTask(new sandTask($this), 10); $block->getLevel()->setBlock($pos, Block::get(Block::SAND)); }} Code: class sandTask extends Task{ private $owner; public function __construct(ABC $owner){ } public function onRun($currentTick){ }//onRun }//task When I use This code, it works but only one time repeat. How can I make work everytime?
WHY WHY and more important W H Y. Why people copy peaces of code past them without understanding it and pretend them to work... The problem is that in the task nothing is running so the block get placed only one time, also notice that if you want to break the sand you have no time to do it (if the code works obviusly)
Go learn php from basics. Merging code from pmmp forums won't help you with learning. This way isn't the good one... If I were pmmp admin, I would already warned (or banned) you for those shi* posts.
Sorry, I know that here is Good Explains but Actually English is not my one's native language. I learn english a little and I pretty use a translator. So I can't understand well examples in this forums. And have little place to learn. So I post many times. Even In my country, there are a handful of people that makes pmmp plugins. and they don't tell well like this forum people..
If I can ask what's your native language. The poin in your code is that you have to do the set block in the task BUT GO SEE MY other answer: https://forums.pmmp.io/posts/69744/