diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 5ef2da305..78b091cc7 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2164,10 +2164,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $target = $this->level->getBlock($pos); $ev = new PlayerInteractEvent($this, $this->inventory->getItemInHand(), $target, null, $face, PlayerInteractEvent::LEFT_CLICK_BLOCK); - if($this->level->checkSpawnProtection($this, $target)){ - $ev->setCancelled(); - } - $ev->call(); if($ev->isCancelled()){ $this->inventory->sendHeldItem($this); @@ -2462,7 +2458,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $this->doCloseInventory(); $pos = new Vector3($packet->x, $packet->y, $packet->z); - if($pos->distanceSquared($this) > 10000 or $this->level->checkSpawnProtection($this, $pos)){ + if($pos->distanceSquared($this) > 10000){ return true; } @@ -2487,7 +2483,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ if($tile instanceof ItemFrame){ //TODO: use facing blockstate property instead of damage value $ev = new PlayerInteractEvent($this, $this->inventory->getItemInHand(), $tile->getBlock(), null, 5 - $tile->getBlock()->getDamage(), PlayerInteractEvent::LEFT_CLICK_BLOCK); - if($this->isSpectator() or $this->level->checkSpawnProtection($this, $tile)){ + if($this->isSpectator()){ $ev->setCancelled(); } diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 2ba02af18..2104298ea 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -455,13 +455,6 @@ class Server{ return $this->getConfigBool("white-list", false); } - /** - * @return int - */ - public function getSpawnRadius() : int{ - return $this->getConfigInt("spawn-protection", 16); - } - /** * @return bool */ @@ -1070,7 +1063,6 @@ class Server{ "server-port" => 19132, "white-list" => false, "announce-player-achievements" => true, - "spawn-protection" => 16, "max-players" => 20, "gamemode" => 0, "force-gamemode" => false, diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 74104039b..beb1c68e3 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -63,7 +63,6 @@ use pocketmine\level\particle\DestroyBlockParticle; use pocketmine\level\particle\Particle; use pocketmine\level\sound\Sound; use pocketmine\math\AxisAlignedBB; -use pocketmine\math\Vector2; use pocketmine\math\Vector3; use pocketmine\metadata\BlockMetadataStore; use pocketmine\metadata\Metadatable; @@ -1623,29 +1622,6 @@ class Level implements ChunkManager, Metadatable{ return $orbs; } - /** - * Checks if the level spawn protection radius will prevent the player from using items or building at the specified - * Vector3 position. - * - * @param Player $player - * @param Vector3 $vector - * - * @return bool true if spawn protection cancelled the action, false if not. - */ - public function checkSpawnProtection(Player $player, Vector3 $vector) : bool{ - if(!$player->hasPermission("pocketmine.spawnprotect.bypass") and ($distance = $this->server->getSpawnRadius()) > -1){ - $t = new Vector2($vector->x, $vector->z); - - $spawnLocation = $this->getSpawnLocation(); - $s = new Vector2($spawnLocation->x, $spawnLocation->z); - if($t->distance($s) <= $distance){ - return true; - } - } - - return false; - } - /** * Tries to break a block using a item, including Player time checks if available * It'll try to lower the durability if Item is a tool, and set it to Air if broken. @@ -1680,8 +1656,6 @@ class Level implements ChunkManager, Metadatable{ if(($player->isSurvival() and !$target->isBreakable($item)) or $player->isSpectator()){ $ev->setCancelled(); - }elseif($this->checkSpawnProtection($player, $target)){ - $ev->setCancelled(); //set it to cancelled so plugins can bypass this } if($player->isAdventure(true) and !$ev->isCancelled()){ @@ -1788,10 +1762,6 @@ class Level implements ChunkManager, Metadatable{ if($player !== null){ $ev = new PlayerInteractEvent($player, $item, $blockClicked, $clickVector, $face, PlayerInteractEvent::RIGHT_CLICK_BLOCK); - if($this->checkSpawnProtection($player, $blockClicked)){ - $ev->setCancelled(); //set it to cancelled so plugins can bypass this - } - $ev->call(); if(!$ev->isCancelled()){ if(!$player->isSneaking() and $blockClicked->onActivate($item, $player)){ @@ -1842,10 +1812,6 @@ class Level implements ChunkManager, Metadatable{ if($player !== null){ $ev = new BlockPlaceEvent($player, $hand, $blockReplace, $blockClicked, $item); - if($this->checkSpawnProtection($player, $blockClicked)){ - $ev->setCancelled(); - } - if($player->isAdventure(true) and !$ev->isCancelled()){ $canPlace = false; $tag = $item->getNamedTagEntry("CanPlaceOn"); diff --git a/src/pocketmine/permission/DefaultPermissions.php b/src/pocketmine/permission/DefaultPermissions.php index 5529d5adf..08a795de1 100644 --- a/src/pocketmine/permission/DefaultPermissions.php +++ b/src/pocketmine/permission/DefaultPermissions.php @@ -51,9 +51,6 @@ abstract class DefaultPermissions{ self::registerPermission(new Permission(self::ROOT . ".broadcast.user", "Allows the user to receive user broadcasts", Permission::DEFAULT_TRUE), $broadcasts); $broadcasts->recalculatePermissibles(); - $spawnprotect = self::registerPermission(new Permission(self::ROOT . ".spawnprotect.bypass", "Allows the user to edit blocks within the protected spawn radius", Permission::DEFAULT_OP), $parent); - $spawnprotect->recalculatePermissibles(); - $commands = self::registerPermission(new Permission(self::ROOT . ".command", "Allows using all PocketMine commands"), $parent); $whitelist = self::registerPermission(new Permission(self::ROOT . ".command.whitelist", "Allows the user to modify the server whitelist", Permission::DEFAULT_OP), $commands); diff --git a/src/pocketmine/wizard/SetupWizard.php b/src/pocketmine/wizard/SetupWizard.php index af2356aa8..c80b09ce4 100644 --- a/src/pocketmine/wizard/SetupWizard.php +++ b/src/pocketmine/wizard/SetupWizard.php @@ -158,14 +158,6 @@ LICENSE; $config->set("max-players", (int) $this->getInput($this->lang->get("max_players"), (string) self::DEFAULT_PLAYERS)); - $this->message($this->lang->get("spawn_protection_info")); - - if(strtolower($this->getInput($this->lang->get("spawn_protection"), "y", "Y/n")) === "n"){ - $config->set("spawn-protection", -1); - }else{ - $config->set("spawn-protection", 16); - } - $config->save(); }