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;
|
2020-10-07 01:47:48 +02:00
|
|
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
2018-07-06 15:30:00 +02:00
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public class WordQuizCommand extends Command {
|
|
|
|
public WordQuizCommand() {
|
2018-07-06 15:30:00 +02:00
|
|
|
super("cmd_word_quiz", Emulator.getTexts().getValue("commands.keys.cmd_word_quiz").split(";"));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-26 20:14:53 +02:00
|
|
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
|
|
|
if (!gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasActiveWordQuiz()) {
|
2020-10-07 01:47:48 +02:00
|
|
|
if(params.length == 1) {
|
|
|
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.description.cmd_word_quiz"), RoomChatMessageBubbles.ALERT);
|
|
|
|
return true;
|
|
|
|
}
|
2019-03-18 02:22:00 +01:00
|
|
|
StringBuilder question = new StringBuilder();
|
2018-07-06 15:30:00 +02:00
|
|
|
int duration = 60;
|
|
|
|
|
2020-10-07 01:47:48 +02:00
|
|
|
try {
|
|
|
|
duration = Integer.parseInt(params[params.length-1]);
|
|
|
|
params = Arrays.copyOf(params, params.length-1);
|
|
|
|
}
|
|
|
|
catch (Exception e) {}
|
2018-07-06 15:30:00 +02:00
|
|
|
|
2020-10-07 01:47:48 +02:00
|
|
|
for (int i = 1; i < params.length; i++) {
|
|
|
|
question.append(" ").append(params[i]);
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
|
2019-03-18 02:22:00 +01:00
|
|
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().startWordQuiz(question.toString(), duration * 1000);
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|