From 09114ba9774ae4ab40b1df053ad1de4d5cf749be Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Thu, 27 Feb 2020 22:53:06 +0200 Subject: [PATCH] Allow placing stack helpers on users, bots and pets --- .../com/eu/habbo/habbohotel/rooms/Room.java | 24 +++++++++---------- .../habbo/habbohotel/wired/WiredHandler.java | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 5fb0b622..11f81d96 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -4366,6 +4366,8 @@ public class Room implements Comparable, ISerialize, Runnable { if (!this.layout.fitsOnMap(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation)) return FurnitureMovementError.INVALID_MOVE; + if (item instanceof InteractionStackHelper) return FurnitureMovementError.NONE; + THashSet occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation); for (RoomTile t : occupiedTiles) { @@ -4374,24 +4376,20 @@ public class Room implements Comparable, ISerialize, Runnable { if (this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS; } - boolean magicTile = item instanceof InteractionStackHelper; + List>> tileFurniList = new ArrayList<>(); + for (RoomTile t : occupiedTiles) { + tileFurniList.add(Pair.create(t, this.getItemsAt(t))); - if (!magicTile) { - List>> tileFurniList = new ArrayList<>(); - for (RoomTile t : occupiedTiles) { - tileFurniList.add(Pair.create(t, this.getItemsAt(t))); - - HabboItem topItem = this.getTopItemAt(t.x, t.y, item); - if (topItem != null && !topItem.getBaseItem().allowStack() && !t.getAllowStack()) { - return FurnitureMovementError.CANT_STACK; - } - } - - if (!item.canStackAt(this, tileFurniList)) { + HabboItem topItem = this.getTopItemAt(t.x, t.y, item); + if (topItem != null && !topItem.getBaseItem().allowStack() && !t.getAllowStack()) { return FurnitureMovementError.CANT_STACK; } } + if (!item.canStackAt(this, tileFurniList)) { + return FurnitureMovementError.CANT_STACK; + } + return FurnitureMovementError.NONE; } diff --git a/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java b/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java index 3e48eb85..ce4b7361 100644 --- a/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java +++ b/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java @@ -142,7 +142,7 @@ public class WiredHandler { if (!((condition.operator() == WiredConditionOperator.OR && matchedConditions.contains(condition.getType())) || (condition.operator() == WiredConditionOperator.AND && condition.execute(roomUnit, room, stuff))) && !Emulator.getPluginManager().fireEvent(new WiredConditionFailedEvent(room, roomUnit, trigger, condition)).isCancelled()) { - + return false; } }