From 6e6d11ad81a884ecf1080c63ce4cf159946e4200 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Fri, 17 May 2024 18:27:49 +0200 Subject: [PATCH 01/15] yay --- .../features/mining/MiningEvents.java | 200 ------------------ .../partlysaneskies/PartlySaneSkies.kt | 4 +- .../partlysaneskies/config/OneConfigScreen.kt | 8 - .../features/mining/events/MiningEvent.kt | 132 ++++++++++++ .../mining/events/MiningEventNotifier.kt | 42 ++++ 5 files changed, 176 insertions(+), 210 deletions(-) delete mode 100644 src/main/java/me/partlysanestudios/partlysaneskies/features/mining/MiningEvents.java create mode 100644 src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt create mode 100644 src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt diff --git a/src/main/java/me/partlysanestudios/partlysaneskies/features/mining/MiningEvents.java b/src/main/java/me/partlysanestudios/partlysaneskies/features/mining/MiningEvents.java deleted file mode 100644 index 18d28e7f2..000000000 --- a/src/main/java/me/partlysanestudios/partlysaneskies/features/mining/MiningEvents.java +++ /dev/null @@ -1,200 +0,0 @@ -// -// Written by J10a1n15. -// See LICENSE for copyright and license notices. -// -// Time spend afking in the mines: ~4h -// - -package me.partlysanestudios.partlysaneskies.features.mining; - -import me.partlysanestudios.partlysaneskies.PartlySaneSkies; -import me.partlysanestudios.partlysaneskies.render.gui.hud.BannerRenderer; -import me.partlysanestudios.partlysaneskies.render.gui.hud.PSSBanner; -import me.partlysanestudios.partlysaneskies.system.SystemNotification; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.lwjgl.opengl.Display; - -public class MiningEvents { - // TODO: lmao this needs a rewrite - // I was almost gonna convert to kt and then I realized I would have to rewrite it - private static boolean showBanner = false; - - @SubscribeEvent - public void onChat(ClientChatReceivedEvent event) { - if (!PartlySaneSkies.Companion.getConfig().getMiningEventsToggle()) return; - - String displayText = ""; - - String message = event.message.getFormattedText(); - - // 2x Powder - if (message.contains("The §b2x Powder §eevent starts in §a20 §eseconds!") && PartlySaneSkies.Companion.getConfig().getMining2xPowderSound() && PartlySaneSkies.Companion.getConfig().getMiningWarn20sBeforeEvent()) { - showBanner = true; - PartlySaneSkies.Companion.getMinecraft().thePlayer.playSound("partlysaneskies:bell", 100, 1); - if (PartlySaneSkies.Companion.getConfig().getMiningShowEventBanner()) displayText = "2x Powder Event in 20s!"; - if (PartlySaneSkies.Companion.getConfig().getMiningSendSystemNotifications() && !Display.isActive()) SystemNotification.INSTANCE.showNotification("2x Powder Event in 20s!"); - } - - if (message.contains("§l2X POWDER STARTED!") && PartlySaneSkies.Companion.getConfig().getMining2xPowderSound()) { - showBanner = true; - PartlySaneSkies.Companion.getMinecraft().thePlayer.playSound("partlysaneskies:bell", 100, 1); - if (PartlySaneSkies.Companion.getConfig().getMiningShowEventBanner()) displayText = "2x Powder Event Started!"; - if (PartlySaneSkies.Companion.getConfig().getMiningSendSystemNotifications() && !Display.isActive()) SystemNotification.INSTANCE.showNotification("2x Powder Event Started!"); - } - - // Gone with the wind - if (message.contains("The §9Gone with the Wind §eevent starts in §a20 §eseconds!") && PartlySaneSkies.Companion.getConfig().getMiningGoneWithTheWindSound() && PartlySaneSkies.Companion.getConfig().getMiningWarn20sBeforeEvent()) { - showBanner = true; - PartlySaneSkies.Companion.getMinecraft().thePlayer.playSound("partlysaneskies:bell", 100, 1); - if (PartlySaneSkies.Companion.getConfig().getMiningShowEventBanner()) displayText = "Gone with the Wind Event in 20s!"; - if (PartlySaneSkies.Companion.getConfig().getMiningSendSystemNotifications() && !Display.isActive()) SystemNotification.INSTANCE.showNotification("Gone with the Wind Event in 20s!"); - } - - if (message.contains("§r§9§lGONE WITH THE WIND STARTED!") && PartlySaneSkies.Companion.getConfig().getMiningGoneWithTheWindSound()) { - showBanner = true; - PartlySaneSkies.Companion.getMinecraft().thePlayer.playSound("partlysaneskies:bell", 100, 1); - if (PartlySaneSkies.Companion.getConfig().getMiningShowEventBanner()) displayText = "Gone with the Wind Event Started!"; - if (PartlySaneSkies.Companion.getConfig().getMiningSendSystemNotifications() && !Display.isActive()) SystemNotification.INSTANCE.showNotification("Gone with the Wind Event Started!"); - } - - // Better Together - if (message.contains("The §dBetter Together §eevent starts in §a20 §eseconds!") && PartlySaneSkies.Companion.getConfig().getMiningBetterTogetherSound() && PartlySaneSkies.Companion.getConfig().getMiningWarn20sBeforeEvent()) { - showBanner = true; - PartlySaneSkies.Companion.getMinecraft().thePlayer.playSound("partlysaneskies:bell", 100, 1); - if (PartlySaneSkies.Companion.getConfig().getMiningShowEventBanner()) displayText = "Better Together Event in 20s!"; - if (PartlySaneSkies.Companion.getConfig().getMiningSendSystemNotifications() && !Display.isActive()) SystemNotification.INSTANCE.showNotification("Better Together Event in 20s!"); - } - - if (message.contains("§r§d§lBETTER TOGETHER STARTED!") && PartlySaneSkies.Companion.getConfig().getMiningBetterTogetherSound()) { - showBanner = true; - PartlySaneSkies.Companion.getMinecraft().thePlayer.playSound("partlysaneskies:bell", 100, 1); - if (PartlySaneSkies.Companion.getConfig().getMiningShowEventBanner()) displayText = "Better Together Event Started!"; - if (PartlySaneSkies.Companion.getConfig().getMiningSendSystemNotifications() && !Display.isActive()) SystemNotification.INSTANCE.showNotification("Better Together Event Started!"); - } - - // Goblin Raid - if (message.contains("§eThe §cGoblin Raid §eevent starts in §a20 §eseconds!") && PartlySaneSkies.Companion.getConfig().getMiningGoblinRaidSound() && PartlySaneSkies.Companion.getConfig().getMiningWarn20sBeforeEvent()) { - showBanner = true; - PartlySaneSkies.Companion.getMinecraft().thePlayer.playSound("partlysaneskies:bell", 100, 1); - if (PartlySaneSkies.Companion.getConfig().getMiningShowEventBanner()) displayText = "Goblin Raid Event in 20s!"; - if (PartlySaneSkies.Companion.getConfig().getMiningSendSystemNotifications() && !Display.isActive()) SystemNotification.INSTANCE.showNotification("Goblin Raid Event in 20s!"); - } - - if (message.contains("§r§c§lGOBLIN RAID STARTED!") && PartlySaneSkies.Companion.getConfig().getMiningGoblinRaidSound()) { - showBanner = true; - PartlySaneSkies.Companion.getMinecraft().thePlayer.playSound("partlysaneskies:bell", 100, 1); - if (PartlySaneSkies.Companion.getConfig().getMiningShowEventBanner()) displayText = "Goblin Raid Event Started!"; - if (PartlySaneSkies.Companion.getConfig().getMiningSendSystemNotifications() && !Display.isActive()) SystemNotification.INSTANCE.showNotification("Goblin Raid Event Started!"); - } - - // Raffle - if (message.contains("The §6Raffle §eevent starts in §a20 §eseconds!") && PartlySaneSkies.Companion.getConfig().getMiningRaffleSound() && PartlySaneSkies.Companion.getConfig().getMiningWarn20sBeforeEvent()) { - showBanner = true; - PartlySaneSkies.Companion.getMinecraft().thePlayer.playSound("partlysaneskies:bell", 100, 1); - if (PartlySaneSkies.Companion.getConfig().getMiningShowEventBanner()) displayText = "Raffle Event in 20s!"; - if (PartlySaneSkies.Companion.getConfig().getMiningSendSystemNotifications() && !Display.isActive()) SystemNotification.INSTANCE.showNotification("Raffle Event in 20s!"); - } - - if (message.contains("§r§6§lRAFFLE STARTED!") && PartlySaneSkies.Companion.getConfig().getMiningRaffleSound()) { - showBanner = true; - PartlySaneSkies.Companion.getMinecraft().thePlayer.playSound("partlysaneskies:bell", 100, 1); - if (PartlySaneSkies.Companion.getConfig().getMiningShowEventBanner()) displayText = "Raffle Event Started!"; - if (PartlySaneSkies.Companion.getConfig().getMiningSendSystemNotifications() && !Display.isActive()) SystemNotification.INSTANCE.showNotification("Raffle Event Started!"); - } - - // Gourmand - if (message.contains("§eThe §bMithril Gourmand §eevent starts in §a20 §eseconds!") && PartlySaneSkies.Companion.getConfig().getMiningMithrilGourmandSound() && PartlySaneSkies.Companion.getConfig().getMiningWarn20sBeforeEvent()){ - showBanner = true; - PartlySaneSkies.Companion.getMinecraft().thePlayer.playSound("partlysaneskies:bell", 100, 1); - if (PartlySaneSkies.Companion.getConfig().getMiningShowEventBanner()) displayText = "Mithril Gourmand Event in 20s!"; - if (PartlySaneSkies.Companion.getConfig().getMiningSendSystemNotifications() && !Display.isActive()) SystemNotification.INSTANCE.showNotification("Mithril Gourmand Event in 20s!"); - } - - if (message.contains("§r§b§lMITHRIL GOURMAND STARTED!") && PartlySaneSkies.Companion.getConfig().getMiningMithrilGourmandSound()){ - showBanner = true; - PartlySaneSkies.Companion.getMinecraft().thePlayer.playSound("partlysaneskies:bell", 100, 1); - if (PartlySaneSkies.Companion.getConfig().getMiningShowEventBanner()) displayText = "Mithril Gourmand Event Started!"; - if (PartlySaneSkies.Companion.getConfig().getMiningSendSystemNotifications() && !Display.isActive()) SystemNotification.INSTANCE.showNotification("Mithril Gourmand Event Started!"); - } - - // Powder Ghast - if (message.contains("§6The sound of pickaxes clashing against the rock has attracted the attention of the §r§6§lPOWDER GHAST!") && PartlySaneSkies.Companion.getConfig().getMiningPowderGhastSound()){ - showBanner = true; - PartlySaneSkies.Companion.getMinecraft().thePlayer.playSound("partlysaneskies:bell", 100, 1); - if (PartlySaneSkies.Companion.getConfig().getMiningShowEventBanner()) displayText = "Powder Ghast Spawned!"; - if (PartlySaneSkies.Companion.getConfig().getMiningSendSystemNotifications() && !Display.isActive()) SystemNotification.INSTANCE.showNotification("Powder Ghast Spawned!"); - } - - // Fallen Star - if (message.contains("§eA §r§5Fallen Star §r§ehas crashed at") && PartlySaneSkies.Companion.getConfig().getMiningFallenStarSound()){ - showBanner = true; - PartlySaneSkies.Companion.getMinecraft().thePlayer.playSound("partlysaneskies:bell", 100, 1); - if (PartlySaneSkies.Companion.getConfig().getMiningShowEventBanner()) displayText = "Fallen Star Spawned!"; - if (PartlySaneSkies.Companion.getConfig().getMiningSendSystemNotifications() && !Display.isActive()) SystemNotification.INSTANCE.showNotification("Fallen Star Spawned!"); - } - - if (showBanner) { - BannerRenderer.INSTANCE.renderNewBanner(new PSSBanner(displayText, (long) (PartlySaneSkies.Companion.getConfig().getMiningEventBannerTime() * 1000), 4.0f, PartlySaneSkies.Companion.getConfig().getMiningEventBannerColor().toJavaColor())); - } - showBanner = false; - } -} - -/* ALL THE MINING EVENTS RELATED MESSAGES - - **MAJOR EVENTS** - - 2x POWDER - §b⚑ §eThe §b2x Powder §eevent starts in §a20 §eseconds! - §eThis is a passive event! §bIt's happening everywhere in the §bCrystal Hollows!§r - - §r§r§r §r§b§l2X POWDER STARTED!§r - - - WIND - §9⚑ §eThe §9Gone with the Wind §eevent starts in §a20 §eseconds! - §eThis is a passive event! §bIt's happening everywhere in the §bCrystal Hollows!§r - - §r§r§r §r§9§lGONE WITH THE WIND STARTED!§r - - - BETTER TOGETHER - §d⚑ §eThe §dBetter Together §eevent starts in §a20 §eseconds! - §eThis is a passive event! §bIt's happening everywhere in the §bCrystal Hollows!§r - - §r§r§r §r§d§lBETTER TOGETHER STARTED!§r - - - RAID - §c⚑ §eThe §cGoblin Raid §eevent starts in §a20 §eseconds! - §aClick here §eto teleport to §bGarry §eand prepare!§r - - §r§r§r §r§c§lGOBLIN RAID STARTED!§r - - - RAFFLE - §6⚑ §eThe §6Raffle §eevent starts in §a20 §eseconds! - §aClick here §eto teleport to §bGarry §eand prepare!§r - - §r§r§r §r§6§lRAFFLE STARTED!§r - - - GOURMAND - §b⚑ §eThe §bMithril Gourmand §eevent starts in §a20 §eseconds! - §aClick here §eto teleport to §bGarry §eand prepare!§r - - §r§r§r §r§b§lMITHRIL GOURMAND STARTED!§r - - - **MINOR EVENTS** - - POWDER GHAST - §r§6The sound of pickaxes clashing against the rock has attracted the attention of the §r§6§lPOWDER GHAST!§r - §r§eFind the §r§6Powder Ghast§r§e near the §r§bCliffside Veins§r§e!§r - - - FALLEN STAR - §r§5§l✯ §r§eA §r§5Fallen Star §r§ehas crashed at §r§bRoyal Mines§r§e! Nearby ore and Powder drops are amplified!§r - - */ \ No newline at end of file diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/PartlySaneSkies.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/PartlySaneSkies.kt index 06a172f0c..1c39946fb 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/PartlySaneSkies.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/PartlySaneSkies.kt @@ -62,11 +62,11 @@ import me.partlysanestudios.partlysaneskies.features.gui.hud.CooldownHud import me.partlysanestudios.partlysaneskies.features.gui.hud.LocationBannerDisplay import me.partlysanestudios.partlysaneskies.features.gui.hud.rngdropbanner.DropBannerDisplay import me.partlysanestudios.partlysaneskies.features.information.WikiArticleOpener -import me.partlysanestudios.partlysaneskies.features.mining.MiningEvents import me.partlysanestudios.partlysaneskies.features.mining.PickaxeWarning import me.partlysanestudios.partlysaneskies.features.mining.crystalhollows.WormWarning import me.partlysanestudios.partlysaneskies.features.mining.crystalhollows.gemstonewaypoints.GemstoneData import me.partlysanestudios.partlysaneskies.features.mining.crystalhollows.gemstonewaypoints.GemstoneWaypointRender +import me.partlysanestudios.partlysaneskies.features.mining.events.MiningEventNotifier import me.partlysanestudios.partlysaneskies.features.security.PrivacyMode import me.partlysanestudios.partlysaneskies.features.security.modschecker.ModChecker import me.partlysanestudios.partlysaneskies.features.skills.PetAlert @@ -193,7 +193,7 @@ class PartlySaneSkies { registerEvent(this) registerEvent(PartyManager()) registerEvent(PartyFriendManager()) - registerEvent(MiningEvents()) + registerEvent(MiningEventNotifier) registerEvent(MinionData()) registerEvent(SkyblockDataManager) registerEvent(DropBannerDisplay) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/config/OneConfigScreen.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/config/OneConfigScreen.kt index 13cc1143d..e44eed630 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/config/OneConfigScreen.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/config/OneConfigScreen.kt @@ -1347,14 +1347,6 @@ object OneConfigScreen : Config( ) var miningEventBannerTime = 3.5f - @Color( - name = "Event Banner Color", - description = "The color of the event banner text.", - category = "Mining", - subcategory = "Events" - ) - var miningEventBannerColor = OneColor(255, 255, 255) - // ------------- Category: Farming --------------------------------- // Hoes @Switch( diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt new file mode 100644 index 000000000..37ae57332 --- /dev/null +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt @@ -0,0 +1,132 @@ +package me.partlysanestudios.partlysaneskies.features.mining.events + +import me.partlysanestudios.partlysaneskies.PartlySaneSkies.Companion.config + +enum class MiningEvent ( + val event: String, + val color: String, + val triggeredEvent: (String) -> Boolean, + val config: () -> Boolean, + val event20s: String = "", + val triggeredEvent20s: (String) -> Boolean = { false }, +) { + POWDER( + "2x Powder", + "§b⚑", + { it.contains("§l2X POWDER STARTED!") }, + config::mining2xPowderSound, + "2x Powder Event in 20s!", + { it.contains("The §b2x Powder §eevent starts in §a20 §eseconds!") } + ), + WIND( + "Gone with the Wind", + "§9⚑", + { it.contains("§r§9§lGONE WITH THE WIND STARTED!") }, + config::miningGoneWithTheWindSound, + "Gone with the Wind Event in 20s!", + { it.contains("The §9Gone with the Wind §eevent starts in §a20 §eseconds!") } + ), + BETTER_TOGETHER( + "Better Together", + "§d⚑", + { it.contains("§r§d§lBETTER TOGETHER STARTED!") }, + config::miningBetterTogetherSound, + "Better Together Event in 20s!", + { it.contains("The §dBetter Together §eevent starts in §a20 §eseconds!") } + ), + RAID( + "Goblin Raid", + "§c⚑", + { it.contains("§r§c§lGOBLIN RAID STARTED!") }, + config::miningGoblinRaidSound, + "Goblin Raid Event in 20s!", + { it.contains("The §cGoblin Raid §eevent starts in §a20 §eseconds!") } + ), + RAFFLE( + "Raffle", + "§6⚑", + { it.contains("§r§6§lRAFFLE STARTED!") }, + config::miningRaffleSound, + "Raffle Event in 20s!", + { it.contains("The §6Raffle §eevent starts in §a20 §eseconds!") } + ), + GOURMAND( + "Mithril Gourmand", + "§b⚑", + { it.contains("§r§b§lMITHRIL GOURMAND STARTED!") }, + config::miningMithrilGourmandSound, + "Mithril Gourmand Event in 20s!", + { it.contains("The §bMithril Gourmand §eevent starts in §a20 §eseconds!") } + ), + + POWDER_GHAST( + "Powder Ghast", + "§r§6", + { it.contains("§r§6§lPOWDER GHAST!") }, + config::miningPowderGhastSound + ), + FALLEN_STAR( + "Fallen Star", + "§r§5", + { it.contains("§r§5§l✯ §r§eA §r§5Fallen Star §r§ehas crashed at ") }, + config::miningFallenStarSound + ) +} + +/* ALL THE MINING EVENTS RELATED MESSAGES + + **MAJOR EVENTS** + + 2x POWDER + §b⚑ §eThe §b2x Powder §eevent starts in §a20 §eseconds! + §eThis is a passive event! §bIt's happening everywhere in the §bCrystal Hollows!§r + + §r§r§r §r§b§l2X POWDER STARTED!§r + + + WIND + §9⚑ §eThe §9Gone with the Wind §eevent starts in §a20 §eseconds! + §eThis is a passive event! §bIt's happening everywhere in the §bCrystal Hollows!§r + + §r§r§r §r§9§lGONE WITH THE WIND STARTED!§r + + + BETTER TOGETHER + §d⚑ §eThe §dBetter Together §eevent starts in §a20 §eseconds! + §eThis is a passive event! §bIt's happening everywhere in the §bCrystal Hollows!§r + + §r§r§r §r§d§lBETTER TOGETHER STARTED!§r + + + RAID + §c⚑ §eThe §cGoblin Raid §eevent starts in §a20 §eseconds! + §aClick here §eto teleport to §bGarry §eand prepare!§r + + §r§r§r §r§c§lGOBLIN RAID STARTED!§r + + + RAFFLE + §6⚑ §eThe §6Raffle §eevent starts in §a20 §eseconds! + §aClick here §eto teleport to §bGarry §eand prepare!§r + + §r§r§r §r§6§lRAFFLE STARTED!§r + + + GOURMAND + §b⚑ §eThe §bMithril Gourmand §eevent starts in §a20 §eseconds! + §aClick here §eto teleport to §bGarry §eand prepare!§r + + §r§r§r §r§b§lMITHRIL GOURMAND STARTED!§r + + + **MINOR EVENTS** + + POWDER GHAST + §r§6The sound of pickaxes clashing against the rock has attracted the attention of the §r§6§lPOWDER GHAST!§r + §r§eFind the §r§6Powder Ghast§r§e near the §r§bCliffside Veins§r§e!§r + + + FALLEN STAR + §r§5§l✯ §r§eA §r§5Fallen Star §r§ehas crashed at §r§bRoyal Mines§r§e! Nearby ore and Powder drops are amplified!§r + + */ \ No newline at end of file diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt new file mode 100644 index 000000000..1a82a737c --- /dev/null +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt @@ -0,0 +1,42 @@ +// +// Written by J10a1n15. +// See LICENSE for copyright and license notices. +// + +package me.partlysanestudios.partlysaneskies.features.mining.events + +import cc.polyfrost.oneconfig.utils.dsl.mc +import me.partlysanestudios.partlysaneskies.PartlySaneSkies.Companion.config +import me.partlysanestudios.partlysaneskies.render.gui.hud.BannerRenderer.renderNewBanner +import me.partlysanestudios.partlysaneskies.render.gui.hud.PSSBanner +import me.partlysanestudios.partlysaneskies.system.SystemNotification.showNotification +import net.minecraftforge.client.event.ClientChatReceivedEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import org.lwjgl.opengl.Display + +object MiningEventNotifier { + + @SubscribeEvent + fun onChat(event: ClientChatReceivedEvent) { + if (!config.miningEventsToggle) return + + val message = event.message.formattedText + + MiningEvent.entries.forEach { + if (it.config().not()) return@forEach + + if (it.triggeredEvent(message)) { + mc.thePlayer.playSound("partlysaneskies:bell", 100F, 1F) + val text = it.color + it.event + if (config.miningShowEventBanner && !Display.isActive()) showNotification(text) + if (config.miningShowEventBanner) renderNewBanner(PSSBanner(text, (config.miningEventBannerTime * 1000).toLong(), 4f)) + } + if (it.triggeredEvent20s(message) && config.miningWarn20sBeforeEvent) { + mc.thePlayer.playSound("partlysaneskies:bell", 100F, 1F) + val text = it.color + it.event20s + if (config.miningShowEventBanner && !Display.isActive()) showNotification(text) + if (config.miningShowEventBanner) renderNewBanner(PSSBanner(text, (config.miningEventBannerTime * 1000).toLong(), 4f)) + } + } + } +} From 9bb67e4f8c5e3e66379e9e0be1ce2d35a70e6852 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Fri, 17 May 2024 21:40:52 +0200 Subject: [PATCH 02/15] Update src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt Co-authored-by: Su386 <83100266+Su386yt@users.noreply.github.com> Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> --- .../features/mining/events/MiningEventNotifier.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt index 1a82a737c..bd674646c 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt @@ -28,7 +28,9 @@ object MiningEventNotifier { if (it.triggeredEvent(message)) { mc.thePlayer.playSound("partlysaneskies:bell", 100F, 1F) val text = it.color + it.event - if (config.miningShowEventBanner && !Display.isActive()) showNotification(text) + if (config.miningShowEventBanner && !Display.isActive()) { + showNotification(text) + } if (config.miningShowEventBanner) renderNewBanner(PSSBanner(text, (config.miningEventBannerTime * 1000).toLong(), 4f)) } if (it.triggeredEvent20s(message) && config.miningWarn20sBeforeEvent) { From d99c4f4ed01179b8b178900181252cba987751eb Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Fri, 17 May 2024 21:40:58 +0200 Subject: [PATCH 03/15] Update src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt Co-authored-by: Su386 <83100266+Su386yt@users.noreply.github.com> Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> --- .../features/mining/events/MiningEventNotifier.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt index bd674646c..e80bc6610 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt @@ -36,7 +36,9 @@ object MiningEventNotifier { if (it.triggeredEvent20s(message) && config.miningWarn20sBeforeEvent) { mc.thePlayer.playSound("partlysaneskies:bell", 100F, 1F) val text = it.color + it.event20s - if (config.miningShowEventBanner && !Display.isActive()) showNotification(text) + if (config.miningShowEventBanner && !Display.isActive()) { + showNotification(text) + } if (config.miningShowEventBanner) renderNewBanner(PSSBanner(text, (config.miningEventBannerTime * 1000).toLong(), 4f)) } } From 7fa89f3887ab4e7ba5224faac7dd8aead1f45e9f Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Fri, 17 May 2024 21:41:02 +0200 Subject: [PATCH 04/15] Update src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt Co-authored-by: Su386 <83100266+Su386yt@users.noreply.github.com> Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> --- .../features/mining/events/MiningEventNotifier.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt index e80bc6610..15bb343cd 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt @@ -39,7 +39,9 @@ object MiningEventNotifier { if (config.miningShowEventBanner && !Display.isActive()) { showNotification(text) } - if (config.miningShowEventBanner) renderNewBanner(PSSBanner(text, (config.miningEventBannerTime * 1000).toLong(), 4f)) + if (config.miningShowEventBanner) { + renderNewBanner(PSSBanner(text, (config.miningEventBannerTime * 1000).toLong(), 4f)) + } } } } From c91f15333745ecad972ee3a39c6b943bd040b525 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Fri, 17 May 2024 21:41:07 +0200 Subject: [PATCH 05/15] Update src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt Co-authored-by: Su386 <83100266+Su386yt@users.noreply.github.com> Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> --- .../features/mining/events/MiningEventNotifier.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt index 15bb343cd..47003e1c6 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt @@ -31,7 +31,9 @@ object MiningEventNotifier { if (config.miningShowEventBanner && !Display.isActive()) { showNotification(text) } - if (config.miningShowEventBanner) renderNewBanner(PSSBanner(text, (config.miningEventBannerTime * 1000).toLong(), 4f)) + if (config.miningShowEventBanner) { + renderNewBanner(PSSBanner(text, (config.miningEventBannerTime * 1000).toLong(), 4f)) + } } if (it.triggeredEvent20s(message) && config.miningWarn20sBeforeEvent) { mc.thePlayer.playSound("partlysaneskies:bell", 100F, 1F) From ee94301d22870777efa5aeac1b40ddee80d44155 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Fri, 17 May 2024 21:43:22 +0200 Subject: [PATCH 06/15] formatting --- .../me/partlysanestudios/partlysaneskies/PartlySaneSkies.kt | 2 +- .../features/mining/events/MiningEventNotifier.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/PartlySaneSkies.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/PartlySaneSkies.kt index 1c39946fb..a01e4d2b0 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/PartlySaneSkies.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/PartlySaneSkies.kt @@ -193,7 +193,6 @@ class PartlySaneSkies { registerEvent(this) registerEvent(PartyManager()) registerEvent(PartyFriendManager()) - registerEvent(MiningEventNotifier) registerEvent(MinionData()) registerEvent(SkyblockDataManager) registerEvent(DropBannerDisplay) @@ -236,6 +235,7 @@ class PartlySaneSkies { registerEvent(CustomMainMenu.Companion) registerEvent(WrongToolCropWarning.CropToolData) registerEvent(PetAlert) + registerEvent(MiningEventNotifier) // Registers all client side commands diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt index 47003e1c6..3504b64a4 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt @@ -33,7 +33,7 @@ object MiningEventNotifier { } if (config.miningShowEventBanner) { renderNewBanner(PSSBanner(text, (config.miningEventBannerTime * 1000).toLong(), 4f)) - } + } } if (it.triggeredEvent20s(message) && config.miningWarn20sBeforeEvent) { mc.thePlayer.playSound("partlysaneskies:bell", 100F, 1F) @@ -43,7 +43,7 @@ object MiningEventNotifier { } if (config.miningShowEventBanner) { renderNewBanner(PSSBanner(text, (config.miningEventBannerTime * 1000).toLong(), 4f)) - } + } } } } From 3ed35aedaebeadf5cbc12aff7b58dbe645bf3671 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Tue, 4 Jun 2024 23:11:26 +0200 Subject: [PATCH 07/15] this shit is not working Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> --- .../data/skyblockdata/IslandType.kt | 8 +-- .../partlysaneskies/events/EventManager.kt | 2 + .../events/skyblock/mining/MinesEvent.kt | 34 +++++++++++ .../features/mining/events/MiningEvent.kt | 56 +++++++++++++------ .../mining/events/MiningEventNotifier.kt | 40 ++++--------- .../partlysaneskies/utils/HypixelUtils.kt | 5 +- 6 files changed, 94 insertions(+), 51 deletions(-) create mode 100644 src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/mining/MinesEvent.kt diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/data/skyblockdata/IslandType.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/data/skyblockdata/IslandType.kt index 5ee0447bf..1d84c1490 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/data/skyblockdata/IslandType.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/data/skyblockdata/IslandType.kt @@ -6,7 +6,6 @@ package me.partlysanestudios.partlysaneskies.data.skyblockdata -import me.partlysanestudios.partlysaneskies.utils.HypixelUtils import me.partlysanestudios.partlysaneskies.utils.MinecraftUtils import me.partlysanestudios.partlysaneskies.utils.StringUtils.removeColorCodes @@ -23,17 +22,16 @@ enum class IslandType(val islandName: String) { DEEP_CAVERNS("Deep Caverns"), DWARVEN_MINES("Dwarven Mines"), CRYSTAL_HOLLOWS("Crystal Hollows"), + MINESHAFT("Mineshaft"), FARMING_ISLAND("The Farming Islands"), - WINTER_ISLAND("Jerry's Workshop"), // value by sh, unconfirmed + WINTER_ISLAND("Jerry's Workshop"), RIFT("The Rift"), CATACOMBS("Catacombs"), KUUDRA("Kuudra"), NONE(""); - fun onIsland(): Boolean { - return this == IslandType.getCurrentIsland() - } + fun onIsland() = this == IslandType.getCurrentIsland() companion object { /** diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/EventManager.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/EventManager.kt index 005de5190..b3f059ae5 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/EventManager.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/EventManager.kt @@ -9,6 +9,7 @@ package me.partlysanestudios.partlysaneskies.events import me.partlysanestudios.partlysaneskies.events.minecraft.render.RenderWaypointEvent import me.partlysanestudios.partlysaneskies.events.skyblock.dungeons.DungeonEndEvent import me.partlysanestudios.partlysaneskies.events.skyblock.dungeons.DungeonStartEvent +import me.partlysanestudios.partlysaneskies.events.skyblock.mining.MinesEvent import me.partlysanestudios.partlysaneskies.utils.SystemUtils.log import net.minecraftforge.client.event.ClientChatReceivedEvent import net.minecraftforge.client.event.RenderWorldLastEvent @@ -54,6 +55,7 @@ object EventManager { val message = event.message.formattedText DungeonStartEvent.onMessageRecieved(registeredFunctions[DungeonStartEvent::class] ?: ArrayList(), message) DungeonEndEvent.onMessageRecieved(registeredFunctions[DungeonEndEvent::class] ?: ArrayList(), message) + MinesEvent.onMessageRecieved(registeredFunctions[MinesEvent::class] ?: ArrayList(), message) } internal class EventFunction(val obj: Any, val function: KFunction<*> ) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/mining/MinesEvent.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/mining/MinesEvent.kt new file mode 100644 index 000000000..55bafdf58 --- /dev/null +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/mining/MinesEvent.kt @@ -0,0 +1,34 @@ +// +// Written by J10a1n15. +// See LICENSE for copyright and license notices. +// + + +package me.partlysanestudios.partlysaneskies.events.skyblock.mining + +import me.partlysanestudios.partlysaneskies.events.EventManager +import me.partlysanestudios.partlysaneskies.features.mining.events.MiningEvent +import me.partlysanestudios.partlysaneskies.utils.ChatUtils +import me.partlysanestudios.partlysaneskies.utils.HypixelUtils.inAdvancedMiningIsland + +class MinesEvent(val miningEvent: MiningEvent) { + companion object { + internal fun onMessageRecieved(functionList: List, formattedMessage: String) { + if (!inAdvancedMiningIsland()) return + + MiningEvent.entries.forEach { + if (it.triggeredEvent(formattedMessage)) { + ChatUtils.sendClientMessage("Triggered event: ${it.event}") + for (function in functionList) { + try { + function.function.call(function.obj, it) + } catch (exception: Exception) { + exception.printStackTrace() + } + } + } + + } + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt index 37ae57332..d5c78b777 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt @@ -2,74 +2,96 @@ package me.partlysanestudios.partlysaneskies.features.mining.events import me.partlysanestudios.partlysaneskies.PartlySaneSkies.Companion.config -enum class MiningEvent ( +enum class MiningEvent( val event: String, val color: String, val triggeredEvent: (String) -> Boolean, val config: () -> Boolean, - val event20s: String = "", - val triggeredEvent20s: (String) -> Boolean = { false }, ) { POWDER( "2x Powder", "§b⚑", { it.contains("§l2X POWDER STARTED!") }, - config::mining2xPowderSound, + { config.mining2xPowderSound } + ), + POWDER20( "2x Powder Event in 20s!", - { it.contains("The §b2x Powder §eevent starts in §a20 §eseconds!") } + "§b⚑", + { it.contains("The §b2x Powder §eevent starts in §a20 §eseconds!") }, + { config.mining2xPowderSound && config.miningWarn20sBeforeEvent } ), WIND( "Gone with the Wind", "§9⚑", { it.contains("§r§9§lGONE WITH THE WIND STARTED!") }, - config::miningGoneWithTheWindSound, + { config.miningGoneWithTheWindSound } + ), + WIND20( "Gone with the Wind Event in 20s!", - { it.contains("The §9Gone with the Wind §eevent starts in §a20 §eseconds!") } + "§9⚑", + { it.contains("The §9Gone with the Wind §eevent starts in §a20 §eseconds!") }, + { config.miningGoneWithTheWindSound && config.miningWarn20sBeforeEvent } ), BETTER_TOGETHER( "Better Together", "§d⚑", { it.contains("§r§d§lBETTER TOGETHER STARTED!") }, - config::miningBetterTogetherSound, + { config.miningBetterTogetherSound } + ), + BETTER_TOGETHER20( "Better Together Event in 20s!", - { it.contains("The §dBetter Together §eevent starts in §a20 §eseconds!") } + "§d⚑", + { it.contains("The §dBetter Together §eevent starts in §a20 §eseconds!") }, + { config.miningBetterTogetherSound && config.miningWarn20sBeforeEvent } ), RAID( "Goblin Raid", "§c⚑", { it.contains("§r§c§lGOBLIN RAID STARTED!") }, - config::miningGoblinRaidSound, + { config.miningGoblinRaidSound } + ), + RAID20( "Goblin Raid Event in 20s!", - { it.contains("The §cGoblin Raid §eevent starts in §a20 §eseconds!") } + "§c⚑", + { it.contains("The §cGoblin Raid §eevent starts in §a20 §eseconds!") }, + { config.miningGoblinRaidSound && config.miningWarn20sBeforeEvent } ), RAFFLE( "Raffle", "§6⚑", { it.contains("§r§6§lRAFFLE STARTED!") }, - config::miningRaffleSound, + { config.miningRaffleSound } + ), + RAFFLE20( "Raffle Event in 20s!", - { it.contains("The §6Raffle §eevent starts in §a20 §eseconds!") } + "§6⚑", + { it.contains("The §6Raffle §eevent starts in §a20 §eseconds!") }, + { config.miningRaffleSound && config.miningWarn20sBeforeEvent } ), GOURMAND( "Mithril Gourmand", "§b⚑", { it.contains("§r§b§lMITHRIL GOURMAND STARTED!") }, - config::miningMithrilGourmandSound, + { config.miningMithrilGourmandSound } + ), + GOURMAND20( "Mithril Gourmand Event in 20s!", - { it.contains("The §bMithril Gourmand §eevent starts in §a20 §eseconds!") } + "§b⚑", + { it.contains("The §bMithril Gourmand §eevent starts in §a20 §eseconds!") }, + { config.miningMithrilGourmandSound && config.miningWarn20sBeforeEvent } ), POWDER_GHAST( "Powder Ghast", "§r§6", { it.contains("§r§6§lPOWDER GHAST!") }, - config::miningPowderGhastSound + { config.miningPowderGhastSound } ), FALLEN_STAR( "Fallen Star", "§r§5", { it.contains("§r§5§l✯ §r§eA §r§5Fallen Star §r§ehas crashed at ") }, - config::miningFallenStarSound + { config.miningFallenStarSound } ) } diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt index 3504b64a4..09a0d282c 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt @@ -7,44 +7,28 @@ package me.partlysanestudios.partlysaneskies.features.mining.events import cc.polyfrost.oneconfig.utils.dsl.mc import me.partlysanestudios.partlysaneskies.PartlySaneSkies.Companion.config +import me.partlysanestudios.partlysaneskies.events.SubscribePSSEvent +import me.partlysanestudios.partlysaneskies.events.skyblock.mining.MinesEvent import me.partlysanestudios.partlysaneskies.render.gui.hud.BannerRenderer.renderNewBanner import me.partlysanestudios.partlysaneskies.render.gui.hud.PSSBanner import me.partlysanestudios.partlysaneskies.system.SystemNotification.showNotification -import net.minecraftforge.client.event.ClientChatReceivedEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.opengl.Display object MiningEventNotifier { - @SubscribeEvent - fun onChat(event: ClientChatReceivedEvent) { + @SubscribePSSEvent + fun onMiningEvent(event: MinesEvent) { if (!config.miningEventsToggle) return - val message = event.message.formattedText + if (event.miningEvent.config().not()) return - MiningEvent.entries.forEach { - if (it.config().not()) return@forEach - - if (it.triggeredEvent(message)) { - mc.thePlayer.playSound("partlysaneskies:bell", 100F, 1F) - val text = it.color + it.event - if (config.miningShowEventBanner && !Display.isActive()) { - showNotification(text) - } - if (config.miningShowEventBanner) { - renderNewBanner(PSSBanner(text, (config.miningEventBannerTime * 1000).toLong(), 4f)) - } - } - if (it.triggeredEvent20s(message) && config.miningWarn20sBeforeEvent) { - mc.thePlayer.playSound("partlysaneskies:bell", 100F, 1F) - val text = it.color + it.event20s - if (config.miningShowEventBanner && !Display.isActive()) { - showNotification(text) - } - if (config.miningShowEventBanner) { - renderNewBanner(PSSBanner(text, (config.miningEventBannerTime * 1000).toLong(), 4f)) - } - } + mc.thePlayer.playSound("partlysaneskies:bell", 100F, 1F) + val text = event.miningEvent.color + event.miningEvent.event + if (config.miningShowEventBanner && !Display.isActive()) { + showNotification(text) + } + if (config.miningShowEventBanner) { + renderNewBanner(PSSBanner(text, (config.miningEventBannerTime * 1000).toLong(), 4f)) } } } diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/utils/HypixelUtils.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/utils/HypixelUtils.kt index 10748d2ab..2e0d0d792 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/utils/HypixelUtils.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/utils/HypixelUtils.kt @@ -7,13 +7,13 @@ package me.partlysanestudios.partlysaneskies.utils import me.partlysanestudios.partlysaneskies.PartlySaneSkies +import me.partlysanestudios.partlysaneskies.data.skyblockdata.IslandType import me.partlysanestudios.partlysaneskies.utils.StringUtils.removeColorCodes import me.partlysanestudios.partlysaneskies.utils.StringUtils.stripLeading import me.partlysanestudios.partlysaneskies.utils.StringUtils.stripTrailing import net.minecraft.item.ItemStack import net.minecraft.nbt.NBTTagCompound import java.util.* -import kotlin.collections.HashMap object HypixelUtils { // Returns if the current gamemode is skyblock @@ -137,4 +137,7 @@ object HypixelUtils { fun ItemStack.getItemAttributes(): NBTTagCompound? { return this.tagCompound?.getCompoundTag("ExtraAttributes") } + + fun inAdvancedMiningIsland() = + IslandType.DWARVEN_MINES.onIsland() || IslandType.CRYSTAL_HOLLOWS.onIsland() || IslandType.MINESHAFT.onIsland() } \ No newline at end of file From 01866168a4d17c7390cc9f2056d192787c26e3aa Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Tue, 4 Jun 2024 23:14:12 +0200 Subject: [PATCH 08/15] cringe mc Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> --- .../features/mining/events/MiningEventNotifier.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt index 09a0d282c..2cfa13ae1 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt @@ -5,8 +5,8 @@ package me.partlysanestudios.partlysaneskies.features.mining.events -import cc.polyfrost.oneconfig.utils.dsl.mc import me.partlysanestudios.partlysaneskies.PartlySaneSkies.Companion.config +import me.partlysanestudios.partlysaneskies.PartlySaneSkies.Companion.minecraft import me.partlysanestudios.partlysaneskies.events.SubscribePSSEvent import me.partlysanestudios.partlysaneskies.events.skyblock.mining.MinesEvent import me.partlysanestudios.partlysaneskies.render.gui.hud.BannerRenderer.renderNewBanner @@ -22,7 +22,7 @@ object MiningEventNotifier { if (event.miningEvent.config().not()) return - mc.thePlayer.playSound("partlysaneskies:bell", 100F, 1F) + minecraft.thePlayer.playSound("partlysaneskies:bell", 100F, 1F) val text = event.miningEvent.color + event.miningEvent.event if (config.miningShowEventBanner && !Display.isActive()) { showNotification(text) From 2183a430f029536a054c8e84fdc68127701a121f Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Tue, 4 Jun 2024 23:15:36 +0200 Subject: [PATCH 09/15] thats not needed Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> --- .../partlysaneskies/config/OneConfigScreen.kt | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/config/OneConfigScreen.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/config/OneConfigScreen.kt index e44eed630..d0b00e60b 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/config/OneConfigScreen.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/config/OneConfigScreen.kt @@ -63,7 +63,7 @@ object OneConfigScreen : Config( apiUrl = "http://partlysanecloud.su386.dev" save() } - if(prettyMimicKilledString.isEmpty()) { + if (prettyMimicKilledString.isEmpty()) { prettyMimicKilledString = "Mimic Killed!" save() } @@ -88,7 +88,6 @@ object OneConfigScreen : Config( */ - // ------------- Category: General --------------------------------- @Info( type = InfoType.INFO, @@ -763,7 +762,7 @@ object OneConfigScreen : Config( subcategory = "Pearl Refill" ) var pearlRefillKeybind = OneKeyBind(Keyboard.KEY_P) - + // Item Refill @Switch( name = "Auto Item Refill", @@ -836,7 +835,7 @@ object OneConfigScreen : Config( category = "Dungeons", subcategory = "Health Alert" ) - var alertOutsideDungeons = false + var alertOutsideDungeons = false @Dropdown( name = "Alert when below...", @@ -1229,23 +1228,15 @@ object OneConfigScreen : Config( var amberWaypoints = true @Switch( - name = "Show Jade Waypoints", - description = "Shows Jade waypoints", - category = "Mining", - subcategory = "Gemstone Waypoints" + name = "Show Jade Waypoints", + description = "Shows Jade waypoints", + category = "Mining", + subcategory = "Gemstone Waypoints" ) var jadeWaypoints = true - //Events - @Info( - type = InfoType.INFO, - text = "Some Events may not trigger, not all have been tested. If you find an event that doesn't trigger, please report it on our discord server.", - category = "Mining", - subcategory = "Events", - size = 2 - ) @Switch(name = "Main Toggle", description = "Toggles the events.", category = "Mining", subcategory = "Events") var miningEventsToggle = true @@ -1750,6 +1741,7 @@ object OneConfigScreen : Config( subcategory = "Fun" ) var owoLanguage = false + @Switch( name = "OwO Chat Transformer", description = "Transforms every chat message you send into OwO language.", From 40c93277dccfbd7613b8cf673e9429786229447b Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Tue, 4 Jun 2024 23:16:34 +0200 Subject: [PATCH 10/15] wrong config Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> --- .../features/mining/events/MiningEventNotifier.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt index 2cfa13ae1..c61ebccf3 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt @@ -24,7 +24,7 @@ object MiningEventNotifier { minecraft.thePlayer.playSound("partlysaneskies:bell", 100F, 1F) val text = event.miningEvent.color + event.miningEvent.event - if (config.miningShowEventBanner && !Display.isActive()) { + if (config.miningSendSystemNotifications && !Display.isActive()) { showNotification(text) } if (config.miningShowEventBanner) { From f4f878894b99d41f2687f413d4ec9d21faf3359b Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Tue, 4 Jun 2024 23:17:46 +0200 Subject: [PATCH 11/15] remove color Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> --- .../features/mining/events/MiningEventNotifier.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt index c61ebccf3..9392105a8 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEventNotifier.kt @@ -12,6 +12,7 @@ import me.partlysanestudios.partlysaneskies.events.skyblock.mining.MinesEvent import me.partlysanestudios.partlysaneskies.render.gui.hud.BannerRenderer.renderNewBanner import me.partlysanestudios.partlysaneskies.render.gui.hud.PSSBanner import me.partlysanestudios.partlysaneskies.system.SystemNotification.showNotification +import me.partlysanestudios.partlysaneskies.utils.StringUtils.removeColorCodes import org.lwjgl.opengl.Display object MiningEventNotifier { @@ -25,7 +26,7 @@ object MiningEventNotifier { minecraft.thePlayer.playSound("partlysaneskies:bell", 100F, 1F) val text = event.miningEvent.color + event.miningEvent.event if (config.miningSendSystemNotifications && !Display.isActive()) { - showNotification(text) + showNotification(text.removeColorCodes()) } if (config.miningShowEventBanner) { renderNewBanner(PSSBanner(text, (config.miningEventBannerTime * 1000).toLong(), 4f)) From d5bca38eacca1155b21719ddd233e24487af3e4f Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Wed, 3 Jul 2024 18:09:45 +0200 Subject: [PATCH 12/15] formatting Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> --- .../features/mining/events/MiningEvent.kt | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt index d5c78b777..ae079395b 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt @@ -12,87 +12,87 @@ enum class MiningEvent( "2x Powder", "§b⚑", { it.contains("§l2X POWDER STARTED!") }, - { config.mining2xPowderSound } + { config.mining2xPowderSound }, ), POWDER20( "2x Powder Event in 20s!", "§b⚑", { it.contains("The §b2x Powder §eevent starts in §a20 §eseconds!") }, - { config.mining2xPowderSound && config.miningWarn20sBeforeEvent } + { config.mining2xPowderSound && config.miningWarn20sBeforeEvent }, ), WIND( "Gone with the Wind", "§9⚑", { it.contains("§r§9§lGONE WITH THE WIND STARTED!") }, - { config.miningGoneWithTheWindSound } + { config.miningGoneWithTheWindSound }, ), WIND20( "Gone with the Wind Event in 20s!", "§9⚑", { it.contains("The §9Gone with the Wind §eevent starts in §a20 §eseconds!") }, - { config.miningGoneWithTheWindSound && config.miningWarn20sBeforeEvent } + { config.miningGoneWithTheWindSound && config.miningWarn20sBeforeEvent }, ), BETTER_TOGETHER( "Better Together", "§d⚑", { it.contains("§r§d§lBETTER TOGETHER STARTED!") }, - { config.miningBetterTogetherSound } + { config.miningBetterTogetherSound }, ), BETTER_TOGETHER20( "Better Together Event in 20s!", "§d⚑", { it.contains("The §dBetter Together §eevent starts in §a20 §eseconds!") }, - { config.miningBetterTogetherSound && config.miningWarn20sBeforeEvent } + { config.miningBetterTogetherSound && config.miningWarn20sBeforeEvent }, ), RAID( "Goblin Raid", "§c⚑", { it.contains("§r§c§lGOBLIN RAID STARTED!") }, - { config.miningGoblinRaidSound } + { config.miningGoblinRaidSound }, ), RAID20( "Goblin Raid Event in 20s!", "§c⚑", { it.contains("The §cGoblin Raid §eevent starts in §a20 §eseconds!") }, - { config.miningGoblinRaidSound && config.miningWarn20sBeforeEvent } + { config.miningGoblinRaidSound && config.miningWarn20sBeforeEvent }, ), RAFFLE( "Raffle", "§6⚑", { it.contains("§r§6§lRAFFLE STARTED!") }, - { config.miningRaffleSound } + { config.miningRaffleSound }, ), RAFFLE20( "Raffle Event in 20s!", "§6⚑", { it.contains("The §6Raffle §eevent starts in §a20 §eseconds!") }, - { config.miningRaffleSound && config.miningWarn20sBeforeEvent } + { config.miningRaffleSound && config.miningWarn20sBeforeEvent }, ), GOURMAND( "Mithril Gourmand", "§b⚑", { it.contains("§r§b§lMITHRIL GOURMAND STARTED!") }, - { config.miningMithrilGourmandSound } + { config.miningMithrilGourmandSound }, ), GOURMAND20( "Mithril Gourmand Event in 20s!", "§b⚑", { it.contains("The §bMithril Gourmand §eevent starts in §a20 §eseconds!") }, - { config.miningMithrilGourmandSound && config.miningWarn20sBeforeEvent } + { config.miningMithrilGourmandSound && config.miningWarn20sBeforeEvent }, ), POWDER_GHAST( "Powder Ghast", "§r§6", { it.contains("§r§6§lPOWDER GHAST!") }, - { config.miningPowderGhastSound } + { config.miningPowderGhastSound }, ), FALLEN_STAR( "Fallen Star", "§r§5", { it.contains("§r§5§l✯ §r§eA §r§5Fallen Star §r§ehas crashed at ") }, - { config.miningFallenStarSound } - ) + { config.miningFallenStarSound }, + ), } /* ALL THE MINING EVENTS RELATED MESSAGES @@ -151,4 +151,4 @@ enum class MiningEvent( FALLEN STAR §r§5§l✯ §r§eA §r§5Fallen Star §r§ehas crashed at §r§bRoyal Mines§r§e! Nearby ore and Powder drops are amplified!§r - */ \ No newline at end of file + */ From 5240f2d257654cfd98b344b27fde846601f8f048 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Wed, 3 Jul 2024 18:35:13 +0200 Subject: [PATCH 13/15] fix Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> --- .../partlysaneskies/events/EventManager.kt | 17 +++++++--------- .../events/data/LoadPublicDataEvent.kt | 2 -- .../skyblock/dungeons/DungeonEndEvent.kt | 4 ++-- .../skyblock/dungeons/DungeonStartEvent.kt | 4 ++-- .../events/skyblock/mining/MinesEvent.kt | 20 +++++++++---------- 5 files changed, 21 insertions(+), 26 deletions(-) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/EventManager.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/EventManager.kt index f3cb14b32..e6fc985a6 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/EventManager.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/EventManager.kt @@ -34,7 +34,7 @@ object EventManager { if (functionParameters.size != 2) { // if there is not only 1 parameter (param 1 is always the instance parameter log( Level.WARN, - "Unable to add ${function.name} due to incorrect number of function parameters (${functionParameters.size}" + "Unable to add ${function.name} due to incorrect number of function parameters (${functionParameters.size}", ) continue } @@ -50,19 +50,16 @@ object EventManager { @SubscribeEvent fun onScreenRender(event: RenderWorldLastEvent) { - RenderWaypointEvent.onEventCall( - event.partialTicks, - registeredFunctions[RenderWaypointEvent::class] ?: ArrayList() - ) + RenderWaypointEvent.onEventCall(event.partialTicks, registeredFunctions[RenderWaypointEvent::class] ?: ArrayList()) } @SubscribeEvent - fun onChatRecievedEvent(event: ClientChatReceivedEvent) { + fun onChatReceivedEvent(event: ClientChatReceivedEvent) { val message = event.message.formattedText - DungeonStartEvent.onMessageRecieved(registeredFunctions[DungeonStartEvent::class] ?: ArrayList(), message) - DungeonEndEvent.onMessageRecieved(registeredFunctions[DungeonEndEvent::class] ?: ArrayList(), message) - MinesEvent.onMessageRecieved(registeredFunctions[MinesEvent::class] ?: ArrayList(), message) + DungeonStartEvent.onMessageReceived(registeredFunctions[DungeonStartEvent::class] ?: ArrayList(), message) + DungeonEndEvent.onMessageReceived(registeredFunctions[DungeonEndEvent::class] ?: ArrayList(), message) + MinesEvent.onMessageReceived(registeredFunctions[MinesEvent::class] ?: ArrayList(), message) } internal class EventFunction(val obj: Any, val function: KFunction<*>) -} \ No newline at end of file +} diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/data/LoadPublicDataEvent.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/data/LoadPublicDataEvent.kt index ba30318a0..0de34ffbc 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/data/LoadPublicDataEvent.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/data/LoadPublicDataEvent.kt @@ -20,8 +20,6 @@ class LoadPublicDataEvent { function.function.call(function.obj, event) } catch (e: Exception) { e.printStackTrace() - } finally { - } } }.start() diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/dungeons/DungeonEndEvent.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/dungeons/DungeonEndEvent.kt index 9a72fbde7..cf213ccf5 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/dungeons/DungeonEndEvent.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/dungeons/DungeonEndEvent.kt @@ -4,7 +4,7 @@ import me.partlysanestudios.partlysaneskies.events.EventManager class DungeonEndEvent { companion object { - internal fun onMessageRecieved(functionList: List, formattedMessage: String) { + internal fun onMessageReceived(functionList: List, formattedMessage: String) { if (formattedMessage.contains("§r§c☠ §r§eDefeated §r")) { for (function in functionList) { try { @@ -16,4 +16,4 @@ class DungeonEndEvent { } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/dungeons/DungeonStartEvent.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/dungeons/DungeonStartEvent.kt index bc7485002..eef8b9a25 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/dungeons/DungeonStartEvent.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/dungeons/DungeonStartEvent.kt @@ -12,7 +12,7 @@ import me.partlysanestudios.partlysaneskies.utils.StringUtils.removeColorCodes class DungeonStartEvent { companion object { - internal fun onMessageRecieved(functionList: List, formattedMessage: String) { + internal fun onMessageReceived(functionList: List, formattedMessage: String) { val message = formattedMessage.removeColorCodes() if (message.contains("Starting in 1 second.") && IslandType.CATACOMBS.onIsland()) { for (function in functionList) { @@ -25,4 +25,4 @@ class DungeonStartEvent { } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/mining/MinesEvent.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/mining/MinesEvent.kt index 55bafdf58..3adcc74bb 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/mining/MinesEvent.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/mining/MinesEvent.kt @@ -13,22 +13,22 @@ import me.partlysanestudios.partlysaneskies.utils.HypixelUtils.inAdvancedMiningI class MinesEvent(val miningEvent: MiningEvent) { companion object { - internal fun onMessageRecieved(functionList: List, formattedMessage: String) { + internal fun onMessageReceived(functionList: List, formattedMessage: String) { if (!inAdvancedMiningIsland()) return - MiningEvent.entries.forEach { - if (it.triggeredEvent(formattedMessage)) { - ChatUtils.sendClientMessage("Triggered event: ${it.event}") + MiningEvent.entries + .firstOrNull { it.triggeredEvent(formattedMessage) } + ?.let { event -> + ChatUtils.sendClientMessage("Triggered event: ${event.event}") for (function in functionList) { try { - function.function.call(function.obj, it) - } catch (exception: Exception) { - exception.printStackTrace() + ChatUtils.sendClientMessage("Calling function: ${function.function.name}") + function.function.call(function.obj, MinesEvent(event)) + } catch (e: Exception) { + e.printStackTrace() } } } - - } } } -} \ No newline at end of file +} From e2558973b8f3a963064e28b8b7aaf15f8f7926ff Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Mon, 22 Jul 2024 23:18:15 +0200 Subject: [PATCH 14/15] remove debug Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> --- .../partlysaneskies/events/skyblock/mining/MinesEvent.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/mining/MinesEvent.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/mining/MinesEvent.kt index 3adcc74bb..171902cfc 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/mining/MinesEvent.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/events/skyblock/mining/MinesEvent.kt @@ -8,7 +8,6 @@ package me.partlysanestudios.partlysaneskies.events.skyblock.mining import me.partlysanestudios.partlysaneskies.events.EventManager import me.partlysanestudios.partlysaneskies.features.mining.events.MiningEvent -import me.partlysanestudios.partlysaneskies.utils.ChatUtils import me.partlysanestudios.partlysaneskies.utils.HypixelUtils.inAdvancedMiningIsland class MinesEvent(val miningEvent: MiningEvent) { @@ -19,10 +18,8 @@ class MinesEvent(val miningEvent: MiningEvent) { MiningEvent.entries .firstOrNull { it.triggeredEvent(formattedMessage) } ?.let { event -> - ChatUtils.sendClientMessage("Triggered event: ${event.event}") for (function in functionList) { try { - ChatUtils.sendClientMessage("Calling function: ${function.function.name}") function.function.call(function.obj, MinesEvent(event)) } catch (e: Exception) { e.printStackTrace() From 9e157d18e6686abd625fdfad33943fef51705645 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Wed, 24 Jul 2024 17:07:59 +0200 Subject: [PATCH 15/15] Update src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt Co-authored-by: Su386 <83100266+Su386yt@users.noreply.github.com> Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> --- .../partlysaneskies/features/mining/events/MiningEvent.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt index ae079395b..82fb3c75b 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/mining/events/MiningEvent.kt @@ -1,3 +1,9 @@ +// +// Written by J10a1n15. +// See LICENSE for copyright and license notices. +// + + package me.partlysanestudios.partlysaneskies.features.mining.events import me.partlysanestudios.partlysaneskies.PartlySaneSkies.Companion.config