aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/ambientaddons/features/misc/Welcome.kt
blob: ac990254c43b703b5f0b2861d81b22ecc29d0ee9 (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
package com.ambientaddons.features.misc

import AmbientAddons.Companion.mc
import AmbientAddons.Companion.persistentData
import com.ambientaddons.utils.SBLocation
import gg.essential.universal.UChat
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent

object Welcome {

    @SubscribeEvent
    fun onTick(event: ClientTickEvent) {
        if (!persistentData.isFirstLoad || event.phase != TickEvent.Phase.START || !SBLocation.inSkyblock) return
        val chatWidth = mc.ingameGUI?.chatGUI?.chatWidth ?: return
        persistentData.isFirstLoad = false
        persistentData.save()
        val chatBreak = "§9§m" + "-".repeat(chatWidth / mc.fontRendererObj.getStringWidth("-"))
        UChat.chat("""
            $chatBreak
            §b§lThanks for installing AmbientAddons Forge!
            
             §eUse §a§l/ambient §r§eto access GUI settings.
             §eAliases: §a/aa §eor §a/ambientaddons
            
             §eTo configure auto-buy, use §a/ambient buy§e.
             §eTo configure salvage features, use §a/ambient salvage§e.
            $chatBreak
        """.trimIndent())
    }
}