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.RoomChatMessageBubbles;
|
|
|
|
import com.eu.habbo.habbohotel.users.Habbo;
|
|
|
|
import com.eu.habbo.messages.outgoing.rooms.RoomDataComposer;
|
|
|
|
|
2019-05-26 21:14:53 +03:00
|
|
|
public class StalkCommand extends Command {
|
|
|
|
public StalkCommand() {
|
2018-07-06 13:30:00 +00:00
|
|
|
super("cmd_stalk", Emulator.getTexts().getValue("commands.keys.cmd_stalk").split(";"));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-26 21:14:53 +03:00
|
|
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
|
|
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == null)
|
2018-07-06 13:30:00 +00:00
|
|
|
return true;
|
|
|
|
|
2019-05-26 21:14:53 +03:00
|
|
|
if (params.length >= 2) {
|
2018-07-06 13:30:00 +00:00
|
|
|
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
|
|
|
|
2019-05-26 21:14:53 +03:00
|
|
|
if (habbo == null) {
|
2018-07-06 13:30:00 +00:00
|
|
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_stalk.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-05-26 21:14:53 +03:00
|
|
|
if (habbo.getHabboInfo().getCurrentRoom() == null) {
|
2018-07-06 13:30:00 +00:00
|
|
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_stalk.not_room").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-05-26 21:14:53 +03:00
|
|
|
if (gameClient.getHabbo().getHabboInfo().getUsername().equals(habbo.getHabboInfo().getUsername())) {
|
2018-07-06 13:30:00 +00:00
|
|
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.generic.cmd_stalk.self").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-05-26 21:14:53 +03:00
|
|
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == habbo.getHabboInfo().getCurrentRoom()) {
|
2018-07-06 13:30:00 +00:00
|
|
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.generic.cmd_stalk.same_room").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
gameClient.sendResponse(new RoomDataComposer(habbo.getHabboInfo().getCurrentRoom(), gameClient.getHabbo(), true, false));
|
|
|
|
//gameClient.sendResponse(new ForwardToRoomComposer(habbo.getHabboInfo().getCurrentRoom().getId()));
|
|
|
|
return true;
|
2019-05-26 21:14:53 +03:00
|
|
|
} else {
|
2018-07-06 13:30:00 +00:00
|
|
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_summon.forgot_username"), RoomChatMessageBubbles.ALERT);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|