Address sheep-shear objectives not loading properly, fixes #1056

This commit is contained in:
PikaMug 2020-01-30 02:36:58 -05:00
parent 23e664365c
commit a77831c675
3 changed files with 13 additions and 2 deletions

View File

@ -2656,7 +2656,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
List<Integer> shearAmounts = config.getIntegerList("quests." + questKey + ".stages.ordered." List<Integer> shearAmounts = config.getIntegerList("quests." + questKey + ".stages.ordered."
+ stageNum + ".sheep-amounts"); + stageNum + ".sheep-amounts");
for (String color : sheep) { for (String color : sheep) {
if (color.equalsIgnoreCase(Lang.get("COLOR_BLACK"))) { DyeColor dc = null;
try {
dc = DyeColor.valueOf(color.toUpperCase());
} catch (IllegalArgumentException e) {
// Fail silently
}
if (dc != null) {
oStage.sheepToShear.put(dc, shearAmounts.get(sheep.indexOf(color)));
// Legacy start -->
} else if (color.equalsIgnoreCase(Lang.get("COLOR_BLACK"))) {
oStage.sheepToShear.put(DyeColor.BLACK, shearAmounts.get(sheep.indexOf(color))); oStage.sheepToShear.put(DyeColor.BLACK, shearAmounts.get(sheep.indexOf(color)));
} else if (color.equalsIgnoreCase(Lang.get("COLOR_BLUE"))) { } else if (color.equalsIgnoreCase(Lang.get("COLOR_BLUE"))) {
oStage.sheepToShear.put(DyeColor.BLUE, shearAmounts.get(sheep.indexOf(color))); oStage.sheepToShear.put(DyeColor.BLUE, shearAmounts.get(sheep.indexOf(color)));
@ -2691,6 +2700,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
oStage.sheepToShear.put(DyeColor.WHITE, shearAmounts.get(sheep.indexOf(color))); oStage.sheepToShear.put(DyeColor.WHITE, shearAmounts.get(sheep.indexOf(color)));
} else if (color.equalsIgnoreCase(Lang.get("COLOR_YELLOW"))) { } else if (color.equalsIgnoreCase(Lang.get("COLOR_YELLOW"))) {
oStage.sheepToShear.put(DyeColor.YELLOW, shearAmounts.get(sheep.indexOf(color))); oStage.sheepToShear.put(DyeColor.YELLOW, shearAmounts.get(sheep.indexOf(color)));
// <-- Legacy end
} else { } else {
failStageProcess("sheep-to-shear has invalid color " + color, quest, stageNum); failStageProcess("sheep-to-shear has invalid color " + color, quest, stageNum);
} }

View File

@ -768,7 +768,7 @@ public class MobsPrompt extends FixedSetPrompt {
if (context.getSessionData(pref + CK.S_SHEAR_COLORS) == null) { if (context.getSessionData(pref + CK.S_SHEAR_COLORS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetShearColors") + " (" + Lang.get("noneSet") + ")\n"; + Lang.get("stageEditorSetShearColors") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetShearAmounts") + " (" + Lang.get("noneSet") + ")\n"; + Lang.get("stageEditorSetShearAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n"; + Lang.get("clear") + "\n";

View File

@ -170,6 +170,7 @@ public class MiscUtil {
* @return cleaned-up string * @return cleaned-up string
*/ */
public static String getPrettyDyeColorName(DyeColor color) { public static String getPrettyDyeColorName(DyeColor color) {
// Legacy
return Lang.get("COLOR_" + color.name()); return Lang.get("COLOR_" + color.name());
} }