blob: 4ee986dbfae804f0bdeb6ec6d8092d8b496fc397 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
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.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.ChatUtils
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.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) {
ChatUtils.clickableChat("Click here to warp to Dwarven Mines!", "warp mines")
} else {
ChatUtils.chat("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!" && inTime()) {
ChatUtils.clickableChat("Click here to warp to Crystal Hollows!", "warp ch")
}
}
@SubscribeEvent
fun onIslandChange(event: IslandChangeEvent) {
if (!isEnabled()) return
if (event.newIsland == IslandType.DWARVEN_MINES && inTime()) {
ChatUtils.chat("Buy a §2Crystal Hollows Pass §efrom §5Gwendolyn§e!")
}
if (event.newIsland == IslandType.CRYSTAL_HOLLOWS) {
lastWrongPassTime = 0
}
}
@SubscribeEvent
fun onRenderWorld(event: LorenzRenderWorldEvent) {
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
}
|