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

44 lines
2.3 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 PixelCommand extends Command {
public PixelCommand() {
2018-07-06 15:30:00 +02:00
super("cmd_duckets", Emulator.getTexts().getValue("commands.keys.cmd_duckets").split(";"));
}
@Override
2019-05-26 20:14:53 +02:00
public boolean handle(GameClient gameClient, String[] params) throws Exception {
if (params.length == 3) {
2018-07-06 15:30:00 +02:00
Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(params[1]);
2019-05-26 20:14:53 +02:00
if (habbo != null) {
try {
if (Integer.parseInt(params[2]) != 0) {
2018-07-06 15:30:00 +02:00
habbo.givePixels(Integer.parseInt(params[2]));
2019-05-26 20:14:53 +02:00
if (habbo.getHabboInfo().getCurrentRoom() != null)
2018-07-06 15:30:00 +02:00
habbo.whisper(Emulator.getTexts().getValue("commands.generic.cmd_duckets.received").replace("%amount%", Integer.valueOf(params[2]) + ""), RoomChatMessageBubbles.ALERT);
else
2019-03-18 02:22:00 +01:00
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_duckets.received").replace("%amount%", Integer.valueOf(params[2]) + ""));
2018-07-06 15:30:00 +02:00
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_duckets.send").replace("%amount%", Integer.valueOf(params[2]) + "").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_duckets.invalid_amount"), RoomChatMessageBubbles.ALERT);
}
2019-05-26 20:14:53 +02:00
} catch (NumberFormatException e) {
2018-07-06 15:30:00 +02:00
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_duckets.invalid_amount"), 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_duckets.user_offline").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_duckets.invalid_amount"), RoomChatMessageBubbles.ALERT);
}
return true;
}
}