Player: pre-cancel PlayerInteractEvent when left-clicking a block in spectator mode

fixes #3778
This commit is contained in:
Dylan K. Taylor 2020-08-20 23:43:52 +01:00
parent 1f9d672cfc
commit c22ab37372

View File

@ -2881,7 +2881,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$target = $this->level->getBlock($pos);
$ev = new PlayerInteractEvent($this, $this->inventory->getItemInHand(), $target, null, $packet->face, PlayerInteractEvent::LEFT_CLICK_BLOCK);
if($this->level->checkSpawnProtection($this, $target)){
if($this->isSpectator() || $this->level->checkSpawnProtection($this, $target)){
$ev->setCancelled();
}