PHP: public function onBreak(BlockBreakEvent $event) : void{ $x1 = -144; $x2 = 69.8795; $y1 = 0; $y2 = 125.1111; $z1 = 70; $z2 = -140.3012; $player = $event->getPlayer(); $block = $event->getBlock(); if(!$player->isOp()){ if($block->getLevel()->getName() == $this->plugin->getServer()->getLevelByName("world")){ if($block->getX() >= -144 and $block->getX() <= 69.8795 and $block->getX() >= -144 and $block->getZ() >= 70 and $block->getZ() <= -140.3012){ $player->sendPopup(C::RED . "You can't build in spawn."); $event->setCancelled(true); } } } } No Eror
1.In PHP you don't need ": void" if the method returns nothing. 2.You are comparing a level name to a level instance. 3.You don't use the variables you've defined. 4.You compare the block's x to your values 3 times and don't compare it's y to anything at all.
Don't need ≠ need to remove. It is a good practice to have void return type. Whybare you complaining?
Hm, I didn't know that. That is about the void return type in PHP. I thought it may cause some runtime errors. Sorry.
I understand it, I just didn't know about this exact return type and thought OP has mixed it in from some other language he may use.