diff --git a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java index 4715313..21ec5f6 100644 --- a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java +++ b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java @@ -321,6 +321,13 @@ public class HytilsConfig extends Config { ) public static boolean shortChannelNames; + @Switch( + name = "Short Private Message Channel Names", + description = "Abbreviate private message channel names\n§eExample: §dTo and §dFrom §e-> PM", + category = "Chat", subcategory = "Visual" + ) + public static boolean pmShortChannelNames; + @Switch( name = "Party Chat Swapper", description = "Automatically change to and out of a party channel when joining/leaving a party.", diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/modifiers/DefaultChatRestyler.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/modifiers/DefaultChatRestyler.java index cc08be5..c3536df 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/modifiers/DefaultChatRestyler.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/modifiers/DefaultChatRestyler.java @@ -82,8 +82,6 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { Matcher guildMatcher = language.chatRestylerGuildPatternRegex.matcher(message); Matcher friendMatcher = language.chatRestylerFriendPatternRegex.matcher(message); Matcher officerMatcher = language.chatRestylerOfficerPatternRegex.matcher(message); - Matcher privateMessageToMatcher = language.chatRestylerPrivateMessageToPatternRegex.matcher(message); - Matcher privateMessageFromMatcher = language.chatRestylerPrivateMessageFromPatternRegex.matcher(message); if (partyMatcher.find()) { event.message = shortenChannelName(event.message, language.chatRestylerPartyPatternRegex.pattern(), partyMatcher.group(1) + "P " + partyMatcher.group(3), false); @@ -96,7 +94,13 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { } else if (officerMatcher.find()) { event.message = shortenChannelName(event.message, language.chatRestylerOfficerPatternRegex.pattern(), officerMatcher.group(1) + "O >", false); - } else if (privateMessageToMatcher.find()) { + } + } + + if (HytilsConfig.pmShortChannelNames) { + Matcher privateMessageToMatcher = language.chatRestylerPrivateMessageToPatternRegex.matcher(message); + Matcher privateMessageFromMatcher = language.chatRestylerPrivateMessageFromPatternRegex.matcher(message); + if (privateMessageToMatcher.find()) { event.message = shortenChannelName(event.message, language.chatRestylerPrivateMessageToPatternRegex.pattern(), "§d" + "PM >", true); } else if (privateMessageFromMatcher.find()) {