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

40 lines
2.0 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;
2019-05-26 20:14:53 +02:00
public class FreezeCommand extends Command {
public FreezeCommand() {
2018-07-06 15:30:00 +02:00
super("cmd_freeze", Emulator.getTexts().getValue("commands.keys.cmd_freeze").split(";"));
}
@Override
2019-05-26 20:14:53 +02:00
public boolean handle(GameClient gameClient, String[] params) throws Exception {
if (params.length == 2) {
2018-07-06 15:30:00 +02:00
Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().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_freeze.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
return true;
2019-05-26 20:14:53 +02:00
} else {
if (habbo.getRoomUnit().canWalk()) {
2018-07-06 15:30:00 +02:00
habbo.getRoomUnit().setCanWalk(false);
habbo.whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.frozen"), RoomChatMessageBubbles.ALERT);
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.user_frozen").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
return true;
2019-05-26 20:14:53 +02:00
} else {
2018-07-06 15:30:00 +02:00
habbo.getRoomUnit().setCanWalk(true);
habbo.whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.unfrozen"), RoomChatMessageBubbles.ALERT);
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.user_unfrozen").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
return true;
}
}
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_freeze.not_found").replace("%user%", ""), RoomChatMessageBubbles.ALERT);
return true;
}
}
}