Fix wired teleport loop continuing after left room

This commit is contained in:
Beny 2019-05-23 15:03:40 +01:00
parent 7e5cf51fba
commit b0601b93dd
4 changed files with 17 additions and 8 deletions

View File

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

View File

@ -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();

View File

@ -833,4 +833,8 @@ public class RoomUnit
public void setCanLeaveRoomByDoor(boolean canLeaveRoomByDoor) {
this.canLeaveRoomByDoor = canLeaveRoomByDoor;
}
public void setRoom(Room room) {
this.room = room;
}
}

View File

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