From 5f3099865aa813b966016a483e60ed20c73e9261 Mon Sep 17 00:00:00 2001 From: Yordi Date: Mon, 16 Jan 2023 13:50:00 +0100 Subject: [PATCH] Fix for bot not sitting at right height when placing on a chair, fixes issue #1999 --- .../java/com/eu/habbo/habbohotel/bots/BotManager.java | 2 +- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index 1c9951f4..be39101f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -122,7 +122,7 @@ public class BotManager { roomUnit.setRotation(RoomUserRotation.SOUTH); roomUnit.setLocation(location); - double stackHeight = location.getStackHeight(); + double stackHeight = room.getTopHeightAt(location.getX(), location.getY()); roomUnit.setPreviousLocationZ(stackHeight); roomUnit.setZ(stackHeight); 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 0ffda9fa..4275bac9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3063,11 +3063,11 @@ public class Room implements Comparable, ISerialize, Runnable { public double getTopHeightAt(int x, int y) { HabboItem item = this.getTopItemAt(x, y); - - if (item != null) - return (item.getZ() + Item.getCurrentHeight(item)); - else + if (item != null) { + return (item.getZ() + Item.getCurrentHeight(item) - (item.getBaseItem().allowSit() ? 1 : 0)); + } else { return this.layout.getHeightAtSquare(x, y); + } } public HabboItem getLowestChair(RoomTile tile) {