aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de
diff options
context:
space:
mode:
authorAaron <51387595+AzureAaron@users.noreply.github.com>2024-09-28 17:12:33 -0400
committerGitHub <noreply@github.com>2024-09-28 17:12:33 -0400
commit3b344cdeee980a3eaf8609b983a4aafb189a6f46 (patch)
treeebd2b016e01f8aea3f49f668093c8cd9ec5dd999 /src/main/java/de
parent9bccc63d33fc07aa735832ef289ae82af012acde (diff)
parentab7dcd8d4493ef46dde851f9ebde87923e57035b (diff)
downloadSkyblocker-3b344cdeee980a3eaf8609b983a4aafb189a6f46.tar.gz
Skyblocker-3b344cdeee980a3eaf8609b983a4aafb189a6f46.tar.bz2
Skyblocker-3b344cdeee980a3eaf8609b983a4aafb189a6f46.zip
Merge pull request #1011 from AzureAaron/some-other-fixes
Some Other fixes
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/chat/SkyblockXpMessages.java14
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dungeon/puzzle/Trivia.java11
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/adders/AvgBinTooltip.java10
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/info/DataTooltipInfoType.java1
4 files changed, 21 insertions, 15 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/chat/SkyblockXpMessages.java b/src/main/java/de/hysky/skyblocker/skyblock/chat/SkyblockXpMessages.java
index 2162da77..0e46115b 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/chat/SkyblockXpMessages.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/chat/SkyblockXpMessages.java
@@ -27,12 +27,16 @@ public class SkyblockXpMessages {
if (Utils.isOnSkyblock() && overlay && SkyblockerConfigManager.get().chat.skyblockXpMessages) {
String message = text.getString();
Matcher matcher = SKYBLOCK_XP_PATTERN.matcher(message);
- int hash = message.hashCode();
- if (matcher.find() && !RECENT_MESSAGES.contains(hash)) {
- CLIENT.player.sendMessage(Constants.PREFIX.get().append(matcher.group()));
- RECENT_MESSAGES.add(hash);
- Scheduler.INSTANCE.schedule(() -> RECENT_MESSAGES.remove(hash), 20 * 10);
+ if (matcher.find()) {
+ String xpMessage = matcher.group();
+ int hash = xpMessage.hashCode();
+
+ if (!RECENT_MESSAGES.contains(hash)) {
+ CLIENT.player.sendMessage(Constants.PREFIX.get().append(xpMessage));
+ RECENT_MESSAGES.add(hash);
+ Scheduler.INSTANCE.schedule(() -> RECENT_MESSAGES.remove(hash), 20 * 10);
+ }
}
}
}
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/puzzle/Trivia.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/puzzle/Trivia.java
index 874907c3..b1954d50 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/puzzle/Trivia.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/puzzle/Trivia.java
@@ -2,6 +2,7 @@ package de.hysky.skyblocker.skyblock.dungeon.puzzle;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.skyblock.waypoint.FairySouls;
+import de.hysky.skyblocker.utils.SkyblockTime;
import de.hysky.skyblocker.utils.Utils;
import de.hysky.skyblocker.utils.chat.ChatFilterResult;
import de.hysky.skyblocker.utils.chat.ChatPatternListener;
@@ -24,6 +25,8 @@ public class Trivia extends ChatPatternListener {
private List<String> solutions = Collections.emptyList();
public Trivia() {
+ //FIXME I think its worth replacing this with something less fragile and is capable of handing multiple lines
+ //perhaps manual incremental reading based off the start of a question
super("^ +(?:([A-Za-z,' ]*\\?)| ([ⓐⓑⓒ]) ([a-zA-Z0-9 ]+))$");
}
@@ -50,9 +53,7 @@ public class Trivia extends ChatPatternListener {
try {
String trimmedQuestion = question.trim();
if (trimmedQuestion.equals("What SkyBlock year is it?")) {
- long currentTime = System.currentTimeMillis() / 1000L;
- long diff = currentTime - 1560276000;
- int year = (int) (diff / 446400 + 1);
+ int year = SkyblockTime.skyblockYear.get();
solutions = Collections.singletonList("Year " + year);
} else {
String[] questionAnswers = answers.get(trimmedQuestion);
@@ -79,7 +80,9 @@ public class Trivia extends ChatPatternListener {
answers.put("What is the status of Maxor, Storm, Goldor, and Necron?", new String[]{"The Wither Lords"});
answers.put("Which brother is on the Spider's Den?", new String[]{"Rick"});
answers.put("What is the name of Rick's brother?", new String[]{"Pat"});
- answers.put("What is the name of the Painter in the Hub?", new String[]{"Marco"});
+ //Full Question: "What is the name of the vendor in the Hub who sells stained glass?"
+ //The solver cannot handle multiple lines right now and just sees "glass?" as the question
+ answers.put("glass?", new String[]{"Wool Weaver"});
answers.put("What is the name of the person that upgrades pets?", new String[]{"Kat"});
answers.put("What is the name of the lady of the Nether?", new String[]{"Elle"});
answers.put("Which villager in the Village gives you a Rogue Sword?", new String[]{"Jamie"});
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/adders/AvgBinTooltip.java b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/adders/AvgBinTooltip.java
index 7fe67c7c..827fee74 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/adders/AvgBinTooltip.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/adders/AvgBinTooltip.java
@@ -1,6 +1,6 @@
package de.hysky.skyblocker.skyblock.item.tooltip.adders;
-import de.hysky.skyblocker.config.configs.GeneralConfig;
+import de.hysky.skyblocker.config.configs.GeneralConfig.Average;
import de.hysky.skyblocker.skyblock.item.tooltip.ItemTooltip;
import de.hysky.skyblocker.skyblock.item.tooltip.SimpleTooltipAdder;
import de.hysky.skyblocker.skyblock.item.tooltip.info.TooltipInfoType;
@@ -21,8 +21,9 @@ public class AvgBinTooltip extends SimpleTooltipAdder {
public void addToTooltip(@Nullable Slot focusedSlot, ItemStack stack, List<Text> lines) {
String skyblockApiId = stack.getSkyblockApiId();
String neuName = stack.getNeuName();
+ Average type = ItemTooltip.config.avg;
- if (TooltipInfoType.ONE_DAY_AVERAGE.getData() == null || TooltipInfoType.THREE_DAY_AVERAGE.getData() == null) {
+ if ((TooltipInfoType.ONE_DAY_AVERAGE.getData() == null && type != Average.THREE_DAY) || (TooltipInfoType.THREE_DAY_AVERAGE.getData() == null && type != Average.ONE_DAY)) {
ItemTooltip.nullWarning();
} else {
/*
@@ -30,10 +31,9 @@ public class AvgBinTooltip extends SimpleTooltipAdder {
and enchanted books because there is no data for their in API.
*/
if (!neuName.isEmpty() && TooltipInfoType.LOWEST_BINS.hasOrNullWarning(skyblockApiId)) {
- GeneralConfig.Average type = ItemTooltip.config.avg;
// "No data" line because of API not keeping old data, it causes NullPointerException
- if (type == GeneralConfig.Average.ONE_DAY || type == GeneralConfig.Average.BOTH) {
+ if (type == Average.ONE_DAY || type == Average.BOTH) {
lines.add(
Text.literal(String.format("%-19s", "1 Day Avg. Price:"))
.formatted(Formatting.GOLD)
@@ -43,7 +43,7 @@ public class AvgBinTooltip extends SimpleTooltipAdder {
)
);
}
- if (type == GeneralConfig.Average.THREE_DAY || type == GeneralConfig.Average.BOTH) {
+ if (type == Average.THREE_DAY || type == Average.BOTH) {
lines.add(
Text.literal(String.format("%-19s", "3 Day Avg. Price:"))
.formatted(Formatting.GOLD)
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/info/DataTooltipInfoType.java b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/info/DataTooltipInfoType.java
index 2edacb25..f396e4d3 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/info/DataTooltipInfoType.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/info/DataTooltipInfoType.java
@@ -1,6 +1,5 @@
package de.hysky.skyblocker.skyblock.item.tooltip.info;
-import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.jetbrains.annotations.Nullable;