aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorviciscat <51047087+viciscat@users.noreply.github.com>2024-07-07 23:33:07 +0200
committerviciscat <51047087+viciscat@users.noreply.github.com>2024-12-12 18:19:05 +0100
commite518d2217766e32100653c502bd95aab073d8090 (patch)
treec46abf36fad567255b2d92d4e8689cd1b33538fe /src/main/java
parentf05d0c453d2b1acf2d9342d1e454be9bb4ac21eb (diff)
downloadSkyblocker-e518d2217766e32100653c502bd95aab073d8090.tar.gz
Skyblocker-e518d2217766e32100653c502bd95aab073d8090.tar.bz2
Skyblocker-e518d2217766e32100653c502bd95aab073d8090.zip
java doc
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/tabhud/util/PlayerListMgr.java17
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/tabhud/util/PlayerLocator.java88
2 files changed, 17 insertions, 88 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/util/PlayerListMgr.java b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/util/PlayerListMgr.java
index 35fbdd28..81eaeae7 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/util/PlayerListMgr.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/util/PlayerListMgr.java
@@ -89,6 +89,10 @@ public class PlayerListMgr {
}
+ /**
+ * Update specifically for dungeons cuz they don't use the new system I HATE THEM
+ * @param lines used for the config screen
+ */
public static void updateDungeons(List<Text> lines) {
if (lines != null) {
// This is so wack I hate this
@@ -112,6 +116,10 @@ public class PlayerListMgr {
}
+ /**
+ * Update the tab widgets using a list of text representing the lines of the in-game TAB
+ * @param lines in-game TAB
+ */
public static void updateWidgetsFrom(List<Text> lines) {
final Predicate<String> playersColumnPredicate = PLAYERS_COLUMN_PATTERN.asMatchPredicate();
final Predicate<String> infoColumnPredicate = INFO_COLUMN_PATTERN.asMatchPredicate();
@@ -217,6 +225,15 @@ public class PlayerListMgr {
return getTabHudWidget(IntObjectPair.of(0xFFFF0000, hypixelWidgetName), lines);
}
+ /**
+ *
+ * @param text a line of text that contains a : from the tab
+ * @return a pair containing:
+ * <ul>
+ * <li> an int and string pair for the color and the widget name </li>
+ * <li> a text with the extra info sometimes shown on the right of the : </li>
+ * </ul>
+ */
private static Pair<IntObjectPair<String>, ? extends Text> getNameAndInfo(Text text) {
ObjectObjectMutablePair<String, MutableText> toReturn = new ObjectObjectMutablePair<>("", Text.empty());
AtomicBoolean inInfo = new AtomicBoolean(false);
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/util/PlayerLocator.java b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/util/PlayerLocator.java
deleted file mode 100644
index 7aec604f..00000000
--- a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/util/PlayerLocator.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package de.hysky.skyblocker.skyblock.tabhud.util;
-
-import de.hysky.skyblocker.utils.Utils;
-
-/**
- * Uses data from the player list to determine the area the player is in.
- */
-public class PlayerLocator {
-
- public enum Location {
- DUNGEON("dungeon"),
- GUEST_ISLAND("guest_island"),
- HOME_ISLAND("home_island"),
- CRIMSON_ISLE("crimson_isle"),
- DUNGEON_HUB("dungeon_hub"),
- FARMING_ISLAND("farming_island"),
- PARK("park"),
- DWARVEN_MINES("dwarven_mines"),
- CRYSTAL_HOLLOWS("crystal_hollows"),
- END("end"),
- GOLD_MINE("gold_mine"),
- DEEP_CAVERNS("deep_caverns"),
- HUB("hub"),
- SPIDER_DEN("spider_den"),
- JERRY("jerry_workshop"),
- GARDEN("garden"),
- INSTANCED("kuudra"),
- THE_RIFT("rift"),
- DARK_AUCTION("dark_auction"),
- GLACITE_MINESHAFT("mineshaft"),
- UNKNOWN("unknown");
-
- public final String internal;
-
- Location(String i) {
- // as used internally by the mod, e.g. in the json
- this.internal = i;
- }
-
- }
-
- public static Location getPlayerLocation() {
-
- if (!Utils.isOnSkyblock()) {
- return Location.UNKNOWN;
- }
-
- String areaDescriptor = PlayerListMgr.strAt(41);
-
- if (areaDescriptor == null || areaDescriptor.length() < 6) {
- return Location.UNKNOWN;
- }
-
- if (areaDescriptor.startsWith("Dungeon")) {
- return Location.DUNGEON;
- }
-
- return switch (areaDescriptor.substring(6)) {
- case "Private Island" -> {
- String islandType = PlayerListMgr.strAt(44);
- if (islandType == null) {
- yield Location.UNKNOWN;
- } else if (islandType.endsWith("Guest")) {
- yield Location.GUEST_ISLAND;
- } else {
- yield Location.HOME_ISLAND;
- }
- }
- case "Crimson Isle" -> Location.CRIMSON_ISLE;
- case "Dungeon Hub" -> Location.DUNGEON_HUB;
- case "The Farming Islands" -> Location.FARMING_ISLAND;
- case "The Park" -> Location.PARK;
- case "Dwarven Mines" -> Location.DWARVEN_MINES;
- case "Crystal Hollows" -> Location.CRYSTAL_HOLLOWS;
- case "The End" -> Location.END;
- case "Gold Mine" -> Location.GOLD_MINE;
- case "Deep Caverns" -> Location.DEEP_CAVERNS;
- case "Hub" -> Location.HUB;
- case "Spider's Den" -> Location.SPIDER_DEN;
- case "Jerry's Workshop" -> Location.JERRY;
- case "Garden" -> Location.GARDEN;
- case "Instanced" -> Location.INSTANCED;
- case "The Rift" -> Location.THE_RIFT;
- case "Dark Auction" -> Location.DARK_AUCTION;
- default -> Location.UNKNOWN;
- };
- }
-}