diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-01 10:47:24 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-01 10:47:24 +0100 |
commit | 3335006b3763fd19bbf15dcd350cbce178d25a07 (patch) | |
tree | 09f03a99f9de3cb72098ff931101dd6665219b9f /src/main/java/at/hannibal2/skyhanni | |
parent | 9dbc2ba9eb3a14a539523c90efea67cb09b944da (diff) | |
download | skyhanni-3335006b3763fd19bbf15dcd350cbce178d25a07.tar.gz skyhanni-3335006b3763fd19bbf15dcd350cbce178d25a07.tar.bz2 skyhanni-3335006b3763fd19bbf15dcd350cbce178d25a07.zip |
code cleanup and minor fixes
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/ChatConfig.java | 27 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt | 23 |
2 files changed, 25 insertions, 25 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/ChatConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/ChatConfig.java index e2e67573f..5b770b9d1 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/ChatConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/ChatConfig.java @@ -119,7 +119,7 @@ public class ChatConfig { @Expose @ConfigOption(name = "Player Chat Symbols", desc = "") @Accordion - public ChatSymbols chatSymbols = new ChatSymbols(); + public CompactPotionConfig chatSymbols = new CompactPotionConfig(); public static class ChatSymbols { @@ -159,16 +159,23 @@ public class ChatConfig { //TODO jawbus + thunder @Expose - @ConfigOption(name = "Compact Potion Message", desc = "Shorten chat messages about player potion effects.") - @ConfigEditorBoolean - @FeatureToggle - public boolean compactPotionMessage = true; + @ConfigOption(name = "Compact Potion Messages", desc = "") + @Accordion + public CompactPotionConfig compactPotionMessages = new CompactPotionConfig(); - @Expose - @ConfigOption(name = "Clickable Potion Messages", desc = "Makes the Compact Potion message open the Potion effects menu on click.") - @ConfigEditorBoolean - @FeatureToggle - public boolean compactPotionClickableMessage = true; + public static class CompactPotionConfig { + + @Expose + @ConfigOption(name = "Enabled", desc = "Shorten chat messages about player potion effects.") + @ConfigEditorBoolean + @FeatureToggle + public boolean enabled = true; + + @Expose + @ConfigOption(name = "Clickable Chat Message", desc = "Makes the Compact Potion message open the Potion effects menu on click.") + @ConfigEditorBoolean + public boolean clickableChatMessage = true; + } @Expose @ConfigOption(name = "Compact Bestiary Message", desc = "Shorten the Bestiary level up message, showing additional information when hovering.") diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt index d9732079f..c823d83f0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CompactSplashPotionMessage { - private val config get() = SkyHanniMod.feature.chat + private val config get() = SkyHanniMod.feature.chat.compactPotionMessages private val potionEffectPattern = "§a§lBUFF! §fYou have gained §r(?<name>.*)§r§f! Press TAB or type /effects to view your active effects!".toPattern() @@ -19,40 +19,33 @@ class CompactSplashPotionMessage { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.inSkyBlock || !config.compactPotionMessage) return + if (!LorenzUtils.inSkyBlock || !config.enabled) return potionEffectPattern.matchMatcher(event.message) { val name = group("name") sendMessage("§a§lPotion Effect! §r$name") - event.blockedReason = "blocked" + event.blockedReason = "compact_potion_effect" } potionSplashEffectOthersPattern.matchMatcher(event.message) { val playerName = group("playerName").removeColor() val effectName = group("effectName") - sendMessage( - "§a§lPotion Effect! §r$effectName by §b$playerName", - ) - event.blockedReason = "blocked" + sendMessage("§a§lPotion Effect! §r$effectName by §b$playerName") + event.blockedReason = "compact_potion_effect" } potionSplashEffectPattern.matchMatcher(event.message) { val name = group("name") sendMessage("§a§lPotion Effect! §r$name") - event.blockedReason = "blocked" + event.blockedReason = "compact_potion_effect" } } private fun sendMessage(message: String) { - if (config.compactPotionClickableMessage) { - LorenzUtils.hoverableChat( - message, - listOf("§eClick to view your potion effects."), - "/effects" - ) + if (config.clickableChatMessage) { + LorenzUtils.hoverableChat(message, listOf("§eClick to view your potion effects."), "/effects") } else { LorenzUtils.chat(message) - } } } |