aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2021-08-26 14:54:16 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2021-08-26 14:54:16 +0200
commitb1fa15a4b7fc857f68b08d4ca6ba0b5a8ad21d99 (patch)
treeca8f78313ba608bf4772fbc9c97263d383856e71 /src/main/java/io
parent0ac1e432c21a430bc67543ae2b6978d8a41c1e67 (diff)
downloadNotEnoughUpdates-b1fa15a4b7fc857f68b08d4ca6ba0b5a8ad21d99.tar.gz
NotEnoughUpdates-b1fa15a4b7fc857f68b08d4ca6ba0b5a8ad21d99.tar.bz2
NotEnoughUpdates-b1fa15a4b7fc857f68b08d4ca6ba0b5a8ad21d99.zip
fix max + save max to config
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java15
2 files changed, 10 insertions, 7 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
index 22d3f6ff..98816714 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -23,6 +23,7 @@ import org.lwjgl.util.vector.Vector2f;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
public class NEUConfig extends Config {
@@ -285,6 +286,7 @@ public class NEUConfig extends Config {
@Expose public ArrayList<String> enchantColours = createDefaultEnchantColours();
@Expose public String repoURL = "https://github.com/Moulberry/NotEnoughUpdates-REPO/archive/master.zip";
@Expose public String repoCommitsURL = "https://api.github.com/repos/Moulberry/NotEnoughUpdates-REPO/commits/master";
+ @Expose public Map<String, Integer> commissionMaxes = new HashMap<>();
@Expose public boolean firstTimeSearchFocus = true;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
index 0ef6de52..dfc12246 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
@@ -38,8 +38,7 @@ public class MiningOverlay extends TextOverlay {
super(position, dummyStrings, styleSupplier);
}
- private static final Pattern NUMBER_PATTERN = Pattern.compile("\\d+(?: |$)");
- private static Map<String, Integer> commissionMaxes = new HashMap<>();
+ private static final Pattern NUMBER_PATTERN = Pattern.compile("(?<number>\\d*,?\\d+)(?: |$)");
public static Map<String, Float> commissionProgress = new LinkedHashMap<>();
@Override
@@ -67,8 +66,10 @@ public class MiningOverlay extends TextOverlay {
Matcher matcher = NUMBER_PATTERN.matcher(clean);
if(matcher.find()) {
try {
- numberValue = Integer.parseInt(matcher.group());
- } catch(NumberFormatException ignored) {}
+ numberValue = Integer.parseInt(matcher.group("number").replace(",", ""));
+ } catch(NumberFormatException ignored) {
+ ignored.printStackTrace();
+ }
}
}
}
@@ -80,7 +81,7 @@ public class MiningOverlay extends TextOverlay {
}
}
if(name != null && numberValue > 0) {
- commissionMaxes.put(name, numberValue);
+ NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.put(name, numberValue);
}
}
}
@@ -343,8 +344,8 @@ public class MiningOverlay extends TextOverlay {
} else if (entry.getValue() >= 0.25) {
col = GOLD;
}
- if (true && commissionMaxes.containsKey(entry.getKey())) {
- int max = commissionMaxes.get(entry.getKey());
+ if (NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.containsKey(entry.getKey())) {
+ int max = NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.get(entry.getKey());
commissionsStrings.add(DARK_AQUA + entry.getKey() + ": " + col + Math.round(entry.getValue() * max) + "/" + max);
} else {
String valS = Utils.floatToString(entry.getValue() * 100, 1);