aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-08 14:58:29 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-08 14:58:29 +0200
commit79ca9b0494f88fed8030911fe994165a1c072f2f (patch)
tree6bc00efd9dfb24aa0d7205199802dce6c5d9820e /src/main/java
parent261e4012d6f7e129f7311f270147caddcc20a22a (diff)
downloadskyhanni-79ca9b0494f88fed8030911fe994165a1c072f2f.tar.gz
skyhanni-79ca9b0494f88fed8030911fe994165a1c072f2f.tar.bz2
skyhanni-79ca9b0494f88fed8030911fe994165a1c072f2f.zip
Added Kick Duration and Time In Limbo
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java42
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/LimboTimeTracker.kt51
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt76
4 files changed, 173 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index e4b1a7e8f..b633721d5 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -177,6 +177,7 @@ import at.hannibal2.skyhanni.features.misc.HarpFeatures
import at.hannibal2.skyhanni.features.misc.HideArmor
import at.hannibal2.skyhanni.features.misc.HideDamageSplash
import at.hannibal2.skyhanni.features.misc.JoinCrystalHollows
+import at.hannibal2.skyhanni.features.misc.LimboTimeTracker
import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager
import at.hannibal2.skyhanni.features.misc.MiscFeatures
import at.hannibal2.skyhanni.features.misc.MovementSpeedDisplay
@@ -190,6 +191,7 @@ import at.hannibal2.skyhanni.features.misc.PocketSackInASackDisplay
import at.hannibal2.skyhanni.features.misc.QuickModMenuSwitch
import at.hannibal2.skyhanni.features.misc.RestorePieceOfWizardPortalLore
import at.hannibal2.skyhanni.features.misc.ServerRestartTitle
+import at.hannibal2.skyhanni.features.misc.SkyBlockKickDuration
import at.hannibal2.skyhanni.features.misc.SuperpairsClicksAlert
import at.hannibal2.skyhanni.features.misc.ThunderSparksHighlight
import at.hannibal2.skyhanni.features.misc.TimeFeatures
@@ -583,6 +585,8 @@ class SkyHanniMod {
loadModule(DungeonRankTabListColor())
loadModule(FixNEUHeavyPearls())
loadModule(QuickCraftFeatures())
+ loadModule(SkyBlockKickDuration())
+ loadModule(LimboTimeTracker())
init()
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
index 9eaa1ec7c..afa2ea873 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
@@ -615,6 +615,37 @@ public class MiscConfig {
}
@Expose
+ @ConfigOption(name = "Kick Duration", desc = "")
+ @Accordion
+ public KickDurationConfig kickDuration = new KickDurationConfig();
+
+ public static class KickDurationConfig {
+
+ @Expose
+ @ConfigOption(
+ name = "Enabled",
+ desc = "Show in the Hypixel lobby since when you were last kicked from SkyBlock (" +
+ "useful if you get blocked because of '§cYou were kicked while joining that server!§7')."
+ )
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean enabled = true;
+
+ @Expose
+ @ConfigOption(name = "Warn Time", desc = "Send warning and sound this seconds after a SkyBlock kick.")
+ @ConfigEditorSlider(
+ minValue = 5,
+ maxValue = 300,
+ minStep = 1
+ )
+ @ConfigAccordionId(id = 11)
+ public Property<Integer> warnTime = Property.of(60);
+
+ @Expose
+ public Position position = new Position(400, 200, 1.3f);
+ }
+
+ @Expose
@ConfigOption(name = "Exp Bottles", desc = "Hides all the experience orbs lying on the ground.")
@ConfigEditorBoolean
@FeatureToggle
@@ -718,5 +749,16 @@ public class MiscConfig {
public boolean fixNeuHeavyPearls = true;
@Expose
+ @ConfigOption(
+ name = "Time In Limbo",
+ desc = "Show the time since you entered the limbo.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean showTimeInLimbo = true;
+
+ @Expose
+ public Position showTimeInLimboPosition = new Position(400, 200, 1.3f);
+
+ @Expose
public Position inventoryLoadPos = new Position(394, 124, false, true);
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/LimboTimeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/LimboTimeTracker.kt
new file mode 100644
index 000000000..395cfcecd
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LimboTimeTracker.kt
@@ -0,0 +1,51 @@
+package at.hannibal2.skyhanni.features.misc
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.RenderUtils.renderString
+import at.hannibal2.skyhanni.utils.SimpleTimeMark
+import at.hannibal2.skyhanni.utils.TimeUtils.format
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.time.Duration.Companion.seconds
+
+class LimboTimeTracker {
+ private val config get() = SkyHanniMod.feature.misc
+
+ private var limboJoinTime = SimpleTimeMark.farPast()
+ private var inLimbo = false
+
+ @SubscribeEvent
+ fun onChat(event: LorenzChatEvent) {
+ if (event.message == "§cYou are AFK. Move around to return from AFK.") {
+ limboJoinTime = SimpleTimeMark.now()
+ inLimbo = true
+ }
+ }
+
+ @SubscribeEvent
+ fun onWorldChange(event: LorenzWorldChangeEvent) {
+ if (!inLimbo) return
+
+ val passedSince = limboJoinTime.passedSince()
+ val duration = passedSince.format()
+ if (passedSince > 5.seconds) {
+ inLimbo = false
+ if (!isEnabled()) return
+ LorenzUtils.run { chat("§e[SkyHanni] You left the limbo after §b$duration") }
+ }
+ }
+
+ @SubscribeEvent
+ fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
+ if (!isEnabled()) return
+ if (!inLimbo) return
+
+ val duration = limboJoinTime.passedSince().format()
+ config.showTimeInLimboPosition.renderString("§eIn limbo since §b$duration", posLabel = "Limbo Time Tracker")
+ }
+
+ fun isEnabled() = config.showTimeInLimbo
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt
new file mode 100644
index 000000000..c571a2d63
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt
@@ -0,0 +1,76 @@
+package at.hannibal2.skyhanni.features.misc
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.TitleUtils
+import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.RenderUtils.renderString
+import at.hannibal2.skyhanni.utils.SimpleTimeMark
+import at.hannibal2.skyhanni.utils.TimeUtils.format
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.time.Duration.Companion.minutes
+import kotlin.time.Duration.Companion.seconds
+
+class SkyBlockKickDuration {
+ private val config get() = SkyHanniMod.feature.misc.kickDuration
+
+ var kickMessage = false
+ var showTime = false
+ var lastKickTime = SimpleTimeMark.farPast()
+ var hasWarned = false
+
+ @SubscribeEvent
+ fun onChat(event: LorenzChatEvent) {
+ if (!isEnabled()) return
+ if (event.message == "§cYou were kicked while joining that server!") {
+ kickMessage = true
+ }
+ }
+
+ @SubscribeEvent
+ fun onWorldChange(event: LorenzWorldChangeEvent) {
+ if (!isEnabled()) return
+ if (kickMessage) {
+ kickMessage = false
+ showTime = true
+ lastKickTime = SimpleTimeMark.farPast()
+ }
+ hasWarned = false
+ }
+
+ @SubscribeEvent
+ fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
+ if (!isEnabled()) return
+ if (!LorenzUtils.onHypixel) return
+ if (!showTime) return
+
+ if (LorenzUtils.inSkyBlock) {
+ showTime = false
+ }
+
+ if (lastKickTime.passedSince() > 5.minutes) {
+ showTime = false
+ }
+
+ if (lastKickTime.passedSince() > config.warnTime.get().seconds) {
+ if (!hasWarned) {
+ hasWarned = true
+ warn()
+ }
+ }
+
+ val format = lastKickTime.passedSince().format()
+ config.position.renderString(
+ "§cLast kicked from SkyBlock §b$format ago",
+ posLabel = "SkyBlock Kick Duration"
+ )
+ }
+
+ private fun warn() {
+ TitleUtils.sendTitle("§eTry rejoining SkyBlock now!", 3.seconds)
+ }
+
+ fun isEnabled() = config.enabled
+}