From 008a022ec16e9d2f7986febcefab26a9b3f3ab51 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 16 May 2023 23:02:33 +0100 Subject: [PATCH] Players now have finite resources in spectator mode this seems like the logical solution for the block picking issues. --- src/player/Player.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/player/Player.php b/src/player/Player.php index 279dd1ebf..e8dae37f4 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -1191,7 +1191,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ * TODO: make this a dynamic ability instead of being hardcoded */ public function hasFiniteResources() : bool{ - return $this->gamemode->equals(GameMode::SURVIVAL()) || $this->gamemode->equals(GameMode::ADVENTURE()); + return !$this->gamemode->equals(GameMode::CREATIVE()); } public function isFireProof() : bool{ @@ -1657,7 +1657,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ $ev = new PlayerBlockPickEvent($this, $block, $item); $existingSlot = $this->inventory->first($item); - if($existingSlot === -1 && ($this->hasFiniteResources() || $this->isSpectator())){ + if($existingSlot === -1 && $this->hasFiniteResources()){ $ev->cancel(); } $ev->call();