For example, if you want to cancel between x: 100, y: 5, z: 100 and x: 300, y: 50, z: 300 PHP: public function Place(BlockPlaceEvent $event){ $x = $event->getPlayer()->x; $y = $event->getPlayer()->y; $z = $event->getPlayer()->z; $x1 = max("100","300"); $y1 = max("5","50"); $z1 = max("100","300"); $x2 = min("100","300"); $y2 = min("5","50"); $z2 = min("100","300"); if(!($x2 <= $x && $x <= $x1 && $y2 <= $y && $y <= $y1 && $z2 <= $z && $z <= $z1)){ $event->setCancelled(); }}
Do this, <?php //cancel place Blocks namespace Main; use pocketmine\plugin\PluginBase; use pocketmine\event\Listener; use pocketmine\event\block\BlockPlaceEvent; class Main extends PluginBase implements Listener { public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); } public function onBlockPlace(BlockPlaceEvent $event){ $event->setCancelled(true); } }
I don't know why would you use min and max if you know the values. Also, why do you write the numbers in quotes?