aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoringlettronald <inglettronald@gmail.com>2023-04-18 12:46:19 -0500
committeringlettronald <inglettronald@gmail.com>2023-04-18 12:46:19 -0500
commit3586217aa1d08458d81a4eb15e5b38e42793f68b (patch)
tree435bf47a5a1b9033d4e6b0a2d5212e099039961f
parente933913ebe88f6b465ee862374bbd26c57906cae (diff)
downloadDulkirMod-3586217aa1d08458d81a4eb15e5b38e42793f68b.tar.gz
DulkirMod-3586217aa1d08458d81a4eb15e5b38e42793f68b.tar.bz2
DulkirMod-3586217aa1d08458d81a4eb15e5b38e42793f68b.zip
change to location semantics
-rw-r--r--src/main/kotlin/dulkirmod/DulkirMod.kt2
-rw-r--r--src/main/kotlin/dulkirmod/config/DulkirConfig.kt6
-rw-r--r--src/main/kotlin/dulkirmod/features/HideHealerFairy.kt4
-rw-r--r--src/main/kotlin/dulkirmod/features/chat/DungeonKeyDisplay.kt2
-rw-r--r--src/main/kotlin/dulkirmod/features/chat/ThrottleNotif.kt2
-rw-r--r--src/main/kotlin/dulkirmod/huds/GardenInfoHud.kt (renamed from src/main/kotlin/dulkirmod/Huds/GardenInfoHud.kt)4
-rw-r--r--src/main/kotlin/dulkirmod/huds/KeyHud.kt (renamed from src/main/kotlin/dulkirmod/Huds/KeyHud.kt)4
-rw-r--r--src/main/kotlin/dulkirmod/huds/YawDisplayHud.kt (renamed from src/main/kotlin/dulkirmod/Huds/YawDisplayHud.kt)4
-rw-r--r--src/main/kotlin/dulkirmod/utils/TablistUtils.kt14
9 files changed, 22 insertions, 20 deletions
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt
index b685b2d..77930c3 100644
--- a/src/main/kotlin/dulkirmod/DulkirMod.kt
+++ b/src/main/kotlin/dulkirmod/DulkirMod.kt
@@ -1,11 +1,11 @@
package dulkirmod
-import dulkirmod.Huds.KeyHud
import dulkirmod.command.*
import dulkirmod.config.DulkirConfig
import dulkirmod.events.ChatEvent
import dulkirmod.features.*
import dulkirmod.features.chat.AbiphoneDND
+import dulkirmod.huds.KeyHud
import dulkirmod.utils.ContainerNameUtil
import dulkirmod.utils.TabListUtils
import dulkirmod.utils.TextUtils
diff --git a/src/main/kotlin/dulkirmod/config/DulkirConfig.kt b/src/main/kotlin/dulkirmod/config/DulkirConfig.kt
index cd914ff..c9b5808 100644
--- a/src/main/kotlin/dulkirmod/config/DulkirConfig.kt
+++ b/src/main/kotlin/dulkirmod/config/DulkirConfig.kt
@@ -5,9 +5,9 @@ import cc.polyfrost.oneconfig.config.annotations.*
import cc.polyfrost.oneconfig.config.data.Mod
import cc.polyfrost.oneconfig.config.data.ModType
import dulkirmod.DulkirMod
-import dulkirmod.Huds.GardenInfoHud
-import dulkirmod.Huds.KeyHud
-import dulkirmod.Huds.YawDisplayHud
+import dulkirmod.huds.GardenInfoHud
+import dulkirmod.huds.KeyHud
+import dulkirmod.huds.YawDisplayHud
import dulkirmod.utils.Utils
diff --git a/src/main/kotlin/dulkirmod/features/HideHealerFairy.kt b/src/main/kotlin/dulkirmod/features/HideHealerFairy.kt
index 43475b1..d77d0f7 100644
--- a/src/main/kotlin/dulkirmod/features/HideHealerFairy.kt
+++ b/src/main/kotlin/dulkirmod/features/HideHealerFairy.kt
@@ -2,7 +2,7 @@ package dulkirmod.features
import dulkirmod.DulkirMod.Companion.config
-import dulkirmod.utils.TabListUtils.isInDungeons
+import dulkirmod.utils.TabListUtils
import net.minecraft.entity.Entity
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.init.Items
@@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
object HideHealerFairy {
fun handle(entity: Entity, cir: CallbackInfoReturnable<Boolean>) {
if (!config.hideHealerFairy) return
- if (!isInDungeons) return
+ if (TabListUtils.area != "Dungeon") return
if (entity is EntityArmorStand) {
if (entity.heldItem != null && entity.heldItem.item === Items.skull) {
val stack = entity.heldItem
diff --git a/src/main/kotlin/dulkirmod/features/chat/DungeonKeyDisplay.kt b/src/main/kotlin/dulkirmod/features/chat/DungeonKeyDisplay.kt
index 2ba01f0..d31de56 100644
--- a/src/main/kotlin/dulkirmod/features/chat/DungeonKeyDisplay.kt
+++ b/src/main/kotlin/dulkirmod/features/chat/DungeonKeyDisplay.kt
@@ -10,7 +10,7 @@ object DungeonKeyDisplay {
private val altOpenMessage = "The BLOOD DOOR has been opened!".toRegex()
var hasKey = false;
fun handle(stringUnformatted: String) {
- if (!TabListUtils.isInDungeons) {
+ if (TabListUtils.area != "Dungeon") {
hasKey = false
return
}
diff --git a/src/main/kotlin/dulkirmod/features/chat/ThrottleNotif.kt b/src/main/kotlin/dulkirmod/features/chat/ThrottleNotif.kt
index 736ee43..a6697ef 100644
--- a/src/main/kotlin/dulkirmod/features/chat/ThrottleNotif.kt
+++ b/src/main/kotlin/dulkirmod/features/chat/ThrottleNotif.kt
@@ -10,7 +10,7 @@ object ThrottleNotif {
private var lastThrottle: Long = 0
fun handle(event: ClientChatReceivedEvent, unformatted: String) {
if (unformatted == "This menu has been throttled! Please slow down..." && DulkirMod.config.throttleNotifier
- && TabListUtils.isInDungeons
+ && TabListUtils.area == "Dungeon"
) {
event.isCanceled = true
if (!DulkirConfig.throttleNotifierSpam && System.currentTimeMillis() - lastThrottle > 8000) {
diff --git a/src/main/kotlin/dulkirmod/Huds/GardenInfoHud.kt b/src/main/kotlin/dulkirmod/huds/GardenInfoHud.kt
index f4d1afb..0a8ba9e 100644
--- a/src/main/kotlin/dulkirmod/Huds/GardenInfoHud.kt
+++ b/src/main/kotlin/dulkirmod/huds/GardenInfoHud.kt
@@ -1,11 +1,11 @@
-package dulkirmod.Huds
+package dulkirmod.huds
import cc.polyfrost.oneconfig.hud.TextHud
import dulkirmod.config.DulkirConfig
import dulkirmod.utils.TabListUtils
import dulkirmod.utils.Utils
-class GardenInfoHud : TextHud(true) {
+class GardenInfoHud : TextHud(false) {
override fun getLines(lines: MutableList<String>?, example: Boolean) {
if (!Utils.isInSkyblock()) return
if (TabListUtils.area != "Garden") return
diff --git a/src/main/kotlin/dulkirmod/Huds/KeyHud.kt b/src/main/kotlin/dulkirmod/huds/KeyHud.kt
index 5b0c1df..597696e 100644
--- a/src/main/kotlin/dulkirmod/Huds/KeyHud.kt
+++ b/src/main/kotlin/dulkirmod/huds/KeyHud.kt
@@ -1,9 +1,9 @@
-package dulkirmod.Huds
+package dulkirmod.huds
import cc.polyfrost.oneconfig.hud.TextHud
import dulkirmod.features.chat.DungeonKeyDisplay
-class KeyHud : TextHud(true) {
+class KeyHud : TextHud(false) {
override fun getLines(lines: MutableList<String>?, example: Boolean) {
if (example) {
diff --git a/src/main/kotlin/dulkirmod/Huds/YawDisplayHud.kt b/src/main/kotlin/dulkirmod/huds/YawDisplayHud.kt
index 610ee08..92c40f9 100644
--- a/src/main/kotlin/dulkirmod/Huds/YawDisplayHud.kt
+++ b/src/main/kotlin/dulkirmod/huds/YawDisplayHud.kt
@@ -1,4 +1,4 @@
-package dulkirmod.Huds
+package dulkirmod.huds
import cc.polyfrost.oneconfig.hud.TextHud
import dulkirmod.DulkirMod.Companion.mc
@@ -6,7 +6,7 @@ import dulkirmod.config.DulkirConfig
import dulkirmod.utils.TabListUtils
import dulkirmod.utils.Utils
-class YawDisplayHud : TextHud(true) {
+class YawDisplayHud : TextHud(false) {
override fun getLines(lines: MutableList<String>?, example: Boolean) {
if (!Utils.isInSkyblock()) return
if (TabListUtils.area != "Garden") return
diff --git a/src/main/kotlin/dulkirmod/utils/TablistUtils.kt b/src/main/kotlin/dulkirmod/utils/TablistUtils.kt
index af4512b..8bad6be 100644
--- a/src/main/kotlin/dulkirmod/utils/TablistUtils.kt
+++ b/src/main/kotlin/dulkirmod/utils/TablistUtils.kt
@@ -13,7 +13,6 @@ val NetworkPlayerInfo.text: String
object TabListUtils {
var area: String = ""
var explosivity: Boolean = false
- var isInDungeons: Boolean = false
var maxVisitors: Boolean = false
var emptyComposter: Boolean = false
var gardenMilestone: String = ""
@@ -53,8 +52,8 @@ object TabListUtils {
fun parseTabEntries() {
// exploFlag is just telling the loop that the next line is the relevant tab entry
var exploFlag = false
+ var numVisitorsFlag = false
// dungeonFlag keeps track of whether we've found the in-dungeons state.
- var dungeonFlag = false
val scoreboardList: List<String> = fetchTabEntries().mapNotNull {
it.displayName?.unformattedText
}
@@ -71,9 +70,11 @@ object TabListUtils {
}
}
line == " Dungeon Stats" -> {
- isInDungeons = true
+ area = "Dungeon"
+ }
+ line.startsWith(" Time Left:") -> {
+ emptyComposter = (line.substring(12) == "INACTIVE")
}
- line == " Time Left: INACTIVE" -> emptyComposter = true
line.startsWith(" Milestone") -> gardenMilestone = line.substring(1)
line.startsWith(" Next Visitor:") -> {
timeTillNextVisitor = line.substring(15)
@@ -81,6 +82,7 @@ object TabListUtils {
}
line.startsWith("Visitors:") -> {
numVisitors = line.substring(11, 12).toInt() // TODO: FIX WHEN THEY ADD THE TENTH VISITOR
+ numVisitorsFlag = true
}
}
}
@@ -91,8 +93,8 @@ object TabListUtils {
if (area != "Garden") {
maxVisitors = false
}
- if (!isInDungeons) {
- isInDungeons = false
+ if (!numVisitorsFlag) {
+ numVisitors = 0
}
}
} \ No newline at end of file