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;
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public class UnmuteCommand extends Command {
|
|
|
|
public UnmuteCommand() {
|
2018-07-06 15:30:00 +02:00
|
|
|
super("cmd_unmute", Emulator.getTexts().getValue("commands.keys.cmd_unmute").split(";"));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-26 20:14:53 +02:00
|
|
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
|
|
|
if (params.length == 1) {
|
2018-07-06 15:30:00 +02:00
|
|
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_unmute.not_specified"), RoomChatMessageBubbles.ALERT);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
if (habbo == null) {
|
2018-07-06 15:30:00 +02:00
|
|
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_unmute.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
|
|
|
return true;
|
2019-05-26 20:14:53 +02:00
|
|
|
} else {
|
|
|
|
if (!habbo.getHabboStats().allowTalk() || habbo.getHabboInfo().getCurrentRoom().isMuted(habbo)) {
|
|
|
|
if (!habbo.getHabboStats().allowTalk()) {
|
2018-07-06 15:30:00 +02:00
|
|
|
habbo.unMute();
|
|
|
|
}
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
if (habbo.getHabboInfo().getCurrentRoom().isMuted(habbo)) {
|
2018-07-06 15:30:00 +02:00
|
|
|
habbo.getHabboInfo().getCurrentRoom().muteHabbo(habbo, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_unmute").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
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_unmute.not_muted").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|