aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2022-04-23 23:24:13 -0400
committerbowser0000 <bowser0000@gmail.com>2022-04-23 23:24:13 -0400
commit6281b9fe15b3d807cd2e2fdba2b7649544f17658 (patch)
tree12e68a7c4879dc1217f4a4998c81f78b5b0e87e6
parent9d676f89051d2845566b7253c0b91f3abe32673d (diff)
downloadSkyblockMod-6281b9fe15b3d807cd2e2fdba2b7649544f17658.tar.gz
SkyblockMod-6281b9fe15b3d807cd2e2fdba2b7649544f17658.tar.bz2
SkyblockMod-6281b9fe15b3d807cd2e2fdba2b7649544f17658.zip
Fix some drops not counting in blaze tracker
Also make multidrops work with any amount of digits
-rw-r--r--src/main/java/me/Danker/features/loot/BlazeTracker.java42
-rw-r--r--src/main/java/me/Danker/features/loot/LootTracker.java11
2 files changed, 31 insertions, 22 deletions
diff --git a/src/main/java/me/Danker/features/loot/BlazeTracker.java b/src/main/java/me/Danker/features/loot/BlazeTracker.java
index 896f65f..955f83c 100644
--- a/src/main/java/me/Danker/features/loot/BlazeTracker.java
+++ b/src/main/java/me/Danker/features/loot/BlazeTracker.java
@@ -89,7 +89,7 @@ public class BlazeTracker {
splashPotions++;
splashPotionsSession++;
ConfigHandler.writeIntConfig("blaze", "splashPotions", splashPotions);
- } else if (message.contains("RARE DROP! (Bundle of Magma Arrows)")) {
+ } else if (message.contains("RARE DROP! (Bundle of Magma Arrows)")) {
magmaArrows++;
magmaArrowsSession++;
ConfigHandler.writeIntConfig("blaze", "magmaArrows", magmaArrows);
@@ -105,25 +105,30 @@ public class BlazeTracker {
kelvinInverters++;
kelvinInvertersSession++;
ConfigHandler.writeIntConfig("blaze", "kelvinInverters", kelvinInverters);
- } else if (message.contains("VERY RARE DROP! (Blaze Rod Distillate)")) {
- blazeRodDistillates++;
- blazeRodDistillatesSession++;
+ } else if (message.contains("VERY RARE DROP! (") && message.contains("Blaze Rod Distillate)")) {
+ int amount = LootTracker.getAmountfromMessage(message);
+ blazeRodDistillates += amount;
+ blazeRodDistillatesSession += amount;
ConfigHandler.writeIntConfig("blaze", "blazeRodDistillates", blazeRodDistillates);
- } else if (message.contains("VERY RARE DROP! (Glowstone Distillate)")) {
- glowstoneDistillates++;
- glowstoneDistillatesSession++;
+ } else if (message.contains("VERY RARE DROP! (") && message.contains("Glowstone Distillate)")) {
+ int amount = LootTracker.getAmountfromMessage(message);
+ glowstoneDistillates += amount;
+ glowstoneDistillatesSession += amount;
ConfigHandler.writeIntConfig("blaze", "glowstoneDistillates", glowstoneDistillates);
- } else if (message.contains("VERY RARE DROP! (Magma Cream Distillate)")) {
- magmaCreamDistillates++;
- magmaCreamDistillatesSession++;
+ } else if (message.contains("VERY RARE DROP! (") && message.contains("Magma Cream Distillate)")) {
+ int amount = LootTracker.getAmountfromMessage(message);
+ magmaCreamDistillates += amount;
+ magmaCreamDistillatesSession += amount;
ConfigHandler.writeIntConfig("blaze", "magmaCreamDistillates", magmaCreamDistillates);
- } else if (message.contains("VERY RARE DROP! (Nether Wart Distillate)")) {
- netherWartDistillates++;
- netherWartDistillatesSession++;
+ } else if (message.contains("VERY RARE DROP! (") && message.contains("Nether Wart Distillate)")) {
+ int amount = LootTracker.getAmountfromMessage(message);
+ netherWartDistillates += amount;
+ netherWartDistillatesSession += amount;
ConfigHandler.writeIntConfig("blaze", "netherWartDistillates", netherWartDistillates);
- } else if (message.contains("VERY RARE DROP! (Gabagool Distillate)")) {
- gabagoolDistillates++;
- gabagoolDistillatesSession++;
+ } else if (message.contains("VERY RARE DROP! (") && message.contains("Gabagool Distillate)")) {
+ int amount = LootTracker.getAmountfromMessage(message);
+ gabagoolDistillates += amount;
+ gabagoolDistillatesSession += amount;
ConfigHandler.writeIntConfig("blaze", "gabagoolDistillates", gabagoolDistillates);
} else if (message.contains("VERY RARE DROP! (Scorched Power Crystal)")) {
scorchedPowerCrystals++;
@@ -140,8 +145,9 @@ public class BlazeTracker {
ConfigHandler.writeIntConfig("blaze", "fieryBurstRunes", fieryBurstRunes);
if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.RED + "FIERY BURST RUNE!", 5);
} else if (message.contains("VERY RARE DROP! (") && message.contains(" Flawed Opal Gemstone)")) {
- opalGems++;
- opalGemsSession++;
+ int amount = LootTracker.getAmountfromMessage(message);
+ opalGems += amount;
+ opalGemsSession += amount;
ConfigHandler.writeIntConfig("blaze", "opalGems", opalGems);
} else if (message.contains("VERY RARE DROP! (Archfiend Dice)")) {
archfiendDice++;
diff --git a/src/main/java/me/Danker/features/loot/LootTracker.java b/src/main/java/me/Danker/features/loot/LootTracker.java
index 27f0779..d654109 100644
--- a/src/main/java/me/Danker/features/loot/LootTracker.java
+++ b/src/main/java/me/Danker/features/loot/LootTracker.java
@@ -8,10 +8,13 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class LootTracker {
public static long itemsChecked = 0;
+ static Pattern dropPattern = Pattern.compile(".*? \\((?<amount>\\d+)x .*\\).*");
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onSound(PlaySoundEvent event) {
@@ -59,11 +62,11 @@ public class LootTracker {
}
public static int getAmountfromMessage(String message) {
- if (message.charAt(message.indexOf("(") + 2) == 'x' || message.charAt(message.indexOf("(") + 3) == 'x') {
- return Integer.parseInt(message.substring(message.indexOf("(") + 1, message.indexOf("x")));
- } else {
- return 1;
+ Matcher matcher = dropPattern.matcher(message);
+ if (matcher.find()) {
+ return Integer.parseInt(matcher.group("amount"));
}
+ return 1;
}
}