aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/SBData.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/util/SBData.kt')
-rw-r--r--src/main/kotlin/util/SBData.kt12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/kotlin/util/SBData.kt b/src/main/kotlin/util/SBData.kt
index 1a4734c..b3f162b 100644
--- a/src/main/kotlin/util/SBData.kt
+++ b/src/main/kotlin/util/SBData.kt
@@ -18,6 +18,10 @@ object SBData {
"CLICK THIS TO SUGGEST IT IN CHAT [DASHES]",
"CLICK THIS TO SUGGEST IT IN CHAT [NO DASHES]",
)
+
+ val NULL_UUID = UUID(0L, 0L)
+ val profileIdOrNil get() = profileId ?: NULL_UUID
+
var profileId: UUID? = null
get() {
// TODO: allow unfiltered access to this somehow
@@ -37,6 +41,12 @@ object SBData {
*/
val skyblockLocation: SkyBlockIsland? get() = locraw?.skyblockLocation
val hasValidLocraw get() = locraw?.server !in listOf("limbo", null)
+
+ /**
+ * Check if the player is currently on skyblock.
+ *
+ * Nota bene: We don't generally disable features outside of SkyBlock unless they could lead to bans.
+ */
val isOnSkyblock get() = locraw?.gametype == "SKYBLOCK"
var profileIdCommandDebounce = TimeMark.farPast()
fun init() {
@@ -61,7 +71,7 @@ object SBData {
SkyblockServerUpdateEvent.subscribe("SBData:sendProfileId") {
if (!hasReceivedProfile && isOnSkyblock && profileIdCommandDebounce.passedTime() > 10.seconds) {
profileIdCommandDebounce = TimeMark.now()
- MC.sendServerCommand("profileid")
+ MC.sendCommand("profileid")
}
}
AllowChatEvent.subscribe("SBData:hideProfileSuggest") { event ->