aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java
diff options
context:
space:
mode:
authorKevin <92656833+kevinthegreat1@users.noreply.github.com>2024-03-21 16:12:32 -0400
committerGitHub <noreply@github.com>2024-03-21 16:12:32 -0400
commit36cf628191947bec44f565a859c9ee9035383b6b (patch)
treec5cd26932b7ab29c55fd303956f9f9966924b18b /src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java
parentc5d059dd5918e801ce2225e75b71a2e33ea57e1c (diff)
downloadSkyblocker-36cf628191947bec44f565a859c9ee9035383b6b.tar.gz
Skyblocker-36cf628191947bec44f565a859c9ee9035383b6b.tar.bz2
Skyblocker-36cf628191947bec44f565a859c9ee9035383b6b.zip
Update Dwarven, Crystals, and Backpack Preview (#601)
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java
index 8eb15935..58abd980 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java
@@ -11,6 +11,7 @@ import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallba
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
+import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
@@ -42,7 +43,7 @@ public class DwarvenHud {
"First Event",
"(?:Ruby|Amber|Sapphire|Jade|Amethyst|Topaz) Gemstone Collector",
"(?:Amber|Sapphire|Jade|Amethyst|Topaz) Crystal Hunter",
- "Chest Looter").map(s -> Pattern.compile("^.*(" + s + "): (\\d+\\.?\\d*%|DONE)"))
+ "Chest Looter").map(s -> Pattern.compile("(" + s + "): (\\d+\\.?\\d*%|DONE)"))
.collect(Collectors.toList());
public static final Pattern MITHRIL_PATTERN = Pattern.compile("Mithril Powder: [0-9,]+");
public static final Pattern GEMSTONE_PATTERN = Pattern.compile("Gemstone Powder: [0-9,]+");
@@ -164,27 +165,28 @@ public class DwarvenHud {
commissionList = new ArrayList<>();
- client.getNetworkHandler().getPlayerList().forEach(playerListEntry -> {
- if (playerListEntry.getDisplayName() != null) {
- //find commissions
- for (Pattern pattern : COMMISSIONS) {
- Matcher matcher = pattern.matcher(playerListEntry.getDisplayName().getString());
- if (matcher.find()) {
- commissionList.add(new Commission(matcher.group(1), matcher.group(2)));
- }
-
- }
- //find powder
- Matcher mithrilMatcher = MITHRIL_PATTERN.matcher(playerListEntry.getDisplayName().getString());
- if (mithrilMatcher.find()){
- mithrilPowder = mithrilMatcher.group(0).split(": ")[1];
- }
- Matcher gemstoneMatcher = GEMSTONE_PATTERN.matcher(playerListEntry.getDisplayName().getString());
- if (gemstoneMatcher.find()){
- gemStonePowder = gemstoneMatcher.group(0).split(": ")[1];
+ for (PlayerListEntry playerListEntry : client.getNetworkHandler().getPlayerList()) {
+ if (playerListEntry.getDisplayName() == null) {
+ continue;
+ }
+ //find commissions
+ String name = playerListEntry.getDisplayName().getString().strip();
+ for (Pattern pattern : COMMISSIONS) {
+ Matcher matcher = pattern.matcher(name);
+ if (matcher.matches()) {
+ commissionList.add(new Commission(matcher.group(1), matcher.group(2)));
}
}
- });
+ //find powder
+ Matcher mithrilMatcher = MITHRIL_PATTERN.matcher(name);
+ if (mithrilMatcher.matches()) {
+ mithrilPowder = mithrilMatcher.group(0).split(": ")[1];
+ }
+ Matcher gemstoneMatcher = GEMSTONE_PATTERN.matcher(name);
+ if (gemstoneMatcher.matches()) {
+ gemStonePowder = gemstoneMatcher.group(0).split(": ")[1];
+ }
+ }
}
// steamroller tactics to get visibility from outside classes (HudCommsWidget)