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

45 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;
2019-05-26 20:14:53 +02:00
public class ForwardUser extends RCONMessage<ForwardUser.ForwardUserJSON> {
2018-07-08 23:32:00 +02:00
2019-05-26 20:14:53 +02:00
public ForwardUser() {
2018-07-06 15:30:00 +02:00
super(ForwardUserJSON.class);
}
@Override
2019-05-26 20:14:53 +02:00
public void handle(Gson gson, ForwardUserJSON object) {
2018-07-06 15:30:00 +02:00
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(object.user_id);
2019-05-26 20:14:53 +02:00
if (habbo != null) {
2018-07-06 15:30:00 +02:00
Room room = Emulator.getGameEnvironment().getRoomManager().loadRoom(object.room_id);
2019-05-26 20:14:53 +02:00
if (room != null) {
if (habbo.getHabboInfo().getCurrentRoom() != null) {
2018-07-06 15:30:00 +02:00
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);
2019-05-26 20:14:53 +02:00
} else {
2018-07-06 15:30:00 +02:00
this.status = RCONMessage.ROOM_NOT_FOUND;
}
}
this.status = RCONMessage.HABBO_NOT_FOUND;
}
2019-05-26 20:14:53 +02:00
static class ForwardUserJSON {
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;
}
}