Enhance /grim sendalert with Hybrid MiniMessage & Legacy Formatting#2141
Enhance /grim sendalert with Hybrid MiniMessage & Legacy Formatting#2141GigaZelensky wants to merge 3 commits into
Conversation
|
MessageUtil.miniMessage already handles legacy formatting codes |
the sendalert command doesn't handle minimessage tho |
|
(This isn't ready yet too) i tested on lightninggrim and it doesnt work on here lmao edit: i think the reason it's not working is because packetevents broke it: retrooper/packetevents#1241 i love my life Edit 2: More research has led me to conclude the issue is somehow packetevents. I guess I'll wait for a fix... |
This reverts commit 29056ec.
it does |
i might just be stupid ill test it further lol |
|
I would like to take this moment of utter stupidity to address the fact that hovering and clicking does not work with current PacketEvents. Or maybe I'm just being stupid again lol. |
5bef6b9 to
0374b8c
Compare
|
|
This PR updates the
/grim sendalertcommand to support both MiniMessage and traditional legacy&color code formatting for staff alerts. This allows for richer alert messages using features like hover/click events and gradients, while maintaining compatibility with existing legacy formatted messages.Changes
Input Pre-processing:
"/') from the input message.%placeholders%.&color codes to§section codes. This helps the MiniMessage parser correctly interpret legacy codes embedded within MiniMessage tag attributes (e.g.,hover_text).Hybrid Parsing Strategy:
§codes) is first parsed using a strictMiniMessageinstance.&cHello), the logic proceeds to the fallback.MessageUtil.miniMessage):MessageUtil.miniMessage()is used with the original (pre-§translation) string to ensure correct legacy&code handling.MessageUtil.miniMessage()is used as a fallback with the original string.This ensures pure MiniMessage, pure legacy codes, and MiniMessage containing embedded legacy codes are all handled appropriately.
How to Test
/grim sendalert &cLegacy &lAlert/grim sendalert "<red>MiniMessage <click:run_command:/say Test>Click</click>"&in attributes:/grim sendalert "<hover:show_text:'&aTooltip &6Example'>Hover Me</hover>"/grim sendalert ""'<blue>Quoted MiniMessage</blue>'""This provides a robust and flexible way for staff to create alerts, without impacting any current configurations.