mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 04:17:07 +00:00
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.
This commit is contained in:
parent
4943ff9dfc
commit
897a31e608
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user