mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-05 17:41:46 +00:00
Player: spectator shouldn't able to pick blocks they don't have (#5111)
Jury is out on whether they should be able to pick blocks at all, or be considered to have infinite resources, but this solution has been used in a few other places already anyway, so it can be cleaned up another time.
This commit is contained in:
parent
c5b2488fc1
commit
2f4a9469b6
@ -1558,7 +1558,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
|
|
||||||
$ev = new PlayerBlockPickEvent($this, $block, $item);
|
$ev = new PlayerBlockPickEvent($this, $block, $item);
|
||||||
$existingSlot = $this->inventory->first($item);
|
$existingSlot = $this->inventory->first($item);
|
||||||
if($existingSlot === -1 && $this->hasFiniteResources()){
|
if($existingSlot === -1 && ($this->hasFiniteResources() || $this->isSpectator())){
|
||||||
$ev->cancel();
|
$ev->cancel();
|
||||||
}
|
}
|
||||||
$ev->call();
|
$ev->call();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user