diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | FEATURES.md | 3 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java | 1 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/Misc.java | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt | 81 |
5 files changed, 90 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f6f8b0a66..bd1a3eaf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ + Added **Contest Time** - Adds the real time format to the farming contest description. + Added **Hide Repeated Catches** - Delete past catches of the same trophy fish from chat. - (Thanks appable0) + Added **Trophy Counter Design** - Change the way trophy fish messages gets displayed in the chat. - (Thanks appable0) ++ Added **CH Join** - Helps buy a Pass for accessing the Crystal Hollows if needed. ### Garden Features + Added **Copper Price** - Show copper to coin prices inside the Sky Mart inventory. diff --git a/FEATURES.md b/FEATURES.md index d26e6b6d3..26c2b9fa8 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -219,4 +219,5 @@ + **Tps Display** - Show the Tps of the current server. + **Particle Hider** - Hide blaze particles, fire block particles, fireball particles, near redstone particles, far particles or smoke particles. + Chicken Head Timer. -+ **rancher boots** speed display.
\ No newline at end of file ++ **rancher boots** speed display. ++ **CH Join** - Helps buy a Pass for accessing the Crystal Hollows if needed.
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 9c7538839..bb82c5cc6 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -230,6 +230,7 @@ public class SkyHanniMod { loadModule(new GardenNextJacobContest()); loadModule(new WrongFungiCutterWarning()); loadModule(new FarmingArmorDrops()); + loadModule(new JoinCrystalHollows()); Commands.INSTANCE.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index 4268a4286..8e59cb297 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -253,6 +253,11 @@ public class Misc { public boolean hideExplosions = false; @Expose + @ConfigOption(name = "CH Join", desc = "Helps buy a Pass for accessing the Crystal Hollows if needed.") + @ConfigEditorBoolean + public boolean crystalHollowsJoin = true; + + @Expose @ConfigOption(name = "Fire Overlay Hider", desc = "Hide the fire overlay (Like in Skytils)") @ConfigEditorBoolean public boolean hideFireOverlay = false; diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt new file mode 100644 index 000000000..f12506c33 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt @@ -0,0 +1,81 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.IslandChangeEvent +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import net.minecraft.client.Minecraft +import net.minecraft.event.ClickEvent +import net.minecraft.event.HoverEvent +import net.minecraft.util.ChatComponentText +import net.minecraftforge.client.event.RenderWorldLastEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class JoinCrystalHollows { + + private var lastWrongPassTime = 0L + + @SubscribeEvent + fun onChat(event: LorenzChatEvent) { + if (!isEnabled()) return + + val message = event.message + if (message == "§cYou do not have an active Crystal Hollows pass!") { + lastWrongPassTime = System.currentTimeMillis() + if (LorenzUtils.skyBlockIsland != IslandType.DWARVEN_MINES) { + sendClickableMessage("§e[SkyHanni] Click here to warp to Dwarven Mines!", "warp mines") + } else { + LorenzUtils.chat("§e[SkyHanni] Buy a §2Crystal Hollows Pass §efrom §5Gwendolyn") + } + } + if (message == "§e[NPC] §5Gwendolyn§f: §rGreat! Now hop on into the Minecart and I'll get you on your way!") { + if (inTime()) { + sendClickableMessage("§e[SkyHanni] Click here to warp to Crystal Hollows!", "warp ch") + } + } + } + + private fun sendClickableMessage(message: String, command: String) { + val text = ChatComponentText(message) + text.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.RUN_COMMAND, "/$command") + text.chatStyle.chatHoverEvent = + HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText("§eExecute /$command")) + Minecraft.getMinecraft().thePlayer.addChatMessage(text) + } + + @SubscribeEvent + fun onIslandChange(event: IslandChangeEvent) { + if (!isEnabled()) return + + if (event.newIsland == IslandType.DWARVEN_MINES) { + if (inTime()) { + LorenzUtils.chat("§e[SkyHanni] Buy a §2Crystal Hollows Pass §efrom §5Gwendolyn§e!") + } + } + if (event.newIsland == IslandType.CRYSTAL_HOLLOWS) { + lastWrongPassTime = 0 + } + } + + @SubscribeEvent + fun onRenderWorld(event: RenderWorldLastEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!isEnabled()) return + if (LorenzUtils.skyBlockIsland != IslandType.DWARVEN_MINES) return + + if (inTime()) { + val location = LorenzVec(88, 198, -99) + event.drawWaypointFilled(location, LorenzColor.YELLOW.toColor()) + event.drawDynamicText(location, "§eBuy Crystal Hollows Pass", 1.3) + } + } + + private fun inTime() = lastWrongPassTime + 1000 * 60 * 2 > System.currentTimeMillis() + + fun isEnabled() = SkyHanniMod.feature.misc.crystalHollowsJoin +}
\ No newline at end of file |