aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky
diff options
context:
space:
mode:
authorKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2024-03-12 20:23:40 -0400
committerKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2024-03-12 20:23:40 -0400
commitfaa2c51bb936ee729dee7aca30dc276a9264edfc (patch)
tree80f89a62bea417a6beac5b31f95edffb5aee0a59 /src/main/java/de/hysky
parent26cf371c823d36bb289577914b3f52ffd4b924d5 (diff)
downloadSkyblocker-faa2c51bb936ee729dee7aca30dc276a9264edfc.tar.gz
Skyblocker-faa2c51bb936ee729dee7aca30dc276a9264edfc.tar.bz2
Skyblocker-faa2c51bb936ee729dee7aca30dc276a9264edfc.zip
Fix fairy and enigma souls profile loading and add chat profile detection
Diffstat (limited to 'src/main/java/de/hysky')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/rift/EnigmaSouls.java2
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/waypoint/FairySouls.java4
-rw-r--r--src/main/java/de/hysky/skyblocker/utils/Utils.java14
3 files changed, 14 insertions, 6 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/rift/EnigmaSouls.java b/src/main/java/de/hysky/skyblocker/skyblock/rift/EnigmaSouls.java
index aa55a4e3..8d0c30b8 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/rift/EnigmaSouls.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/rift/EnigmaSouls.java
@@ -71,7 +71,7 @@ public class EnigmaSouls {
try (BufferedReader reader = Files.newBufferedReader(FOUND_SOULS_FILE)) {
for (Map.Entry<String, JsonElement> profile : JsonParser.parseReader(reader).getAsJsonObject().asMap().entrySet()) {
for (JsonElement foundSoul : profile.getValue().getAsJsonArray().asList()) {
- SOUL_WAYPOINTS.get(PosUtils.parsePosString(foundSoul.getAsString())).setFound();
+ SOUL_WAYPOINTS.get(PosUtils.parsePosString(foundSoul.getAsString())).setFound(profile.getKey());
}
}
} catch (NoSuchFileException ignored) {
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/waypoint/FairySouls.java b/src/main/java/de/hysky/skyblocker/skyblock/waypoint/FairySouls.java
index f0e94770..276b0eee 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/waypoint/FairySouls.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/waypoint/FairySouls.java
@@ -52,7 +52,7 @@ public class FairySouls {
@SuppressWarnings("UnusedReturnValue")
public static CompletableFuture<Void> runAsyncAfterFairySoulsLoad(Runnable runnable) {
if (fairySoulsLoaded == null) {
- LOGGER.error("Fairy Souls have not being initialized yet! Please ensure the Fairy Souls module is initialized before modules calling this method in SkyblockerMod#onInitializeClient. This error can be safely ignore in a test environment.");
+ LOGGER.error("[Skyblocker] Fairy Souls have not being initialized yet! Please ensure the Fairy Souls module is initialized before modules calling this method in SkyblockerMod#onInitializeClient. This error can be safely ignore in a test environment.");
return CompletableFuture.completedFuture(null);
}
return fairySoulsLoaded.thenRunAsync(runnable);
@@ -79,7 +79,7 @@ public class FairySouls {
try (BufferedReader reader = Files.newBufferedReader(SkyblockerMod.CONFIG_DIR.resolve("found_fairy_souls.json"))) {
for (Map.Entry<String, JsonElement> foundFairiesForProfileJson : JsonParser.parseReader(reader).getAsJsonObject().asMap().entrySet()) {
for (Map.Entry<String, JsonElement> foundFairiesForLocationJson : foundFairiesForProfileJson.getValue().getAsJsonObject().asMap().entrySet()) {
- String profile = foundFairiesForLocationJson.getKey();
+ String profile = foundFairiesForProfileJson.getKey();
Map<BlockPos, ProfileAwareWaypoint> fairiesForLocation = fairySouls.get(profile);
for (JsonElement foundFairy : foundFairiesForLocationJson.getValue().getAsJsonArray().asList()) {
fairiesForLocation.get(PosUtils.parsePosString(foundFairy.getAsString())).setFound(profile);
diff --git a/src/main/java/de/hysky/skyblocker/utils/Utils.java b/src/main/java/de/hysky/skyblocker/utils/Utils.java
index 08d0b167..00289793 100644
--- a/src/main/java/de/hysky/skyblocker/utils/Utils.java
+++ b/src/main/java/de/hysky/skyblocker/utils/Utils.java
@@ -37,6 +37,8 @@ public class Utils {
private static final String ALTERNATE_HYPIXEL_ADDRESS = System.getProperty("skyblocker.alternateHypixelAddress", "");
private static final String PROFILE_PREFIX = "Profile: ";
+ private static final String PROFILE_MESSAGE_PREFIX = "§aYou are playing on profile: §e";
+ public static final String PROFILE_ID_PREFIX = "Profile ID: ";
private static boolean isOnHypixel = false;
private static boolean isOnSkyblock = false;
private static boolean isInjected = false;
@@ -424,10 +426,16 @@ public class Utils {
return shouldFilter;
}
- if (isOnSkyblock && message.startsWith("Profile ID: ")) {
- profileId = message.replace("Profile ID: ", "");
+ if (isOnSkyblock) {
+ if (message.startsWith(PROFILE_MESSAGE_PREFIX)) {
+ profile = message.substring(PROFILE_MESSAGE_PREFIX.length(), message.indexOf("§b"));
+ }
- MuseumItemCache.tick(profileId);
+ if (message.startsWith(PROFILE_ID_PREFIX)) {
+ profileId = message.substring(PROFILE_ID_PREFIX.length());
+
+ MuseumItemCache.tick(profileId);
+ }
}
return true;