From b0601b93dd228cef0221894abf0856a08241ee40 Mon Sep 17 00:00:00 2001 From: Beny Date: Thu, 23 May 2019 15:03:40 +0100 Subject: [PATCH] Fix wired teleport loop continuing after left room --- .../wired/effects/WiredEffectTeleport.java | 5 ++++- .../com/eu/habbo/habbohotel/rooms/RoomManager.java | 6 ++++++ .../java/com/eu/habbo/habbohotel/rooms/RoomUnit.java | 4 ++++ .../eu/habbo/threading/runnables/RoomUnitTeleport.java | 10 +++------- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java index 240ae719..5afd1d78 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.effects; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.items.interactions.InteractionTeleportTile; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.rooms.Room; @@ -160,7 +161,9 @@ public class WiredEffectTeleport extends InteractionWiredEffect @Override public void run() { try { - topItem.onWalkOn(roomUnit, room, new Object[] { }); + if(roomUnit != null && roomUnit.getRoom() != null) { + topItem.onWalkOn(roomUnit, room, new Object[]{}); + } } catch (Exception e) { } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index aca433aa..65b7b381 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -705,8 +705,14 @@ public class RoomManager r.removeFromQueue(habbo); } } + habbo.getHabboInfo().setRoomQueueId(0); habbo.getClient().sendResponse(new HideDoorbellComposer("")); + + if(habbo.getRoomUnit() != null) { + habbo.getRoomUnit().setRoom(null); + } + habbo.setRoomUnit(new RoomUnit()); habbo.getRoomUnit().clearStatus(); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java index b3c50e50..5fea11e4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java @@ -833,4 +833,8 @@ public class RoomUnit public void setCanLeaveRoomByDoor(boolean canLeaveRoomByDoor) { this.canLeaveRoomByDoor = canLeaveRoomByDoor; } + + public void setRoom(Room room) { + this.room = room; + } } 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 47e2f78b..eec23e80 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java @@ -34,6 +34,9 @@ public class RoomUnitTeleport implements Runnable @Override public void run() { + if(roomUnit == null || roomUnit.getRoom() == null) + return; + RoomTile t = this.room.getLayout().getTile((short) this.x, (short) this.y); HabboItem topItem = this.room.getTopItemAt(this.roomUnit.getCurrentLocation().x, this.roomUnit.getCurrentLocation().y); @@ -58,13 +61,6 @@ public class RoomUnitTeleport implements Runnable this.roomUnit.setLocation(t); this.room.sendComposer(teleportMessage); - - - - - - - this.room.updateHabbosAt(t.x, t.y); } }