aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-07 03:11:17 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-07 03:11:17 +0100
commit0c711242c8d96517e49e0ecc7a081f8e15cdd7ed (patch)
treeb890f54d39478f0dab45e9fa986eae01d4de7ca3 /src/main
parentce0956ac232f444724f90f0633b4b35f3dd8cfdf (diff)
downloadskyhanni-0c711242c8d96517e49e0ecc7a081f8e15cdd7ed.tar.gz
skyhanni-0c711242c8d96517e49e0ecc7a081f8e15cdd7ed.tar.bz2
skyhanni-0c711242c8d96517e49e0ecc7a081f8e15cdd7ed.zip
Introduced IslandType enum.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt24
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/IslandType.kt22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt5
9 files changed, 60 insertions, 20 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt
index e1c466762..24738893f 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt
@@ -17,7 +17,7 @@ class HyPixelData {
companion object {
var hypixel = false
var skyBlock = false
- var skyBlockIsland: String = ""
+ var skyBlockIsland = IslandType.UNKNOWN
//Ironman, Stranded and Bingo
var noTrade = false
@@ -133,14 +133,24 @@ class HyPixelData {
guesting = true
}
}
- if (guesting) {
- newIsland = "$newIsland guesting"
+
+ var islandType = IslandType.getBySidebarName(newIsland)
+
+ if (islandType == IslandType.PRIVATE_ISLAND) {
+ if (guesting) {
+ islandType = IslandType.PRIVATE_ISLAND_GUEST
+ }
}
- if (skyBlockIsland != newIsland) {
- IslandChangeEvent(newIsland, skyBlockIsland).postAndCatch()
- loggerIslandChange.log(newIsland)
- skyBlockIsland = newIsland
+ if (skyBlockIsland != islandType) {
+ IslandChangeEvent(islandType, skyBlockIsland).postAndCatch()
+ if (islandType == IslandType.UNKNOWN) {
+ println("Unknown island detected: '$newIsland'")
+ loggerIslandChange.log("Unknown: '$newIsland'")
+ } else {
+ loggerIslandChange.log(islandType.name)
+ }
+ skyBlockIsland = islandType
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt
new file mode 100644
index 000000000..527cce548
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt
@@ -0,0 +1,22 @@
+package at.hannibal2.skyhanni.data
+
+enum class IslandType(val displayName: String) {
+ PRIVATE_ISLAND("Private Island"),
+ PRIVATE_ISLAND_GUEST("Private Island Guest"),
+ THE_END("The End"),
+ KUUDRA_ARENA("Instanced"),
+ CRIMSON_ISLE("Crimson Isle"),
+
+ HUB("Hub"),
+ THE_FARMING_ISLANDS("The Farming Islands"),
+
+ NONE(""),
+ UNKNOWN("???"),
+ ;
+
+ companion object {
+ fun getBySidebarName(name: String): IslandType {
+ return values().firstOrNull { it.displayName == name } ?: UNKNOWN
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt
index 2dec9acad..291ccd995 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt
@@ -1,3 +1,5 @@
package at.hannibal2.skyhanni.events
-class IslandChangeEvent(val newIsland: String, val oldIsland: String?) : LorenzEvent() \ No newline at end of file
+import at.hannibal2.skyhanni.data.IslandType
+
+class IslandChangeEvent(val newIsland: IslandType, val oldIsland: IslandType) : LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt b/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt
index 6f6a083d8..c9b02bf5d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.end
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.RenderMobColoredEvent
import at.hannibal2.skyhanni.events.ResetEntityHurtEvent
import at.hannibal2.skyhanni.events.withAlpha
@@ -54,5 +55,5 @@ class VoidlingExtremistColor {
}
private fun isEnabled(): Boolean =
- LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == "The End" && SkyHanniMod.feature.misc.voidlingExtremistColor
+ LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.THE_END && SkyHanniMod.feature.misc.voidlingExtremistColor
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
index 707c36405..ee72ff542 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.minion
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
@@ -48,7 +49,7 @@ class MinionFeatures {
@SubscribeEvent
fun onClick(event: InputEvent.MouseInputEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (LorenzUtils.skyBlockIsland != "Private Island") return
+ if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return
if (!Mouse.getEventButtonState()) return
if (Mouse.getEventButton() != 1) return
@@ -63,7 +64,7 @@ class MinionFeatures {
@SubscribeEvent
fun onRenderLastClickedMinion(event: RenderWorldLastEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (LorenzUtils.skyBlockIsland != "Private Island") return
+ if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return
if (!SkyHanniMod.feature.minions.lastClickedMinionDisplay) return
val special = SkyHanniMod.feature.minions.lastOpenedMinionColor
@@ -87,7 +88,7 @@ class MinionFeatures {
@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
- if (LorenzUtils.skyBlockIsland != "Private Island") return
+ if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return
if (InventoryUtils.currentlyOpenInventory().contains("Minion")) {
if (lastClickedEntity != null) {
@@ -175,7 +176,7 @@ class MinionFeatures {
@SubscribeEvent
fun onChatMessage(event: LorenzChatEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (LorenzUtils.skyBlockIsland != "Private Island") return
+ if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return
if (event.message.matchRegex("§aYou received §r§6(.*) coins§r§a!")) {
lastCoinsRecived = System.currentTimeMillis()
@@ -189,7 +190,7 @@ class MinionFeatures {
fun onRenderLastEmptied(event: RenderWorldLastEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!SkyHanniMod.feature.minions.emptiedTimeDisplay) return
- if (LorenzUtils.skyBlockIsland != "Private Island") return
+ if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return
val playerLocation = LocationUtils.playerLocation()
val playerEyeLocation = LocationUtils.playerEyeLocation()
@@ -211,7 +212,7 @@ class MinionFeatures {
@SubscribeEvent(priority = EventPriority.HIGH)
fun onRenderLiving(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) {
if (!LorenzUtils.inSkyBlock) return
- if (LorenzUtils.skyBlockIsland != "Private Island") return
+ if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return
if (!SkyHanniMod.feature.minions.hideMobsNametagNearby) return
val entity = event.entity
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt
index d2ab1725a..0b4effca4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent
import at.hannibal2.skyhanni.events.RenderMobColoredEvent
import at.hannibal2.skyhanni.events.ResetEntityHurtEvent
@@ -56,6 +57,6 @@ class CorruptedMobHighlight {
private fun isEnabled(): Boolean {
return LorenzUtils.inSkyBlock && SkyHanniMod.feature.misc.corruptedMobHighlight &&
- LorenzUtils.skyBlockIsland != "Private Island"
+ LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt
index 2d25076a9..8a9cad4fa 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.nether
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.RenderMobColoredEvent
import at.hannibal2.skyhanni.events.ResetEntityHurtEvent
import at.hannibal2.skyhanni.events.withAlpha
@@ -54,5 +55,5 @@ class MilleniaAgedBlazeColor {
}
private fun isEnabled() =
- LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == "Crimson Isle" && SkyHanniMod.feature.misc.milleniaAgedBlazeColor
+ LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.CRIMSON_ISLE && SkyHanniMod.feature.misc.milleniaAgedBlazeColor
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt
index df3c5117f..a36db4820 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.slayer
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.events.RenderMobColoredEvent
@@ -100,7 +101,7 @@ class EndermanSlayerBeacon {
private fun isEnabled(): Boolean = LorenzUtils.inSkyBlock &&
SkyHanniMod.feature.slayer.slayerEndermanBeacon &&
- LorenzUtils.skyBlockIsland == "The End" &&
+ LorenzUtils.skyBlockIsland == IslandType.THE_END &&
DamageIndicatorManager.isBossSpawned(
BossType.SLAYER_ENDERMAN_2,
BossType.SLAYER_ENDERMAN_3,
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index 8140cddfa..043978277 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.utils
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.HyPixelData
+import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.features.dungeon.DungeonData
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraft.client.Minecraft
@@ -23,7 +24,7 @@ object LorenzUtils {
val inDungeons: Boolean
get() = inSkyBlock && DungeonData.inDungeon()
- val skyBlockIsland: String
+ val skyBlockIsland: IslandType
get() = HyPixelData.skyBlockIsland
//TODO add cache
@@ -31,7 +32,7 @@ object LorenzUtils {
get() = HyPixelData.readSkyBlockArea()
val inKuudraFight: Boolean
- get() = skyBlockIsland == "Instanced"
+ get() = skyBlockIsland == IslandType.KUUDRA_ARENA
val noTradeMode: Boolean
get() = HyPixelData.noTrade