Arcturus-Community/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java

42 lines
1.5 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02: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.ServerMessage;
2018-12-22 11:39:00 +01:00
import com.eu.habbo.messages.outgoing.generic.alerts.StaffAlertWithLinkComposer;
2018-07-06 15:30:00 +02:00
import java.util.Map;
public class HotelAlertCommand extends Command {
2019-05-26 20:14:53 +02:00
public HotelAlertCommand() {
2018-07-06 15:30:00 +02:00
super("cmd_ha", Emulator.getTexts().getValue("commands.keys.cmd_ha").split(";"));
}
@Override
2019-05-26 20:14:53 +02:00
public boolean handle(GameClient gameClient, String[] params) {
if (params.length > 1) {
2019-03-18 02:22:00 +01:00
StringBuilder message = new StringBuilder();
2018-07-06 15:30:00 +02:00
for (int i = 1; i < params.length; i++) {
2019-03-18 02:22:00 +01:00
message.append(params[i]).append(" ");
2018-07-06 15:30:00 +02:00
}
2018-12-22 11:39:00 +01:00
ServerMessage msg = new StaffAlertWithLinkComposer(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername(), "").compose();
2018-07-06 15:30:00 +02:00
2019-05-26 20:14:53 +02:00
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
2018-07-06 15:30:00 +02:00
Habbo habbo = set.getValue();
2019-05-26 20:14:53 +02:00
if (habbo.getHabboStats().blockStaffAlerts)
2018-07-06 15:30:00 +02:00
continue;
habbo.getClient().sendResponse(msg);
}
2019-05-26 20:14:53 +02:00
} else {
2018-07-06 15:30:00 +02:00
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ha.forgot_message"), RoomChatMessageBubbles.ALERT);
}
return true;
}
}