diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 0d0b464b0..62d3cdbe1 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -201,7 +201,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ public $spawned = false; public $loggedIn = false; public $gamemode; - public $lastBreak; /** @var bool */ protected $authenticated = false; /** @var string */ @@ -280,7 +279,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ protected $flying = false; protected $allowMovementCheats = false; - protected $allowInstaBreak = false; private $needACK = []; @@ -439,14 +437,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $this->allowMovementCheats = $value; } - public function allowInstaBreak() : bool{ - return $this->allowInstaBreak; - } - - public function setAllowInstaBreak(bool $value = true){ - $this->allowInstaBreak = $value; - } - /** * @param Player $player */ @@ -695,7 +685,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $this->perm = new PermissibleBase($this); $this->namedtag = new CompoundTag(); $this->server = Server::getInstance(); - $this->lastBreak = PHP_INT_MAX; $this->ip = $ip; $this->port = $port; $this->clientID = $clientID; @@ -712,7 +701,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $this->creationTime = microtime(true); $this->allowMovementCheats = (bool) $this->server->getProperty("player.anti-cheat.allow-movement-cheats", false); - $this->allowInstaBreak = (bool) $this->server->getProperty("player.anti-cheat.allow-instabreak", false); $this->sessionAdapter = new PlayerNetworkSessionAdapter($this->server, $this); } @@ -2588,7 +2576,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ switch($packet->action){ case PlayerActionPacket::ACTION_START_BREAK: - if($this->lastBreak !== PHP_INT_MAX or $pos->distanceSquared($this) > 10000){ + if($pos->distanceSquared($this) > 10000){ break; } @@ -2618,12 +2606,10 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $this->level->broadcastLevelEvent($pos, LevelEventPacket::EVENT_BLOCK_START_BREAK, (int) (65535 / $breakTime)); } } - $this->lastBreak = microtime(true); + break; - /** @noinspection PhpMissingBreakStatementInspection */ case PlayerActionPacket::ACTION_ABORT_BREAK: - $this->lastBreak = PHP_INT_MAX; case PlayerActionPacket::ACTION_STOP_BREAK: $this->level->broadcastLevelEvent($pos, LevelEventPacket::EVENT_BLOCK_STOP_BREAK); break; diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 46f3eb08a..b1334c996 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -28,7 +28,6 @@ namespace pocketmine\level; use pocketmine\block\Block; use pocketmine\block\BlockFactory; -use pocketmine\entity\Effect; use pocketmine\entity\Entity; use pocketmine\entity\Item as DroppedItem; use pocketmine\entity\object\ExperienceOrb; @@ -1780,7 +1779,7 @@ class Level implements ChunkManager, Metadatable{ $drops = ($player !== null and $player->isCreative()) ? [] : array_merge(...array_map(function(Block $block) use ($item) : array{ return $block->getDrops($item); }, $affectedBlocks)); if($player !== null){ - $ev = new BlockBreakEvent($player, $target, $item, $player->isCreative() or $player->allowInstaBreak(), $drops); + $ev = new BlockBreakEvent($player, $target, $item, $player->isCreative(), $drops); if(($player->isSurvival() and !$target->isBreakable($item)) or $player->isSpectator()){ $ev->setCancelled(); @@ -1811,28 +1810,6 @@ class Level implements ChunkManager, Metadatable{ return false; } - $breakTime = ceil($target->getBreakTime($item) * 20); - - if($player->isCreative() and $breakTime > 3){ - $breakTime = 3; - } - - if($player->hasEffect(Effect::HASTE)){ - $breakTime *= 1 - (0.2 * $player->getEffect(Effect::HASTE)->getEffectLevel()); - } - - if($player->hasEffect(Effect::MINING_FATIGUE)){ - $breakTime *= 1 + (0.3 * $player->getEffect(Effect::MINING_FATIGUE)->getEffectLevel()); - } - - $breakTime -= 1; //1 tick compensation - - if(!$ev->getInstaBreak() and (ceil($player->lastBreak * 20) + $breakTime) > ceil(microtime(true) * 20)){ - return false; - } - - $player->lastBreak = PHP_INT_MAX; - $drops = $ev->getDrops(); }elseif(!$target->isBreakable($item)){ diff --git a/src/pocketmine/resources/pocketmine.yml b/src/pocketmine/resources/pocketmine.yml index e5ba291ba..0181c8eda 100644 --- a/src/pocketmine/resources/pocketmine.yml +++ b/src/pocketmine/resources/pocketmine.yml @@ -108,8 +108,6 @@ player: anti-cheat: #If false, will try to prevent speed and noclip cheats. May cause movement issues. allow-movement-cheats: true - #If false, times block breaks to ensure players are not cheating. May cause issues with some blocks which are not yet properly implemented. - allow-instabreak: false level-settings: #The default format that levels will use when created