mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 05:55:33 +00:00
Player: do not set held item post block-break if changed (#3345)
this usually happens when a plugin replaces the held item during BlockBreakEvent. closes #2010
This commit is contained in:
parent
4bf9fb278b
commit
a6ca37429c
@ -2420,7 +2420,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
|
|
||||||
if($this->canInteract($blockVector->add(0.5, 0.5, 0.5), $this->isCreative() ? 13 : 7) and $this->level->useBreakOn($blockVector, $item, $this, true)){
|
if($this->canInteract($blockVector->add(0.5, 0.5, 0.5), $this->isCreative() ? 13 : 7) and $this->level->useBreakOn($blockVector, $item, $this, true)){
|
||||||
if($this->isSurvival()){
|
if($this->isSurvival()){
|
||||||
if(!$item->equalsExact($oldItem)){
|
if(!$item->equalsExact($oldItem) and $oldItem->equalsExact($this->inventory->getItemInHand())){
|
||||||
$this->inventory->setItemInHand($item);
|
$this->inventory->setItemInHand($item);
|
||||||
$this->inventory->sendHeldItem($this->hasSpawned);
|
$this->inventory->sendHeldItem($this->hasSpawned);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user