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

73 lines
2.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.modtool.ModToolBanType;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboManager;
public class SuperbanCommand extends Command
{
public SuperbanCommand()
{
super("cmd_super_ban", Emulator.getTexts().getValue("commands.keys.cmd_super_ban").split(";"));
}
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
HabboInfo habbo = null;
2019-03-18 02:22:00 +01:00
StringBuilder reason = new StringBuilder();
2018-07-06 15:30:00 +02:00
if (params.length >= 2)
{
Habbo h = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
if (h != null)
{
habbo = h.getHabboInfo();
}
else
{
habbo = HabboManager.getOfflineHabboInfo(params[1]);
}
}
if (params.length > 2)
{
for (int i = 2; i < params.length; i++)
{
2019-03-18 02:22:00 +01:00
reason.append(params[i]);
reason.append(" ");
2018-07-06 15:30:00 +02:00
}
}
2019-03-18 02:22:00 +01:00
int count;
2018-07-06 15:30:00 +02:00
if (habbo != null)
{
if (habbo == gameClient.getHabbo().getHabboInfo())
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_super_ban.ban_self"), RoomChatMessageBubbles.ALERT);
return true;
}
if (habbo.getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId())
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ban.target_rank_higher"), RoomChatMessageBubbles.ALERT);
return true;
}
2019-03-18 02:22:00 +01:00
count = Emulator.getGameEnvironment().getModToolManager().ban(habbo.getId(), gameClient.getHabbo(), reason.toString(), IPBanCommand.TEN_YEARS, ModToolBanType.SUPER, -1).size();
2018-07-06 15:30:00 +02:00
}
else
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ban.user_offline"), RoomChatMessageBubbles.ALERT);
return true;
}
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_super_ban").replace("%count%", count + ""), RoomChatMessageBubbles.ALERT);
return true;
}
}