Define area. If point is inside the area, cancel damage and block place/break event. You might be interested in this: Falkirks/MineReset (Cuboid Area (Just a box))
Please put some of your own effort in research. But here you go more pointers: https://math.stackexchange.com/ques...-point-is-inside-a-rectangular-shaped-area-3d https://www.gamedev.net/forums/topic/625280-point-inside-3d-rectangle/ http://mathcentral.uregina.ca/QQ/database/QQ.09.10/h/ali1.html
Say, You have an area with coordinates; Minimum Z: 1 Maximum Z: 5 Minimum X: 10 Maximum X: 50 Create a class, named as you like, containing the coordinates information. In this case: PHP: <?phpnamespace test;use pocketmine\Player;class Areas { public function inArea(Player $player) : bool { // Get player X and Y coordinates. $x = $player->x; $z = $player->z; // Define Minimum and Maximum X and Z. $x_min = 10; $x_max = 50; $z_min = 1; $z_max = 5; // Check if Player is within the Area. if ($x > $x_min && $x < $x_max && $z > $z_min && $z < $z_max) return true; return false; }} Now that we have Areas.php ready, Let's try and call it: PHP: <?phpnamespace test;use pocketmine\event\Listener;use pocketmine\event\player\PlayerMoveEvent;use pocketmine\plugin\PluginBase;class main extends PluginBase implements Listener { public function onMove(PlayerMoveEvent $event) { if (Areas::class->inArea($event->getPlayer())) { // Do stuff } }}