From 91170650931ed40585bcabf08feac1b095385430 Mon Sep 17 00:00:00 2001 From: Beny Date: Fri, 24 May 2019 11:36:17 +0100 Subject: [PATCH] Optimization on wired teleport --- .../wired/effects/WiredEffectTeleport.java | 16 ---------------- .../threading/runnables/RoomUnitTeleport.java | 8 ++++++++ 2 files changed, 8 insertions(+), 16 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 c7559458..6e66c93d 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 @@ -150,22 +150,6 @@ public class WiredEffectTeleport extends InteractionWiredEffect } Emulator.getThreading().run(new RoomUnitTeleport(roomUnit, room, tile.x, tile.y, tile.getStackHeight() + (tile.state == RoomTileState.SIT ? -0.5 : 0), roomUnit.getEffectId()), WiredHandler.TELEPORT_DELAY); - - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - try { - if(roomUnit == null || roomUnit.getRoom() == null) - return; - - HabboItem topItem = room.getTopItemAt(roomUnit.getX(), roomUnit.getY()); - if (topItem != null && roomUnit.getCurrentLocation().equals(room.getLayout().getTile(topItem.getX(), topItem.getY()))) { - topItem.onWalkOn(roomUnit, room, new Object[]{}); - } - } catch (Exception e) { - } - } - }, WiredHandler.TELEPORT_DELAY); } @Override 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 eec23e80..df10d433 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java @@ -62,5 +62,13 @@ public class RoomUnitTeleport implements Runnable this.room.sendComposer(teleportMessage); this.room.updateHabbosAt(t.x, t.y); + + topItem = room.getTopItemAt(x, y); + if (topItem != null && roomUnit.getCurrentLocation().equals(room.getLayout().getTile((short)x, (short)y))) { + try { + topItem.onWalkOn(roomUnit, room, new Object[]{}); + } catch (Exception e) { + } + } } }