File tree Expand file tree Collapse file tree
src/main/kotlin/com/mairwunnx/projectessentials/chat Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,6 +84,8 @@ object ChatUtils {
8484
8585 fun isGlobalChat (event : ServerChatEvent ): Boolean = event.message.startsWith(' !' )
8686
87+ fun isCommonChat (): Boolean = ! ChatModelBase .chatModel.messaging.enableRangedChat
88+
8789 fun getMessagePattern (event : ServerChatEvent ): String {
8890 return when {
8991 ! ChatModelBase .chatModel.messaging.enableRangedChat -> ChatModelBase .chatModel.messaging.messageCommonPattern
Original file line number Diff line number Diff line change @@ -98,6 +98,21 @@ class EntryPoint : EssBase() {
9898 )
9999 }.setStyle(nicknameComponent)
100100
101+ val mentions = mutableListOf<String >()
102+ Regex (" @\\ S[a-zA-Z0-9]*" ).findAll(event.component.formattedText).forEach {
103+ mentions.add(it.value)
104+ }
105+ mentions.forEach {
106+ event.component = TextComponentUtils .toTextComponent {
107+ event.component.formattedText.replace(
108+ it, " §c@§b${it.replace(" @" , " " )}${when {
109+ ChatUtils .isGlobalChat(event) -> " §f"
110+ else -> if (ChatUtils .isCommonChat()) " §f" else " §7§o"
111+ }} "
112+ )
113+ }
114+ }
115+
101116 if (! ChatUtils .isGlobalChat(event)) {
102117 val players = event.player.serverWorld.getEntitiesWithinAABB(
103118 event.player.entity.javaClass, AxisAlignedBB (
You can’t perform that action at this time.
0 commit comments