mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 00:17:58 +01:00
Fix Player#didCloseInventory
This commit is contained in:
parent
eb9aa8b6b6
commit
ce06919da1
@ -227,7 +227,6 @@ public class Inventory implements InventoryModifier, InventoryClickHandler, View
|
||||
private WindowItemsPacket createWindowItemsPacket() {
|
||||
WindowItemsPacket windowItemsPacket = new WindowItemsPacket();
|
||||
windowItemsPacket.windowId = getWindowId();
|
||||
windowItemsPacket.count = (short) itemStacks.length;
|
||||
windowItemsPacket.items = itemStacks;
|
||||
return windowItemsPacket;
|
||||
}
|
||||
|
@ -334,7 +334,6 @@ public class PlayerInventory implements InventoryModifier, InventoryClickHandler
|
||||
|
||||
WindowItemsPacket windowItemsPacket = new WindowItemsPacket();
|
||||
windowItemsPacket.windowId = 0;
|
||||
windowItemsPacket.count = INVENTORY_SIZE;
|
||||
windowItemsPacket.items = convertedSlots;
|
||||
return windowItemsPacket;
|
||||
}
|
||||
|
@ -502,6 +502,10 @@ public class InventoryClickProcessor {
|
||||
slot = slot - inventorySlot + PlayerInventoryUtils.OFFSET;
|
||||
}
|
||||
|
||||
// Reset the didCloseInventory field
|
||||
// Wait for inventory conditions + events to possibly close the inventory
|
||||
player.UNSAFE_changeDidCloseInventory(false);
|
||||
|
||||
List<InventoryCondition> inventoryConditions = isPlayerInventory ?
|
||||
player.getInventory().getInventoryConditions() : inventory.getInventoryConditions();
|
||||
if (!inventoryConditions.isEmpty()) {
|
||||
|
@ -7,13 +7,12 @@ import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
|
||||
public class WindowItemsPacket implements ServerPacket {
|
||||
|
||||
public int windowId;
|
||||
public short count;
|
||||
public byte windowId;
|
||||
public ItemStack[] items;
|
||||
|
||||
@Override
|
||||
public void write(PacketWriter writer) {
|
||||
writer.writeVarInt(windowId);
|
||||
writer.writeByte(windowId);
|
||||
|
||||
if (items == null) {
|
||||
writer.writeShort((short) 0);
|
||||
|
Loading…
Reference in New Issue
Block a user