2018-07-06 13:30:00 +00:00
|
|
|
package com.eu.habbo.habbohotel.commands;
|
|
|
|
|
|
|
|
import com.eu.habbo.Emulator;
|
|
|
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|
|
|
import com.eu.habbo.habbohotel.rooms.Room;
|
|
|
|
import com.eu.habbo.habbohotel.users.Habbo;
|
|
|
|
import com.eu.habbo.messages.ServerMessage;
|
|
|
|
import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Collection;
|
|
|
|
|
2019-05-26 21:14:53 +03:00
|
|
|
public class ReloadRoomCommand extends Command {
|
|
|
|
public ReloadRoomCommand() {
|
2018-07-06 13:30:00 +00:00
|
|
|
super("cmd_reload_room", Emulator.getTexts().getValue("commands.keys.cmd_reload_room").split(";"));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-26 21:14:53 +03:00
|
|
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
2019-07-30 17:51:27 +03:00
|
|
|
Emulator.getThreading().run(() -> {
|
|
|
|
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
|
|
|
if (room != null) {
|
|
|
|
Collection<Habbo> habbos = new ArrayList<>(room.getHabbos());
|
|
|
|
Emulator.getGameEnvironment().getRoomManager().unloadRoom(room);
|
|
|
|
room = Emulator.getGameEnvironment().getRoomManager().loadRoom(room.getId());
|
|
|
|
ServerMessage message = new ForwardToRoomComposer(room.getId()).compose();
|
|
|
|
for (Habbo habbo : habbos) {
|
|
|
|
habbo.getClient().sendResponse(message);
|
2018-07-06 13:30:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 100);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|