aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java
diff options
context:
space:
mode:
authorTymanWasTaken <tyman@tyman.tech>2021-07-06 17:13:01 -0400
committerTymanWasTaken <tyman@tyman.tech>2021-07-06 17:13:01 -0400
commitbb75fd7b83b238f1f922ffc64b2a0a535c5524b7 (patch)
tree617c91cced71f672662bddea6c540939cb9a3953 /src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java
parent91464c8f433e8bf323932ac956678971207b607e (diff)
downloadSkyblockHud-Death-Defied-bb75fd7b83b238f1f922ffc64b2a0a535c5524b7.tar.gz
SkyblockHud-Death-Defied-bb75fd7b83b238f1f922ffc64b2a0a535c5524b7.tar.bz2
SkyblockHud-Death-Defied-bb75fd7b83b238f1f922ffc64b2a0a535c5524b7.zip
Format
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java86
1 files changed, 44 insertions, 42 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java
index 274baf8..86f0432 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java
@@ -1,54 +1,56 @@
package com.thatgravyboat.skyblockhud.location;
import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class LocationHandler {
- private static Locations currentLocation = Locations.NONE;
- private static final List<String> UndocumentedLocations = new ArrayList<>();
-
-
- @SubscribeEvent
- public void onSidebarLineUpdate(SidebarLineUpdateEvent event){
- if (event.rawLine.contains("\u23E3")) {
- String objectiveName = event.objective.getDisplayName().replaceAll("(?i)\\u00A7.", "");
- if (objectiveName.toLowerCase(Locale.ENGLISH).endsWith("guest")){
- LocationHandler.setCurrentLocation(Locations.GUESTISLAND);
- }else {
- LocationHandler.handleLocation(event.formattedLine);
- }
- }
- }
-
- public static void setCurrentLocation(String location){
- currentLocation = Locations.get(location);
+ private static Locations currentLocation = Locations.NONE;
+ private static final List<String> UndocumentedLocations = new ArrayList<>();
+
+ @SubscribeEvent
+ public void onSidebarLineUpdate(SidebarLineUpdateEvent event) {
+ if (event.rawLine.contains("\u23E3")) {
+ String objectiveName = event.objective
+ .getDisplayName()
+ .replaceAll("(?i)\\u00A7.", "");
+ if (objectiveName.toLowerCase(Locale.ENGLISH).endsWith("guest")) {
+ LocationHandler.setCurrentLocation(Locations.GUESTISLAND);
+ } else {
+ LocationHandler.handleLocation(event.formattedLine);
+ }
}
-
- public static void setCurrentLocation(Locations location){
- currentLocation = location;
+ }
+
+ public static void setCurrentLocation(String location) {
+ currentLocation = Locations.get(location);
+ }
+
+ public static void setCurrentLocation(Locations location) {
+ currentLocation = location;
+ }
+
+ public static Locations getCurrentLocation() {
+ return currentLocation;
+ }
+
+ public static void handleLocation(String locationLine) {
+ String location = locationLine
+ .replace(" ", "")
+ .toUpperCase(Locale.ENGLISH)
+ .trim();
+ if (location.startsWith("THECATACOMBS")) {
+ currentLocation = Locations.CATACOMBS;
+ } else setCurrentLocation(location.replaceAll("[^A-Za-z0-9]", ""));
+ }
+
+ public static void reportUndocumentedLocation(String locationId) {
+ if (!UndocumentedLocations.contains(locationId)) {
+ UndocumentedLocations.add(locationId);
+ System.out.println("Missing Location value for: " + locationId);
}
-
- public static Locations getCurrentLocation(){ return currentLocation; }
-
- public static void handleLocation(String locationLine){
- String location = locationLine.replace(" ", "").toUpperCase(Locale.ENGLISH).trim();
- if (location.startsWith("THECATACOMBS")){
- currentLocation = Locations.CATACOMBS;
- }
- else setCurrentLocation(location.replaceAll("[^A-Za-z0-9]", ""));
- }
-
-
- public static void reportUndocumentedLocation(String locationId){
- if (!UndocumentedLocations.contains(locationId)){
- UndocumentedLocations.add(locationId);
- System.out.println("Missing Location value for: " + locationId);
- }
- }
-
+ }
}