Optimization on wired teleport

This commit is contained in:
Beny 2019-05-24 11:36:17 +01:00
parent 6999db4542
commit 9117065093
2 changed files with 8 additions and 16 deletions

View File

@ -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

View File

@ -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) {
}
}
}
}