Arcturus-Community/src/main/java/com/eu/habbo/messages/rcon/ForwardUser.java

54 lines
1.4 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.messages.rcon;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer;
import com.google.gson.Gson;
public class ForwardUser extends RCONMessage<ForwardUser.ForwardUserJSON>
{
2018-07-08 23:32:00 +02:00
2018-07-06 15:30:00 +02:00
public ForwardUser()
{
super(ForwardUserJSON.class);
}
@Override
public void handle(Gson gson, ForwardUserJSON object)
{
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(object.user_id);
if(habbo != null)
{
Room room = Emulator.getGameEnvironment().getRoomManager().loadRoom(object.room_id);
if(room != null)
{
if (habbo.getHabboInfo().getCurrentRoom() != null)
{
Emulator.getGameEnvironment().getRoomManager().leaveRoom(habbo, habbo.getHabboInfo().getCurrentRoom());
}
habbo.getClient().sendResponse(new ForwardToRoomComposer(object.room_id));
Emulator.getGameEnvironment().getRoomManager().enterRoom(habbo, object.room_id, "", true);
}
else
{
this.status = RCONMessage.ROOM_NOT_FOUND;
}
}
this.status = RCONMessage.HABBO_NOT_FOUND;
}
2019-03-18 02:22:00 +01:00
static class ForwardUserJSON
2018-07-06 15:30:00 +02:00
{
2018-10-07 00:28:00 +02:00
2018-07-06 15:30:00 +02:00
public int user_id;
2018-10-07 00:28:00 +02:00
2018-07-06 15:30:00 +02:00
public int room_id;
}
}