From 737967eef47173d0ac9362577fc3cac4721db8d7 Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Fri, 17 May 2019 14:32:13 +0300 Subject: [PATCH] Fix #40 --- .../interactions/InteractionPressurePlate.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 44ece7a9..276fb788 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 @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.ServerMessage; +import gnu.trove.set.hash.THashSet; import java.sql.ResultSet; import java.sql.SQLException; @@ -99,7 +100,17 @@ public class InteractionPressurePlate extends HabboItem { boolean occupied = false; - for (RoomTile tile : room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation())) + if (room == null || room.getLayout() == null || this.getBaseItem() == null) return; + + RoomTile tileAtItem = room.getLayout().getTile(this.getX(), this.getY()); + + if (tileAtItem == null) return; + + THashSet tiles = room.getLayout().getTilesAt(tileAtItem, this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()); + + if (tiles == null) return; + + for (RoomTile tile : tiles) { boolean hasHabbos = room.hasHabbosAt(tile.x, tile.y); if (!hasHabbos && this.requiresAllTilesOccupied())