From e518d2217766e32100653c502bd95aab073d8090 Mon Sep 17 00:00:00 2001 From: viciscat <51047087+viciscat@users.noreply.github.com> Date: Sun, 7 Jul 2024 23:33:07 +0200 Subject: java doc --- .../skyblock/tabhud/util/PlayerListMgr.java | 17 +++++ .../skyblock/tabhud/util/PlayerLocator.java | 88 ---------------------- 2 files changed, 17 insertions(+), 88 deletions(-) delete mode 100644 src/main/java/de/hysky/skyblocker/skyblock/tabhud/util/PlayerLocator.java (limited to 'src/main/java') 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 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 lines) { final Predicate playersColumnPredicate = PLAYERS_COLUMN_PATTERN.asMatchPredicate(); final Predicate 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: + *
    + *
  • an int and string pair for the color and the widget name
  • + *
  • a text with the extra info sometimes shown on the right of the :
  • + *
+ */ private static Pair, ? extends Text> getNameAndInfo(Text text) { ObjectObjectMutablePair 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; - }; - } -} -- cgit