From 897a31e6082e3595752e49d5bf99053cc1ba35cd Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 22 Jan 2018 18:36:48 +0000 Subject: [PATCH] Player: Moved logic of setUsingItem() plugins might be using this method, or the item may have been dropped involuntarily due to server-side logic. Therefore it should be handled when the transaction is received and not when the item is dropped into the world. --- src/pocketmine/Player.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index b73a8dd30..e0485e1ab 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2247,6 +2247,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ switch($packet->transactionType){ case InventoryTransactionPacket::TYPE_NORMAL: + $this->setUsingItem(false); $transaction = new InventoryTransaction($this, $actions); if(!$transaction->execute()){ @@ -2262,6 +2263,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ if(count($packet->actions) > 0){ $this->server->getLogger()->debug("Expected 0 actions for mismatch, got " . count($packet->actions) . ", " . json_encode($packet->actions)); } + $this->setUsingItem(false); $this->sendAllInventories(); return true; @@ -2767,8 +2769,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $this->level->dropItem($this->add(0, 1.3, 0), $item, $motion, 40); - $this->setUsingItem(false); - return true; }