From 471dae3068ad709b8d4b0221f8227f2df9c4fb5b Mon Sep 17 00:00:00 2001 From: brenoepics Date: Thu, 14 Apr 2022 19:01:22 +0000 Subject: [PATCH 1/2] Fix empty inventories --- .../incoming/inventory/RequestInventoryItemsEvent.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java index f5047b72..5896943f 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java @@ -25,6 +25,12 @@ public class RequestInventoryItemsEvent extends MessageHandler { synchronized (this.client.getHabbo().getInventory().getItemsComponent().getItems()) { TIntObjectMap items = new TIntObjectHashMap<>(); + + if (totalItems == 0) { + this.client.sendResponse(new InventoryItemsComposer(0, 1, new TIntObjectHashMap<>())); + return; + } + TIntObjectIterator iterator = this.client.getHabbo().getInventory().getItemsComponent().getItems().iterator(); int count = 0; From 002c53e8bbb64439e85a07349967409fcddfc7f8 Mon Sep 17 00:00:00 2001 From: brenoepics Date: Thu, 14 Apr 2022 19:07:10 +0000 Subject: [PATCH 2/2] Update src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java --- .../inventory/RequestInventoryItemsEvent.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java index 5896943f..7fa6a66b 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java @@ -17,6 +17,12 @@ public class RequestInventoryItemsEvent extends MessageHandler { @Override public void handle() throws Exception { int totalItems = this.client.getHabbo().getInventory().getItemsComponent().getItems().size(); + + if (totalItems == 0) { + this.client.sendResponse(new InventoryItemsComposer(0, 1, new TIntObjectHashMap<>())); + return; + } + int totalFragments = (int) Math.ceil((double) totalItems / 1000.0); if (totalFragments == 0) { @@ -25,11 +31,6 @@ public class RequestInventoryItemsEvent extends MessageHandler { synchronized (this.client.getHabbo().getInventory().getItemsComponent().getItems()) { TIntObjectMap items = new TIntObjectHashMap<>(); - - if (totalItems == 0) { - this.client.sendResponse(new InventoryItemsComposer(0, 1, new TIntObjectHashMap<>())); - return; - } TIntObjectIterator iterator = this.client.getHabbo().getInventory().getItemsComponent().getItems().iterator();