From dc57d867e6a60bb1391c8d09ef7d9c7bc62f90d7 Mon Sep 17 00:00:00 2001 From: squeek Date: Mon, 28 Apr 2014 17:40:34 -0700 Subject: [PATCH] Harvestable checkmark/x changed to be configurable --- java/squeek/wailaharvestlevels/Config.java | 14 +++++++++++++- java/squeek/wailaharvestlevels/WailaHandler.java | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/java/squeek/wailaharvestlevels/Config.java b/java/squeek/wailaharvestlevels/Config.java index 5b91b69..789edf5 100644 --- a/java/squeek/wailaharvestlevels/Config.java +++ b/java/squeek/wailaharvestlevels/Config.java @@ -8,8 +8,18 @@ public class Config private static final String CATEGORY_MAIN = "Main"; public static String MINIMAL_SEPARATOR_STRING; - private static final String MINIMAL_SEPARATOR_STRING_NAME = "minimalModeSeparator"; + private static final String MINIMAL_SEPARATOR_STRING_NAME = "minimal.mode.separator"; private static final String MINIMAL_SEPARATOR_STRING_DEFAULT = " : "; + + public static String CURRENTLY_HARVESTABLE_STRING; + private static final String CURRENTLY_HARVESTABLE_STRING_NAME = "is.currently.harvestable.string"; + // for some reason \u2714 was getting translated as ? when compiled with gradle; no clue why but this seems to work + private static final String CURRENTLY_HARVESTABLE_STRING_DEFAULT = String.valueOf(Character.toChars(0x2714)); + + public static String NOT_CURRENTLY_HARVESTABLE_STRING; + private static final String NOT_CURRENTLY_HARVESTABLE_STRING_NAME = "not.currently.harvestable.string"; + // for some reason \u2718 was getting translated as ? when compiled with gradle; no clue why but this seems to work + private static final String NOT_CURRENTLY_HARVESTABLE_STRING_DEFAULT = String.valueOf(Character.toChars(0x2718)); private static Configuration config; @@ -20,6 +30,8 @@ public class Config load(); MINIMAL_SEPARATOR_STRING = config.get(CATEGORY_MAIN, MINIMAL_SEPARATOR_STRING_NAME, MINIMAL_SEPARATOR_STRING_DEFAULT).getString(); + CURRENTLY_HARVESTABLE_STRING = config.get(CATEGORY_MAIN, CURRENTLY_HARVESTABLE_STRING_NAME, CURRENTLY_HARVESTABLE_STRING_DEFAULT).getString(); + NOT_CURRENTLY_HARVESTABLE_STRING = config.get(CATEGORY_MAIN, NOT_CURRENTLY_HARVESTABLE_STRING_NAME, NOT_CURRENTLY_HARVESTABLE_STRING_DEFAULT).getString(); save(); } diff --git a/java/squeek/wailaharvestlevels/WailaHandler.java b/java/squeek/wailaharvestlevels/WailaHandler.java index 48facd6..6b16c68 100644 --- a/java/squeek/wailaharvestlevels/WailaHandler.java +++ b/java/squeek/wailaharvestlevels/WailaHandler.java @@ -99,7 +99,7 @@ public class WailaHandler implements IWailaDataProvider if (!minimalLayout) { if (showCurrentlyHarvestable) - toolTip.add(ColorHelper.getBooleanColor(isCurrentlyHarvestable) + (isCurrentlyHarvestable ? "\u2714" : "\u2718") + EnumChatFormatting.RESET + " Currently Harvestable"); + toolTip.add(ColorHelper.getBooleanColor(isCurrentlyHarvestable) + (isCurrentlyHarvestable ? Config.CURRENTLY_HARVESTABLE_STRING : Config.NOT_CURRENTLY_HARVESTABLE_STRING) + EnumChatFormatting.RESET + " Currently Harvestable"); if (harvestLevel != -1 && showEffectiveTool) toolTip.add("Effective Tool : " + ColorHelper.getBooleanColor(isEffective && canHarvest, isEffective && !canHarvest) + StatCollector.translateToLocal("harvestlevels.toolclass." + effectiveTool)); if (harvestLevel >= 1 && showHarvestLevel) @@ -110,7 +110,7 @@ public class WailaHandler implements IWailaDataProvider List stringParts = new ArrayList(); if (showCurrentlyHarvestable) - stringParts.add(ColorHelper.getBooleanColor(isCurrentlyHarvestable) + (isCurrentlyHarvestable ? "\u2714" : "\u2718")); + stringParts.add(ColorHelper.getBooleanColor(isCurrentlyHarvestable) + (isCurrentlyHarvestable ? Config.CURRENTLY_HARVESTABLE_STRING : Config.NOT_CURRENTLY_HARVESTABLE_STRING)); if (harvestLevel != -1 && showEffectiveTool) stringParts.add(ColorHelper.getBooleanColor(isEffective && canHarvest, isEffective && !canHarvest) + StatCollector.translateToLocal("harvestlevels.toolclass." + effectiveTool)); if (harvestLevel >= 1 && showHarvestLevel)