Skip to content

Commit

Permalink
feat separate option
Browse files Browse the repository at this point in the history
  • Loading branch information
Zickles committed Jul 19, 2024
1 parent ba61c69 commit 1a6fd55
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/main/java/org/polyfrost/hytils/config/HytilsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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()) {
Expand Down

0 comments on commit 1a6fd55

Please sign in to comment.