mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Players now have finite resources in spectator mode
this seems like the logical solution for the block picking issues.
This commit is contained in:
parent
5c85a7c306
commit
008a022ec1
@ -1191,7 +1191,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
* TODO: make this a dynamic ability instead of being hardcoded
|
* TODO: make this a dynamic ability instead of being hardcoded
|
||||||
*/
|
*/
|
||||||
public function hasFiniteResources() : bool{
|
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{
|
public function isFireProof() : bool{
|
||||||
@ -1657,7 +1657,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() || $this->isSpectator())){
|
if($existingSlot === -1 && $this->hasFiniteResources()){
|
||||||
$ev->cancel();
|
$ev->cancel();
|
||||||
}
|
}
|
||||||
$ev->call();
|
$ev->call();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user