aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/xmrvizzy/skyblocker/skyblock
diff options
context:
space:
mode:
authormsg-programs <msgdoesstuff@gmail.com>2023-06-04 13:03:49 +0200
committermsg-programs <msgdoesstuff@gmail.com>2023-06-04 13:03:49 +0200
commit34d87f0e435963cb571568a783c9c4456e811012 (patch)
tree25e2524bf777baa8342f31e8219deecfac367734 /src/main/java/me/xmrvizzy/skyblocker/skyblock
parenta84f34c56cdcf6646576bbf1806315c28b5ebc9c (diff)
downloadSkyblocker-34d87f0e435963cb571568a783c9c4456e811012.tar.gz
Skyblocker-34d87f0e435963cb571568a783c9c4456e811012.tar.bz2
Skyblocker-34d87f0e435963cb571568a783c9c4456e811012.zip
Fix UpgradeWidget not showing current upgrades
Diffstat (limited to 'src/main/java/me/xmrvizzy/skyblocker/skyblock')
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/UpgradeWidget.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/UpgradeWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/UpgradeWidget.java
index e9d239ae..ef7c21d0 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/UpgradeWidget.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/UpgradeWidget.java
@@ -19,22 +19,27 @@ public class UpgradeWidget extends Widget {
public UpgradeWidget(String footertext) {
super(TITLE, Formatting.GOLD.getColorValue());
- if (footertext == null || !footertext.contains("Upgrades")) {
+ if (footertext == null) {
this.addComponent(new PlainTextComponent(Text.literal("No data").formatted(Formatting.GRAY)));
this.pack();
return;
}
- String[] interesting = footertext.split("Upgrades");
- this.addComponent(new PlainTextComponent(Text.of("Currently no upgrades...")));
- this.pack();
+ if (!footertext.contains("Upgrades")) {
+ this.addComponent(new PlainTextComponent(Text.of("Currently no upgrades...")));
+ this.pack();
+ return;
+ }
+
+ String interesting = footertext.split("Upgrades")[1];
+ String[] lines = interesting.split("\n");
- String[] lines = interesting[1].split("\n");
- IcoTextComponent u1 = new IcoTextComponent(Ico.SIGN, Text.of(lines[1]));
- this.addComponent(u1);
- if (lines.length == 5) { // ??? no idea how this works, but it does. don't touch until understood...
- IcoTextComponent u2 = new IcoTextComponent(Ico.SIGN, Text.of(lines[2]));
- this.addComponent(u2);
+ for (int i = 1; i < lines.length; i++) {
+ if (lines[i].trim().length() < 3) { // empty line is §s
+ break;
+ }
+ IcoTextComponent itc = new IcoTextComponent(Ico.SIGN, Text.of(lines[i]));
+ this.addComponent(itc);
}
this.pack();
}