mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
InGamePacketHandler: drop transactions with 0 actions without trying to execute them
often we throw out actions that have no value, which can lead to an empty transaction and re-syncing the inventory. This happens every time we interact with the creative inventory in 1.13+, which causes items to appear to vanish when taking them from the creative menu. The correct fix for this is to resend only the slots affected by SlotChangeActions, but this fix will suffice for now without rewriting everything.
This commit is contained in:
parent
5955ff5393
commit
e66197036d
@ -260,6 +260,11 @@ class InGamePacketHandler extends PacketHandler{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(count($actions) === 0){
|
||||||
|
//TODO: 1.13+ often sends transactions with nothing but useless crap in them, no need for the debug noise
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$transaction = new InventoryTransaction($this->player, $actions);
|
$transaction = new InventoryTransaction($this->player, $actions);
|
||||||
try{
|
try{
|
||||||
$transaction->execute();
|
$transaction->execute();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user