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:
Andrés Arias 2020-03-09 14:45:58 +01:00 committed by GitHub
parent 4bf9fb278b
commit a6ca37429c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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->isSurvival()){
if(!$item->equalsExact($oldItem)){
if(!$item->equalsExact($oldItem) and $oldItem->equalsExact($this->inventory->getItemInHand())){
$this->inventory->setItemInHand($item);
$this->inventory->sendHeldItem($this->hasSpawned);
}