From c590e49ff1ef9c7acafb73d5913b42c10c9a729d Mon Sep 17 00:00:00 2001 From: Beny Date: Sun, 3 May 2020 00:33:02 +0200 Subject: [PATCH] Fix sometimes incorrect Habbo height on item pickup --- .../com/eu/habbo/habbohotel/rooms/Room.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 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 dd6597d4..c8de883e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -735,23 +735,22 @@ public class Room implements Comparable, ISerialize, Runnable { THashSet roomUnits = new THashSet<>(); for (Habbo habbo : habbos) { + + double z = habbo.getRoomUnit().getCurrentLocation().getStackHeight(); + if ((item == null && !habbo.getRoomUnit().cmdSit) || (item != null && !item.getBaseItem().allowSit())) habbo.getRoomUnit().removeStatus(RoomUnitStatus.SIT); if ((item == null && !habbo.getRoomUnit().cmdLay) || (item != null && !item.getBaseItem().allowLay())) habbo.getRoomUnit().removeStatus(RoomUnitStatus.LAY); - if (item != null) { - if (item.getBaseItem().allowSit() || item.getBaseItem().allowLay()) { - habbo.getRoomUnit().setZ(item.getZ()); - habbo.getRoomUnit().setPreviousLocationZ(item.getZ()); - habbo.getRoomUnit().setRotation(RoomUserRotation.fromValue(item.getRotation())); - } else { - habbo.getRoomUnit().setZ(item.getZ() + Item.getCurrentHeight(item)); - } + if (item != null && (item.getBaseItem().allowSit() || item.getBaseItem().allowLay())) { + habbo.getRoomUnit().setZ(item.getZ()); + habbo.getRoomUnit().setPreviousLocationZ(item.getZ()); + habbo.getRoomUnit().setRotation(RoomUserRotation.fromValue(item.getRotation())); } else { - habbo.getRoomUnit().setZ(habbo.getRoomUnit().getCurrentLocation().getStackHeight()); - habbo.getRoomUnit().setPreviousLocationZ(habbo.getRoomUnit().getCurrentLocation().getStackHeight()); + habbo.getRoomUnit().setZ(z); + habbo.getRoomUnit().setPreviousLocationZ(z); } roomUnits.add(habbo.getRoomUnit()); }