aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/Danker/features')
-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;
}
}