From 6e5d13032243732dd22ea3289c2faca9aa2d7a79 Mon Sep 17 00:00:00 2001 From: PikaMug Date: Thu, 10 Oct 2019 01:45:11 -0400 Subject: [PATCH] Allow partial list of command display overrides, fixes #960 --- main/src/main/java/me/blackvein/quests/Quest.java | 10 ++++------ .../me/blackvein/quests/prompts/RewardsPrompt.java | 8 +++++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/main/src/main/java/me/blackvein/quests/Quest.java b/main/src/main/java/me/blackvein/quests/Quest.java index 3097f2433..6e9fc1a42 100644 --- a/main/src/main/java/me/blackvein/quests/Quest.java +++ b/main/src/main/java/me/blackvein/quests/Quest.java @@ -653,12 +653,10 @@ public class Quest { int index = 0; for (String s : rews.getCommands()) { if (rews.getCommandsOverrideDisplay().isEmpty() == false && rews.getCommandsOverrideDisplay().size() - >= index) { - if (rews.getCommandsOverrideDisplay().size() > index) { - if (!rews.getCommandsOverrideDisplay().get(index).trim().equals("")) { - player.sendMessage("- " + ChatColor.DARK_GREEN - + rews.getCommandsOverrideDisplay().get(index)); - } + > index) { + if (!rews.getCommandsOverrideDisplay().get(index).trim().equals("")) { + player.sendMessage("- " + ChatColor.DARK_GREEN + + rews.getCommandsOverrideDisplay().get(index)); } } else { player.sendMessage("- " + ChatColor.DARK_GREEN + s); diff --git a/main/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java b/main/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java index 8d389a5cb..9c8a903c6 100644 --- a/main/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java +++ b/main/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java @@ -166,7 +166,13 @@ public class RewardsPrompt extends NumericPrompt { List overrides = (List) context.getSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY); int index = 0; for (String cmd : commands) { - text += ChatColor.GRAY + " - " + ChatColor.AQUA + cmd + (overrides != null ? ChatColor.GRAY + " (\"" + ChatColor.AQUA + overrides.get(index) + ChatColor.GRAY + "\")" : "") + "\n"; + text += ChatColor.GRAY + " - " + ChatColor.AQUA + cmd; + if (overrides != null) { + if (index < overrides.size()) { + text += ChatColor.GRAY + " (\"" + ChatColor.AQUA + overrides.get(index) + ChatColor.GRAY + "\")"; + } + } + text += "\n"; index++; } return text;