From a4c200146fbb44541805f76d4c0caab0101bc1d1 Mon Sep 17 00:00:00 2001 From: Beny Date: Tue, 6 Oct 2020 20:06:11 -0400 Subject: [PATCH] Revert "Merge branch 'master' into 'master'" This reverts merge request !304 --- .../habbohotel/commands/WordQuizCommand.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java index ba74d5d2..09a6c4dc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java @@ -2,9 +2,6 @@ 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 java.util.Arrays; public class WordQuizCommand extends Command { public WordQuizCommand() { @@ -14,21 +11,21 @@ public class WordQuizCommand extends Command { @Override public boolean handle(GameClient gameClient, String[] params) throws Exception { if (!gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasActiveWordQuiz()) { - if(params.length == 1) { - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.description.cmd_word_quiz"), RoomChatMessageBubbles.ALERT); - return true; - } StringBuilder question = new StringBuilder(); int duration = 60; - try { - duration = Integer.parseInt(params[params.length-1]); - params = Arrays.copyOf(params, params.length-1); - } - catch (Exception e) {} + if (params.length > 2) { + for (int i = 1; i < params.length - 1; i++) { + question.append(" ").append(params[i]); + } - for (int i = 1; i < params.length; i++) { - question.append(" ").append(params[i]); + try { + duration = Integer.valueOf(params[params.length - 1]); + } catch (Exception e) { + question.append(" ").append(params[params.length - 1]); + } + } else { + question = new StringBuilder(params[1]); } gameClient.getHabbo().getHabboInfo().getCurrentRoom().startWordQuiz(question.toString(), duration * 1000);