From de1b59acabb09563ec1b56387355d541fda5a78d Mon Sep 17 00:00:00 2001 From: Harmonic Date: Fri, 5 Jun 2020 04:06:48 -0400 Subject: [PATCH] Fixes users being sent into an endless loop in various edge cases when it tries to teleport them to a tile they're already on. Now it won't bother. --- .../interactions/wired/effects/WiredEffectTeleport.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 965ed802..ebd7254a 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 @@ -47,14 +47,20 @@ public class WiredEffectTeleport extends InteractionWiredEffect { Room room = roomUnit.getRoom(); - if (room == null) + if (room == null) { return; + } // makes a temporary effect + roomUnit.getRoom().unIdle(roomUnit.getRoom().getHabbo(roomUnit)); room.sendComposer(new RoomUserEffectComposer(roomUnit, 4).compose()); Emulator.getThreading().run(new SendRoomUnitEffectComposer(room, roomUnit), WiredHandler.TELEPORT_DELAY + 1000); + if (tile == roomUnit.getCurrentLocation()) { + return; + } + if (tile.state == RoomTileState.INVALID || tile.state == RoomTileState.BLOCKED) { RoomTile alternativeTile = null; List optionalTiles = room.getLayout().getTilesAround(tile); @@ -146,6 +152,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect { if (!this.items.isEmpty()) { int i = Emulator.getRandom().nextInt(this.items.size()); HabboItem item = this.items.get(i); + teleportUnitToTile(roomUnit, room.getLayout().getTile(item.getX(), item.getY())); return true; }