mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-09 11:31:49 +00:00
Player: pre-cancel PlayerInteractEvent when left-clicking a block in spectator mode
fixes #3778
This commit is contained in:
parent
1f9d672cfc
commit
c22ab37372
@ -2881,7 +2881,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$target = $this->level->getBlock($pos);
|
$target = $this->level->getBlock($pos);
|
||||||
|
|
||||||
$ev = new PlayerInteractEvent($this, $this->inventory->getItemInHand(), $target, null, $packet->face, PlayerInteractEvent::LEFT_CLICK_BLOCK);
|
$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();
|
$ev->setCancelled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user