summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/chat
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/chat')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/ChatPeek.kt30
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt32
2 files changed, 62 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatPeek.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatPeek.kt
new file mode 100644
index 000000000..5d5580772
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatPeek.kt
@@ -0,0 +1,30 @@
+package at.hannibal2.skyhanni.features.chat
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.GuiEditManager
+import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
+import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI
+import at.hannibal2.skyhanni.features.misc.visualwords.VisualWordGui
+import at.hannibal2.skyhanni.utils.NEUItems
+import io.github.moulberry.moulconfig.gui.GuiScreenElementWrapper
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.inventory.GuiEditSign
+import org.lwjgl.input.Keyboard
+
+
+object ChatPeek {
+ @JvmStatic
+ fun peek(): Boolean {
+ val key = SkyHanniMod.feature.chat.peekChat
+
+ if (Minecraft.getMinecraft().thePlayer == null) return false
+ if (key <= Keyboard.KEY_NONE) return false
+ if (Minecraft.getMinecraft().currentScreen is GuiEditSign) return false
+ if (Minecraft.getMinecraft().currentScreen is GuiScreenElementWrapper) return false
+
+ if (NEUItems.neuHasFocus()) return false
+ if (GuiEditManager.isInGui() || FFGuideGUI.isInGui() || VisualWordGui.isInGui()) return false
+
+ return key.isKeyHeld()
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt
new file mode 100644
index 000000000..dfc0db3f9
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt
@@ -0,0 +1,32 @@
+package at.hannibal2.skyhanni.features.chat
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import net.minecraft.util.ChatComponentText
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class CompactSplashPotionMessage {
+ private val potionEffectPattern =
+ "§a§lBUFF! §fYou have gained §r(?<name>.*)§r§f! Press TAB or type /effects to view your active effects!".toPattern()
+ private val potionEffectOthersPattern =
+ "§a§lBUFF! §fYou were splashed by (?<playerName>.*) §fwith §r(?<effectName>.*)§r§f! Press TAB or type /effects to view your active effects!".toPattern()
+
+ @SubscribeEvent
+ fun onChatMessage(event: LorenzChatEvent) {
+ if (!LorenzUtils.inSkyBlock || !SkyHanniMod.feature.chat.compactPotionMessage) return
+
+ potionEffectPattern.matchMatcher(event.message) {
+ val name = group("name")
+ event.chatComponent = ChatComponentText("§a§lPotion Effect! §r$name")
+ }
+
+ potionEffectOthersPattern.matchMatcher(event.message) {
+ val playerName = group("playerName").removeColor()
+ val effectName = group("effectName")
+ event.chatComponent = ChatComponentText("§a§lPotion Effect! §r$effectName by §b$playerName")
+ }
+ }
+} \ No newline at end of file