aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/lorenz/mod/utils
diff options
context:
space:
mode:
authorLorenz <ESs95s3P5z8Pheb>2022-07-09 02:41:10 +0200
committerLorenz <ESs95s3P5z8Pheb>2022-07-09 02:41:10 +0200
commit29f8bad3e41c8a0215a8b4f3e971a24a2a1f9758 (patch)
tree2e3cac801aaa3c6adeb9ceb0ce30d898d2eb3881 /src/main/java/at/lorenz/mod/utils
parent70ed542804a403790932abdf5d601d3c0c26cfe8 (diff)
downloadskyhanni-29f8bad3e41c8a0215a8b4f3e971a24a2a1f9758.tar.gz
skyhanni-29f8bad3e41c8a0215a8b4f3e971a24a2a1f9758.tar.bz2
skyhanni-29f8bad3e41c8a0215a8b4f3e971a24a2a1f9758.zip
adding support for isOnHypixel, inSkyblock and inDungeons
Diffstat (limited to 'src/main/java/at/lorenz/mod/utils')
-rw-r--r--src/main/java/at/lorenz/mod/utils/LorenzUtils.kt33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/main/java/at/lorenz/mod/utils/LorenzUtils.kt b/src/main/java/at/lorenz/mod/utils/LorenzUtils.kt
index e27e0f50f..2295fa513 100644
--- a/src/main/java/at/lorenz/mod/utils/LorenzUtils.kt
+++ b/src/main/java/at/lorenz/mod/utils/LorenzUtils.kt
@@ -1,5 +1,6 @@
package at.lorenz.mod.utils
+import at.lorenz.mod.misc.HypixelData
import net.minecraft.client.Minecraft
import net.minecraft.util.ChatComponentText
import org.intellij.lang.annotations.Language
@@ -7,26 +8,46 @@ import java.text.SimpleDateFormat
object LorenzUtils {
+ val isOnHypixel: Boolean
+ get() = HypixelData.hypixel
+
+ val inSkyblock: Boolean
+ get() = HypixelData.hypixel && HypixelData.skyblock
+
+ val inDungeons: Boolean
+ get() = HypixelData.hypixel && HypixelData.skyblock && HypixelData.dungeon
+
const val DEBUG_PREFIX = "[Debug] §7"
fun debug(message: String) {
- internaChat(DEBUG_PREFIX + message)
+ internalChat(DEBUG_PREFIX + message)
}
fun warning(message: String) {
- internaChat("§cWarning! $message")
+ internalChat("§cWarning! $message")
}
fun error(message: String) {
- internaChat("§4$message")
+ internalChat("§4$message")
}
fun chat(message: String) {
- internaChat(message)
+ internalChat(message)
}
- private fun internaChat(message: String) {
- val thePlayer = Minecraft.getMinecraft().thePlayer
+ private fun internalChat(message: String) {
+ val minecraft = Minecraft.getMinecraft()
+ if (minecraft == null) {
+ println(message)
+ return
+ }
+
+ val thePlayer = minecraft.thePlayer
+ if (thePlayer == null) {
+ println(message)
+ return
+ }
+
thePlayer.addChatMessage(ChatComponentText(message))
}