From 8ec9d7e179a9408bbdb9183e5a352dd442d3162d Mon Sep 17 00:00:00 2001 From: Yordi Date: Tue, 15 Oct 2024 15:02:16 +0200 Subject: [PATCH 01/15] Add option to prevent automatic handitem removal by setting `hotel.rooms.handitem.time` to 0 --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 03a2f242..3e22bf6c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -1224,7 +1224,8 @@ public class Room implements Comparable, ISerialize, Runnable { foundRightHolder[0] = habbo.getRoomUnit().getRightsLevel() != RoomRightLevels.NONE; } - if (habbo.getRoomUnit().getHandItem() > 0 && millis - habbo.getRoomUnit().getHandItemTimestamp() > (Room.HAND_ITEM_TIME * 1000)) { + // The handitem is no longer automatically removed from a user. We can set `Room.HAND_ITEM_TIME` to `0` as a configuration option to prevent it from being removed. (verified on Oct 15, 2024) + if (Room.HAND_ITEM_TIME > 0 && habbo.getRoomUnit().getHandItem() > 0 && millis - habbo.getRoomUnit().getHandItemTimestamp() > (Room.HAND_ITEM_TIME * 1000L)) { this.giveHandItem(habbo, 0); } From e70e75b87e4b85c3fd67c2225ab8724026f44a46 Mon Sep 17 00:00:00 2001 From: Yordi Date: Tue, 15 Oct 2024 16:22:35 +0200 Subject: [PATCH 02/15] Enable bots to trigger pressure-plates --- .../items/interactions/InteractionPressurePlate.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java index b446e6f4..90d25525 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java @@ -85,15 +85,16 @@ public class InteractionPressurePlate extends InteractionDefault { if (tiles == null) return; for (RoomTile tile : tiles) { - boolean hasHabbos = room.hasHabbosAt(tile.x, tile.y); - if (!hasHabbos && this.requiresAllTilesOccupied()) { + THashSet tileHasHabboOrBot = room.getHabbosAndBotsAt(tile.x, tile.y); + if (tileHasHabboOrBot.isEmpty() && this.requiresAllTilesOccupied()) { occupied = false; break; } - if (hasHabbos) { + if (!tileHasHabboOrBot.isEmpty()) { occupied = true; } + } this.setExtradata(occupied ? "1" : "0"); From c48f20c73f67a97daa4ae7f8b663783238831f84 Mon Sep 17 00:00:00 2001 From: Yordi Date: Tue, 15 Oct 2024 16:32:47 +0200 Subject: [PATCH 03/15] Add Usage Policy and Remote Switch --- .../habbo/habbohotel/items/ItemManager.java | 1 + .../InteractionSwitchRemoteControl.java | 53 +++++++++++++++++++ .../rooms/items/AddFloorItemComposer.java | 5 +- .../rooms/items/RoomFloorItemsComposer.java | 5 +- 4 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitchRemoteControl.java diff --git a/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java b/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java index 7fa15684..9627ea5e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java @@ -168,6 +168,7 @@ public class ItemManager { this.interactionsList.add(new ItemInteraction("youtube", InteractionYoutubeTV.class)); this.interactionsList.add(new ItemInteraction("jukebox", InteractionJukeBox.class)); this.interactionsList.add(new ItemInteraction("switch", InteractionSwitch.class)); + this.interactionsList.add(new ItemInteraction("switch_remote_control", InteractionSwitchRemoteControl.class)); this.interactionsList.add(new ItemInteraction("fx_box", InteractionFXBox.class)); this.interactionsList.add(new ItemInteraction("blackhole", InteractionBlackHole.class)); this.interactionsList.add(new ItemInteraction("effect_toggle", InteractionEffectToggle.class)); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitchRemoteControl.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitchRemoteControl.java new file mode 100644 index 00000000..e7fd1331 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitchRemoteControl.java @@ -0,0 +1,53 @@ +package com.eu.habbo.habbohotel.items.interactions; + +import com.eu.habbo.habbohotel.gameclients.GameClient; +import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.rooms.Room; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class InteractionSwitchRemoteControl extends InteractionDefault { + private static final Logger LOGGER = LoggerFactory.getLogger(InteractionSwitchRemoteControl.class); + + public InteractionSwitchRemoteControl(ResultSet set, Item baseItem) throws SQLException { + super(set, baseItem); + } + + public InteractionSwitchRemoteControl(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, userId, item, extradata, limitedStack, limitedSells); + } + + + @Override + public boolean isUsable() { + return true; + } + + @Override + public void onClick(GameClient client, Room room, Object[] objects) throws Exception { + if (room != null) { + super.onClick(client, room, objects); + + if (this.getExtradata().isEmpty()) + this.setExtradata("0"); + + if (this.getBaseItem().getStateCount() > 0) { + int currentState = 0; + + try { + currentState = Integer.parseInt(this.getExtradata()); + } catch (NumberFormatException e) { + LOGGER.error("Incorrect extradata ({}) for item ID ({}) of type ({})", this.getExtradata(), this.getId(), this.getBaseItem().getName()); + } + + this.setExtradata("" + (currentState + 1) % this.getBaseItem().getStateCount()); + this.needsUpdate(true); + + room.updateItemState(this); + } + } + } +} diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddFloorItemComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddFloorItemComposer.java index b27e75d9..8ea9de9a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddFloorItemComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddFloorItemComposer.java @@ -1,7 +1,6 @@ package com.eu.habbo.messages.outgoing.rooms.items; -import com.eu.habbo.habbohotel.items.interactions.InteractionGift; -import com.eu.habbo.habbohotel.items.interactions.InteractionMusicDisc; +import com.eu.habbo.habbohotel.items.interactions.*; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; @@ -23,7 +22,7 @@ public class AddFloorItemComposer extends MessageComposer { this.response.appendInt(this.item instanceof InteractionGift ? ((((InteractionGift) this.item).getColorId() * 1000) + ((InteractionGift) this.item).getRibbonId()) : (this.item instanceof InteractionMusicDisc ? ((InteractionMusicDisc) this.item).getSongId() : 1)); this.item.serializeExtradata(this.response); this.response.appendInt(-1); - this.response.appendInt(this.item.isUsable()); + this.response.appendInt(this.item instanceof InteractionTeleport || this.item instanceof InteractionSwitch || this.item instanceof InteractionSwitchRemoteControl || this.item instanceof InteractionVendingMachine || this.item instanceof InteractionInformationTerminal || this.item instanceof InteractionPostIt|| this.item instanceof InteractionPuzzleBox ? 2 : this.item.isUsable() ? 1 : 0); this.response.appendInt(this.item.getUserId()); this.response.appendString(this.itemOwnerName); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RoomFloorItemsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RoomFloorItemsComposer.java index 35210fa2..eb5a9d0f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RoomFloorItemsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RoomFloorItemsComposer.java @@ -1,7 +1,6 @@ package com.eu.habbo.messages.outgoing.rooms.items; -import com.eu.habbo.habbohotel.items.interactions.InteractionGift; -import com.eu.habbo.habbohotel.items.interactions.InteractionMusicDisc; +import com.eu.habbo.habbohotel.items.interactions.*; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; @@ -45,7 +44,7 @@ public class RoomFloorItemsComposer extends MessageComposer { this.response.appendInt(item instanceof InteractionGift ? ((((InteractionGift) item).getColorId() * 1000) + ((InteractionGift) item).getRibbonId()) : (item instanceof InteractionMusicDisc ? ((InteractionMusicDisc) item).getSongId() : 1)); item.serializeExtradata(this.response); this.response.appendInt(-1); - this.response.appendInt(item.isUsable() ? 1 : 0); + this.response.appendInt(item instanceof InteractionTeleport || item instanceof InteractionSwitch || item instanceof InteractionSwitchRemoteControl || item instanceof InteractionVendingMachine || item instanceof InteractionInformationTerminal || item instanceof InteractionPostIt || item instanceof InteractionPuzzleBox ? 2 : item.isUsable() ? 1 : 0); this.response.appendInt(item.getUserId()); } return this.response; From c7025ff9c009f5b002464780abb1cef5ba98f18a Mon Sep 17 00:00:00 2001 From: Yordi Date: Tue, 15 Oct 2024 16:49:09 +0200 Subject: [PATCH 04/15] Removal of sending the AlertPurchaseFailedComposer when you buy an item with a badge --- .../habbo/messages/incoming/catalog/CatalogBuyItemEvent.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index 1d6c06d1..b6e439ce 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -130,10 +130,6 @@ public class CatalogBuyItemEvent extends MessageHandler { } }); - if (badgeFound[0]) { - this.client.getHabbo().getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.ALREADY_HAVE_BADGE)); - } - return; } } From 0301a1467f8a0a771249f0f29caacded7930f99c Mon Sep 17 00:00:00 2001 From: Yordi Date: Tue, 15 Oct 2024 16:54:08 +0200 Subject: [PATCH 05/15] Ensure post-it ownership remains unchanged when text is edited, maintaining the original owner --- .../messages/incoming/rooms/items/PostItSaveDataEvent.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java index a2bb5524..2d590201 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java @@ -51,7 +51,8 @@ public class PostItSaveDataEvent extends MessageHandler { if (color.isEmpty()) color = PostItColor.YELLOW.hexColor; - item.setUserId(room.getOwnerId()); + // Removed on Oct 15th, 2024: The owner of this item should not be altered when editing the text of a post-it. The original owner must always remain unchanged. + // item.setUserId(room.getOwnerId()); item.setExtradata(color + " " + text); item.needsUpdate(true); room.updateItem(item); From e6c9429e40f5fb69e9793ddf30b860613cd33eee Mon Sep 17 00:00:00 2001 From: Yordi Date: Tue, 15 Oct 2024 17:06:32 +0200 Subject: [PATCH 06/15] Avatar now walks to the nearest adjacent tile before scratching a pet #1886 --- .../incoming/rooms/pets/ScratchPetEvent.java | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ScratchPetEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ScratchPetEvent.java index 501b6901..973bc022 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ScratchPetEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ScratchPetEvent.java @@ -3,7 +3,14 @@ package com.eu.habbo.messages.incoming.rooms.pets; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.pets.MonsterplantPet; import com.eu.habbo.habbohotel.pets.Pet; +import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.rooms.RoomTile; +import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; +import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation; + +import java.util.ArrayList; +import java.util.List; public class ScratchPetEvent extends MessageHandler { @@ -11,21 +18,34 @@ public class ScratchPetEvent extends MessageHandler { public void handle() throws Exception { final int petId = this.packet.readInt(); - if (this.client.getHabbo().getHabboInfo().getCurrentRoom() == null) { + final Habbo habbo = this.client.getHabbo(); + if (habbo == null) { return; } - final Pet pet = this.client.getHabbo().getHabboInfo().getCurrentRoom().getPet(petId); + final Room room = habbo.getHabboInfo().getCurrentRoom(); + if (room == null) { + return; + } + final Pet pet = room.getPet(petId); if (pet == null) { return; } - if (this.client.getHabbo().getHabboStats().petRespectPointsToGive > 0 || pet instanceof MonsterplantPet) { - pet.scratched(this.client.getHabbo()); + if (habbo.getHabboStats().petRespectPointsToGive > 0 || pet instanceof MonsterplantPet) { - // Update the stats to the database. - Emulator.getThreading().run(pet); + List tasks = new ArrayList<>(); + tasks.add(() -> { + pet.scratched(habbo); + Emulator.getThreading().run(pet); + }); + + RoomTile closestTile = habbo.getRoomUnit().getClosestAdjacentTile(pet.getRoomUnit().getX(), pet.getRoomUnit().getY(), true); + if (closestTile != null) { + habbo.getRoomUnit().setGoalLocation(closestTile); + Emulator.getThreading().run(new RoomUnitWalkToLocation(habbo.getRoomUnit(), closestTile, room, tasks, tasks)); + } } } } From 193d3e54a4b3563baaf8c6cf65690386261db3d3 Mon Sep 17 00:00:00 2001 From: Yordi Date: Tue, 15 Oct 2024 17:11:37 +0200 Subject: [PATCH 07/15] Fix for bot not sitting at right height when placing on a chair #1999 --- src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java | 2 +- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 2 +- 2 files changed, 2 insertions(+), 2 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 2eebcc6f..c9b6ff29 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -127,7 +127,7 @@ public class BotManager { roomUnit.setRotation(RoomUserRotation.SOUTH); roomUnit.setLocation(location); - double stackHeight = location.getStackHeight(); + double stackHeight = room.getTopHeightAt(location.x, location.y); 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 03a2f242..4cd4f86c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3635,7 +3635,7 @@ public class Room implements Comparable, ISerialize, Runnable { HabboItem item = this.getTopItemAt(x, y); if (item != null) - return (item.getZ() + Item.getCurrentHeight(item)); + return (item.getZ() + Item.getCurrentHeight(item) - (item.getBaseItem().allowSit() ? 1 : 0)); else return this.layout.getHeightAtSquare(x, y); } From c22c7cf186b9c45573cde4128be56d61cdd89b26 Mon Sep 17 00:00:00 2001 From: Yordi Date: Tue, 15 Oct 2024 17:17:08 +0200 Subject: [PATCH 08/15] Fix for duplicating room tags #2000 --- .../messages/incoming/rooms/RoomSettingsSaveEvent.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomSettingsSaveEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomSettingsSaveEvent.java index a45eeb89..82a39f64 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomSettingsSaveEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomSettingsSaveEvent.java @@ -10,6 +10,9 @@ import com.eu.habbo.messages.outgoing.rooms.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.HashSet; +import java.util.Set; + public class RoomSettingsSaveEvent extends MessageHandler { private static final Logger LOGGER = LoggerFactory.getLogger(RoomSettingsSaveEvent.class); @@ -55,6 +58,7 @@ public class RoomSettingsSaveEvent extends MessageHandler { int usersMax = this.packet.readInt(); int categoryId = this.packet.readInt(); StringBuilder tags = new StringBuilder(); + Set uniqueTags = new HashSet<>(); int count = Math.min(this.packet.readInt(), 2); for (int i = 0; i < count; i++) { String tag = this.packet.readString(); @@ -63,7 +67,10 @@ public class RoomSettingsSaveEvent extends MessageHandler { this.client.sendResponse(new RoomEditSettingsErrorComposer(room.getId(), RoomEditSettingsErrorComposer.TAGS_TOO_LONG, "")); return; } - tags.append(tag).append(";"); + if(!uniqueTags.contains(tag)) { + uniqueTags.add(tag); + tags.append(tag).append(";"); + } } if (!Emulator.getGameEnvironment().getWordFilter().filter(tags.toString(), this.client.getHabbo()).equals(tags.toString())) { From 647b4af9d9456543e35ba32968c1840300aff472 Mon Sep 17 00:00:00 2001 From: Yordi Date: Wed, 16 Oct 2024 10:21:53 +0200 Subject: [PATCH 09/15] Added scripting check to RoomUserGiveRespectEvent --- .../incoming/rooms/users/RoomUserGiveRespectEvent.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserGiveRespectEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserGiveRespectEvent.java index d2a46a40..c693d883 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserGiveRespectEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserGiveRespectEvent.java @@ -10,6 +10,10 @@ public class RoomUserGiveRespectEvent extends MessageHandler { public void handle() throws Exception { int userId = this.packet.readInt(); + if (userId == client.getHabbo().getHabboInfo().getId()) { + return; + } + if (this.client.getHabbo().getHabboStats().respectPointsToGive > 0) { Habbo target = this.client.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(userId); From 71aa4d86765c185016f996c73684ee06429ddb77 Mon Sep 17 00:00:00 2001 From: Yordi Date: Wed, 16 Oct 2024 10:30:31 +0200 Subject: [PATCH 10/15] Fixed rollers causing dead tiles and wired recognizing user on roller --- .../com/eu/habbo/habbohotel/rooms/Room.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 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 03a2f242..a2d21287 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -1269,7 +1269,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (Emulator.getConfig().getBoolean("hotel.rooms.deco_hosting")) { //Check if the user isn't the owner id if (this.ownerId != habbo.getHabboInfo().getId()) { - //Check if the time already have 1 minute (120 / 2 = 60s) + //Check if the time already have 1 minute (120 / 2 = 60s) if (habbo.getRoomUnit().getTimeInRoom() >= 120) { AchievementManager.progressAchievement(this.ownerId, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHosting")); habbo.getRoomUnit().resetTimeInRoom(); @@ -1498,11 +1498,10 @@ public class Room implements Comparable, ISerialize, Runnable { if (unit.hasStatus(RoomUnitStatus.MOVE)) continue; - RoomTile tile = tileInFront.copy(); - tile.setStackHeight(unit.getZ() + zOffset); + double newZ = unit.getZ() + zOffset; if (roomUserRolledEvent != null && unit.getRoomUnitType() == RoomUnitType.USER) { - roomUserRolledEvent = new UserRolledEvent(getHabbo(unit), roller, tile); + roomUserRolledEvent = new UserRolledEvent(getHabbo(unit), roller, tileInFront); Emulator.getPluginManager().fireEvent(roomUserRolledEvent); if (roomUserRolledEvent.isCancelled()) @@ -1517,10 +1516,10 @@ public class Room implements Comparable, ISerialize, Runnable { RideablePet riding = rollingHabbo.getHabboInfo().getRiding(); if (riding != null) { RoomUnit ridingUnit = riding.getRoomUnit(); - tile.setStackHeight(ridingUnit.getZ() + zOffset); + newZ = ridingUnit.getZ() + zOffset; rolledUnitIds.add(ridingUnit.getId()); updatedUnit.remove(ridingUnit); - messages.add(new RoomUnitOnRollerComposer(ridingUnit, roller, ridingUnit.getCurrentLocation(), ridingUnit.getZ(), tile, tile.getStackHeight(), room)); + messages.add(new RoomUnitOnRollerComposer(ridingUnit, roller, ridingUnit.getCurrentLocation(), ridingUnit.getZ(), tileInFront, newZ, room)); isRiding = true; } } @@ -1529,7 +1528,7 @@ public class Room implements Comparable, ISerialize, Runnable { usersRolledThisTile.add(unit.getId()); rolledUnitIds.add(unit.getId()); updatedUnit.remove(unit); - messages.add(new RoomUnitOnRollerComposer(unit, roller, unit.getCurrentLocation(), unit.getZ() + (isRiding ? 1 : 0), tile, tile.getStackHeight() + (isRiding ? 1 : 0), room)); + messages.add(new RoomUnitOnRollerComposer(unit, roller, unit.getCurrentLocation(), unit.getZ() + (isRiding ? 1 : 0), tileInFront, newZ + (isRiding ? 1 : 0), room)); if (itemsOnRoller.isEmpty()) { HabboItem item = room.getTopItemAt(tileInFront.x, tileInFront.y); @@ -2091,7 +2090,7 @@ public class Room implements Comparable, ISerialize, Runnable { for (Pet pet : toRemovePets) { removedPets.add(pet); - + pet.removeFromRoom(); Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(pet.getUserId()); @@ -3697,7 +3696,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (x < 0 || y < 0 || this.layout == null) return calculateHeightmap ? Short.MAX_VALUE : 0.0; - + if (Emulator.getPluginManager().isRegistered(FurnitureStackHeightEvent.class, true)) { FurnitureStackHeightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureStackHeightEvent(x, y, this)); if(event.hasPluginHelper()) { @@ -4022,7 +4021,7 @@ public class Room implements Comparable, ISerialize, Runnable { return; this.sendComposer(new RoomRemoveRightsListComposer(this, userId).compose()); - + if (this.rights.remove(userId)) { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_rights WHERE room_id = ? AND user_id = ?")) { statement.setInt(1, this.id); @@ -4533,7 +4532,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (tile == null || tile.state == RoomTileState.INVALID) { return FurnitureMovementError.INVALID_MOVE; } - + rotation %= 8; if (this.hasRights(habbo) || this.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS) || habbo.hasPermission(Permission.ACC_MOVEROTATE)) { return FurnitureMovementError.NONE; @@ -4553,7 +4552,7 @@ public class Room implements Comparable, ISerialize, Runnable { for (HabboItem area : this.getRoomSpecialTypes().getItemsOfType(InteractionBuildArea.class)) { if (((InteractionBuildArea) area).inSquare(tile) && ((InteractionBuildArea) area).isBuilder(habbo.getHabboInfo().getUsername())) { - return FurnitureMovementError.NONE; + return FurnitureMovementError.NONE; } } @@ -4933,4 +4932,4 @@ public class Room implements Comparable, ISerialize, Runnable { THashSet roomUnits = getRoomUnits(); return roomUnits.stream().filter(unit -> unit.getCurrentLocation() == tile).collect(Collectors.toSet()); } -} +} \ No newline at end of file From 6d019479420adb31289b4224072e812cd49f43ec Mon Sep 17 00:00:00 2001 From: Yordi Date: Wed, 16 Oct 2024 10:33:52 +0200 Subject: [PATCH 11/15] Fixed wired teleporting breaks after teleporting from another room --- .../com/eu/habbo/threading/runnables/RoomUnitTeleport.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java index 9cbe83c6..d315d6d0 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java @@ -34,9 +34,14 @@ public class RoomUnitTeleport implements Runnable { @Override public void run() { - if (roomUnit == null || roomUnit.getRoom() == null || room.getLayout() == null || roomUnit.isLeavingTeleporter) + if (roomUnit == null || roomUnit.getRoom() == null || room.getLayout() == null) return; + if (roomUnit.isLeavingTeleporter) { + roomUnit.isWiredTeleporting = false; + return; + } + RoomTile lastLocation = this.roomUnit.getCurrentLocation(); RoomTile newLocation = this.room.getLayout().getTile((short) this.x, (short) this.y); From 908b5605b3821cd2fbf757a0ccebd2fdcdb3cb44 Mon Sep 17 00:00:00 2001 From: Yordi Date: Thu, 17 Oct 2024 16:03:56 +0000 Subject: [PATCH 12/15] Improvement/bot limit walking distance --- sqlupdates/Update 3_5_3 to 3_5_4.sql | 3 + .../com/eu/habbo/habbohotel/bots/Bot.java | 68 +++++++++++++++---- .../eu/habbo/habbohotel/bots/BotManager.java | 2 +- .../com/eu/habbo/habbohotel/rooms/Room.java | 31 +++++++++ .../com/eu/habbo/plugin/PluginManager.java | 3 +- 5 files changed, 90 insertions(+), 17 deletions(-) create mode 100644 sqlupdates/Update 3_5_3 to 3_5_4.sql diff --git a/sqlupdates/Update 3_5_3 to 3_5_4.sql b/sqlupdates/Update 3_5_3 to 3_5_4.sql new file mode 100644 index 00000000..e6b0a748 --- /dev/null +++ b/sqlupdates/Update 3_5_3 to 3_5_4.sql @@ -0,0 +1,3 @@ +--New bot walking settings +INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.bot.limit.walking.distance', '1'); +INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.bot.limit.walking.distance.radius', '5'); \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java b/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java index 995a7af1..13914fc4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java @@ -27,6 +27,8 @@ public class Bot implements Runnable { public static final String NO_CHAT_SET = "${bot.skill.chatter.configuration.text.placeholder}"; public static String[] PLACEMENT_MESSAGES = "Yo!;Hello I'm a real party animal!;Hello!".split(";"); + public static boolean BOT_LIMIT_WALKING_DISTANCE = true; + public static int BOT_WALKING_DISTANCE_RADIUS = 5; private final ArrayList chatLines; private transient int id; @@ -137,30 +139,26 @@ public class Bot implements Runnable { @Override public void run() { if (this.needsUpdate) { - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE bots SET name = ?, motto = ?, figure = ?, gender = ?, user_id = ?, room_id = ?, x = ?, y = ?, z = ?, rot = ?, dance = ?, freeroam = ?, chat_lines = ?, chat_auto = ?, chat_random = ?, chat_delay = ?, effect = ?, bubble_id = ? WHERE id = ?")) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE bots SET name = ?, motto = ?, figure = ?, gender = ?, user_id = ?, room_id = ?, dance = ?, freeroam = ?, chat_lines = ?, chat_auto = ?, chat_random = ?, chat_delay = ?, effect = ?, bubble_id = ? WHERE id = ?")) { statement.setString(1, this.name); statement.setString(2, this.motto); statement.setString(3, this.figure); statement.setString(4, this.gender.toString()); statement.setInt(5, this.ownerId); statement.setInt(6, this.room == null ? 0 : this.room.getId()); - statement.setInt(7, this.roomUnit == null ? 0 : this.roomUnit.getX()); - statement.setInt(8, this.roomUnit == null ? 0 : this.roomUnit.getY()); - statement.setDouble(9, this.roomUnit == null ? 0 : this.roomUnit.getZ()); - statement.setInt(10, this.roomUnit == null ? 0 : this.roomUnit.getBodyRotation().getValue()); - statement.setInt(11, this.roomUnit == null ? 0 : this.roomUnit.getDanceType().getType()); - statement.setString(12, this.canWalk ? "1" : "0"); + statement.setInt(7, this.roomUnit == null ? 0 : this.roomUnit.getDanceType().getType()); + statement.setString(8, this.canWalk ? "1" : "0"); StringBuilder text = new StringBuilder(); for (String s : this.chatLines) { text.append(s).append("\r"); } - statement.setString(13, text.toString()); - statement.setString(14, this.chatAuto ? "1" : "0"); - statement.setString(15, this.chatRandom ? "1" : "0"); - statement.setInt(16, this.chatDelay); - statement.setInt(17, this.effect); - statement.setInt(18, this.bubble); - statement.setInt(19, this.id); + statement.setString(9, text.toString()); + statement.setString(10, this.chatAuto ? "1" : "0"); + statement.setString(11, this.chatRandom ? "1" : "0"); + statement.setInt(12, this.chatDelay); + statement.setInt(13, this.effect); + statement.setInt(14, this.bubble); + statement.setInt(15, this.id); statement.execute(); this.needsUpdate = false; } catch (SQLException e) { @@ -174,7 +172,15 @@ public class Bot implements Runnable { if (allowBotsWalk && this.canWalk) { if (!this.roomUnit.isWalking()) { if (this.roomUnit.getWalkTimeOut() < Emulator.getIntUnixTimestamp() && this.followingHabboId == 0) { - this.roomUnit.setGoalLocation(this.room.getRandomWalkableTile()); + this.roomUnit.setGoalLocation( + Bot.BOT_LIMIT_WALKING_DISTANCE + ? this.room.getRandomWalkableTilesAround( + this.getRoomUnit(), + this.room.getLayout().getTile(this.roomUnit.getX(), this.roomUnit.getY()), + Bot.BOT_WALKING_DISTANCE_RADIUS) + : this.room.getRandomWalkableTile() + ); + int timeOut = Emulator.getRandom().nextInt(20) * 2; this.roomUnit.setWalkTimeOut((timeOut < 10 ? 5 : timeOut) + Emulator.getIntUnixTimestamp()); } @@ -497,4 +503,36 @@ public class Bot implements Runnable { this.roomUnit.statusUpdate(true); } + public void onPlaceUpdate() { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE bots SET name = ?, motto = ?, figure = ?, gender = ?, user_id = ?, room_id = ?, x = ?, y = ?, z = ?, rot = ?, dance = ?, freeroam = ?, chat_lines = ?, chat_auto = ?, chat_random = ?, chat_delay = ?, effect = ?, bubble_id = ? WHERE id = ?")) { + statement.setString(1, this.name); + statement.setString(2, this.motto); + statement.setString(3, this.figure); + statement.setString(4, this.gender.toString()); + statement.setInt(5, this.ownerId); + statement.setInt(6, this.room == null ? 0 : this.room.getId()); + statement.setInt(7, this.roomUnit == null ? 0 : this.roomUnit.getX()); + statement.setInt(8, this.roomUnit == null ? 0 : this.roomUnit.getY()); + statement.setDouble(9, this.roomUnit == null ? 0 : this.roomUnit.getZ()); + statement.setInt(10, this.roomUnit == null ? 0 : this.roomUnit.getBodyRotation().getValue()); + statement.setInt(11, this.roomUnit == null ? 0 : this.roomUnit.getDanceType().getType()); + statement.setString(12, this.canWalk ? "1" : "0"); + StringBuilder text = new StringBuilder(); + for (String s : this.chatLines) { + text.append(s).append("\r"); + } + statement.setString(13, text.toString()); + statement.setString(14, this.chatAuto ? "1" : "0"); + statement.setString(15, this.chatRandom ? "1" : "0"); + statement.setInt(16, this.chatDelay); + statement.setInt(17, this.effect); + statement.setInt(18, this.bubble); + statement.setInt(19, this.id); + statement.execute(); + } catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); + } + } + + } 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 2eebcc6f..a21f8ae6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -136,7 +136,7 @@ public class BotManager { roomUnit.setCanWalk(room.isAllowBotsWalk()); bot.setRoomUnit(roomUnit); bot.setRoom(room); - bot.needsUpdate(true); + bot.onPlaceUpdate(); room.addBot(bot); Emulator.getThreading().run(bot); room.sendComposer(new RoomUsersComposer(bot).compose()); 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 03a2f242..f60c75e8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3849,6 +3849,37 @@ public class Room implements Comparable, ISerialize, Runnable { return null; } + public RoomTile getRandomWalkableTilesAround(RoomUnit roomUnit, RoomTile tile, int radius) { + if (!layout.tileExists(tile.x, tile.y)) { + tile = layout.getTile(roomUnit.getX(), roomUnit.getY()); + this.getBot(roomUnit).needsUpdate(true); + } + + List walkableTiles = new ArrayList<>(); + + int minX = Math.max(0, tile.x - radius); + int minY = Math.max(0, tile.y - radius); + int maxX = Math.min(this.getLayout().getMapSizeX() - 1, tile.x + radius); + int maxY = Math.min(this.getLayout().getMapSizeY() - 1, tile.y + radius); + + for (int x = minX; x <= maxX; x++) { + for (int y = minY; y <= maxY; y++) { + RoomTile candidateTile = this.getLayout().getTile((short) x, (short) y); + + if (candidateTile != null && candidateTile.getState() != RoomTileState.BLOCKED && candidateTile.getState() != RoomTileState.INVALID) { + walkableTiles.add(candidateTile); + } + } + } + + if (walkableTiles.isEmpty()) { + return tile; + } + + Collections.shuffle(walkableTiles); + return walkableTiles.get(0); + } + public Habbo getHabbo(String username) { for (Habbo habbo : this.getHabbos()) { if (habbo.getHabboInfo().getUsername().equalsIgnoreCase(username)) diff --git a/src/main/java/com/eu/habbo/plugin/PluginManager.java b/src/main/java/com/eu/habbo/plugin/PluginManager.java index a7d60270..9d81a0a8 100644 --- a/src/main/java/com/eu/habbo/plugin/PluginManager.java +++ b/src/main/java/com/eu/habbo/plugin/PluginManager.java @@ -25,7 +25,6 @@ import com.eu.habbo.habbohotel.users.clothingvalidation.ClothingValidationManage import com.eu.habbo.habbohotel.users.HabboInventory; import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionHabboClub; -import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionManager; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreManager; import com.eu.habbo.messages.PacketManager; @@ -100,6 +99,8 @@ public class PluginManager { BotManager.MAXIMUM_NAME_LENGTH = Emulator.getConfig().getInt("hotel.bot.max.namelength"); BotManager.MAXIMUM_CHAT_SPEED = Emulator.getConfig().getInt("hotel.bot.max.chatdelay"); Bot.PLACEMENT_MESSAGES = Emulator.getConfig().getValue("hotel.bot.placement.messages", "Yo!;Hello I'm a real party animal!;Hello!").split(";"); + Bot.BOT_LIMIT_WALKING_DISTANCE = Emulator.getConfig().getBoolean("hotel.bot.limit.walking.distance", true); + Bot.BOT_WALKING_DISTANCE_RADIUS = Emulator.getConfig().getInt("hotel.bot.limit.walking.distance.radius", 5); HabboInventory.MAXIMUM_ITEMS = Emulator.getConfig().getInt("hotel.inventory.max.items"); Messenger.MAXIMUM_FRIENDS = Emulator.getConfig().getInt("hotel.users.max.friends", 300); From 5926c9d898adddb029b4c95b4243aeafa03c7d38 Mon Sep 17 00:00:00 2001 From: Yordi Date: Thu, 17 Oct 2024 16:09:19 +0000 Subject: [PATCH 13/15] Apply wordfilter on more user-input fields --- .../messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java | 2 +- .../habbo/messages/incoming/guilds/RequestGuildBuyEvent.java | 4 ++-- .../incoming/guilds/forums/GuildForumPostThreadEvent.java | 4 ++-- .../messages/incoming/rooms/items/PostItSaveDataEvent.java | 2 +- .../com/eu/habbo/messages/incoming/users/SaveMottoEvent.java | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java index 454b5172..b67cd0ea 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java @@ -61,7 +61,7 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler { int itemId = this.packet.readInt(); String extraData = this.packet.readString(); String username = this.packet.readString(); - String message = this.packet.readString(); + String message = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo()); int spriteId = this.packet.readInt(); int color = this.packet.readInt(); int ribbonId = this.packet.readInt(); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java index 574987fa..96b73e6b 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java @@ -21,8 +21,8 @@ public class RequestGuildBuyEvent extends MessageHandler { @Override public void handle() throws Exception { - String name = this.packet.readString(); - String description = this.packet.readString(); + String name = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo()); + String description = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo()); if(name.length() > 29 || description.length() > 254) return; diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumPostThreadEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumPostThreadEvent.java index 5d3db9e1..a1730c3b 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumPostThreadEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumPostThreadEvent.java @@ -24,8 +24,8 @@ public class GuildForumPostThreadEvent extends MessageHandler { public void handle() throws Exception { int guildId = this.packet.readInt(); int threadId = this.packet.readInt(); - String subject = this.packet.readString(); - String message = this.packet.readString(); + String subject = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo()); + String message = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo()); Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java index a2bb5524..3486a88d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java @@ -18,7 +18,7 @@ public class PostItSaveDataEvent extends MessageHandler { public void handle() throws Exception { int itemId = this.packet.readInt(); String color = this.packet.readString(); - String text = this.packet.readString().replace(((char) 9) + "", ""); + String text = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString().replace(((char) 9) + "", ""), this.client.getHabbo()); if (text.length() > Emulator.getConfig().getInt("postit.charlimit")) { ScripterManager.scripterDetected(this.client, Emulator.getTexts().getValue("scripter.warning.sticky.size").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%amount%", text.length() + "").replace("%limit%", Emulator.getConfig().getInt("postit.charlimit") + "")); diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/SaveMottoEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/SaveMottoEvent.java index 50d0f9a1..d3f4322f 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/SaveMottoEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/SaveMottoEvent.java @@ -9,7 +9,7 @@ import com.eu.habbo.plugin.events.users.UserSavedMottoEvent; public class SaveMottoEvent extends MessageHandler { @Override public void handle() throws Exception { - String motto = this.packet.readString(); + String motto = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo()); UserSavedMottoEvent event = new UserSavedMottoEvent(this.client.getHabbo(), this.client.getHabbo().getHabboInfo().getMotto(), motto); Emulator.getPluginManager().fireEvent(event); motto = event.newMotto; From 8bc015c5b859a35ac92ad3ed769967d5b669c50b Mon Sep 17 00:00:00 2001 From: Yordi Date: Thu, 17 Oct 2024 16:57:25 +0000 Subject: [PATCH 14/15] Fix for being able to walk on furniture that has 8 rotations #1727 --- .../eu/habbo/habbohotel/rooms/RoomLayout.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java index 7459e42a..f3b6eab8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java @@ -617,7 +617,7 @@ public class RoomLayout { for (short j = tile.y; j <= (tile.y + (length - 1)); j++) { RoomTile t = this.getTile(i, j); - if (t == null || t.state == RoomTileState.INVALID) { + if (t == null || t.getState() == RoomTileState.INVALID) { return false; } } @@ -627,11 +627,16 @@ public class RoomLayout { for (short j = tile.y; j <= (tile.y + (width - 1)); j++) { RoomTile t = this.getTile(i, j); - if (t == null || t.state == RoomTileState.INVALID) { + if (t == null || t.getState() == RoomTileState.INVALID) { return false; } } } + } else if (rotation == 1 || rotation == 3 || rotation == 5 || rotation == 7) { + RoomTile t = this.getTile(tile.x, tile.y); + if (t == null || t.getState() == RoomTileState.INVALID) { + return false; + } } } @@ -662,9 +667,14 @@ public class RoomLayout { } } } + } else if (rotation == 1 || rotation == 3 || rotation == 5 || rotation == 7) { + RoomTile t = this.getTile(tile.x, tile.y); + if (t != null) { + pointList.add(t); + } } } - return pointList; } + } From 8a2b69fbd31e6a5e1f17ac782f8d465077ef84bf Mon Sep 17 00:00:00 2001 From: Yordi Date: Thu, 17 Oct 2024 20:38:57 +0000 Subject: [PATCH 15/15] Fix for sending data to a user that is null #1807 --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 1 + 1 file changed, 1 insertion(+) 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 63f2794c..e56ebeac 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3939,6 +3939,7 @@ public class Room implements Comparable, ISerialize, Runnable { } for (Habbo habbo : this.getHabbos()) { + if (habbo == null) { continue; } if (!habbo.getHabboStats().ignoreBots) habbo.getClient().sendResponse(message); }