Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat PM short channel name #99

Merged
merged 3 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ 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 @@ -94,6 +96,12 @@ 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()) {
event.message = shortenChannelName(event.message, language.chatRestylerPrivateMessageToPatternRegex.pattern(),
"§d" + "PM >", true);
} else if (privateMessageFromMatcher.find()) {
event.message = shortenChannelName(event.message, language.chatRestylerPrivateMessageFromPatternRegex.pattern(),
"§5" + "PM <", true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public class LanguageData {
private String chatRestylerFriendPattern = "^((?:\u00a7r)?\u00a7\\w)(Friend >)";
private String chatRestylerOfficerPattern = "^((?:\u00a7r)?\u00a7\\w)(Officer >)";
private String chatRestylerStatusPattern = "^(?<type>(?:\u00a7aFriend|\u00a7a\u00a7aF|\u00a72Guild|\u00a72\u00a72G)) > (\u00a7r|\u00a7r\u00a7r){1,2}(?<player>\u00a7[\\da-f]\\w{1,16}) \u00a7r\u00a7e(?<status>(?:joined|left))\\.\u00a7r$";
private String chatRestylerPrivateMessageToPattern = "^((?:\u00a7r)?\u00a7\\w)(To)";
Zickles marked this conversation as resolved.
Show resolved Hide resolved
private String chatRestylerPrivateMessageFromPattern = "^((?:\u00a7r)?\u00a7\\w)(From)";

private String autoChatSwapperPartyStatus = "^(?:You have been kicked from the party by (?:\\[.+] )?\\w{1,16}|(?:\\[.+] )?\\w{1,16} has disbanded the party!|You left the party.)$";
private String autoChatSwapperPartyStatus2 = "^(?:You have joined (?:\\[.+] )?(?:.*)|Party Members(?:\\[.+] )?\\w{1,100}|(?:\\[.+] )?\\w{1,100} joined the(?:.*) party(?:.*))$";
Expand Down Expand Up @@ -157,6 +159,8 @@ public class LanguageData {
public Pattern chatRestylerFriendPatternRegex;
public Pattern chatRestylerOfficerPatternRegex;
public Pattern chatRestylerStatusPatternRegex;
public Pattern chatRestylerPrivateMessageToPatternRegex;
public Pattern chatRestylerPrivateMessageFromPatternRegex;

public Pattern autoChatSwapperPartyStatusRegex;
public Pattern autoChatSwapperPartyStatusRegex2;
Expand Down Expand Up @@ -223,6 +227,8 @@ public void initialize() {
chatRestylerFriendPatternRegex = Pattern.compile(chatRestylerFriendPattern);
chatRestylerOfficerPatternRegex = Pattern.compile(chatRestylerOfficerPattern);
chatRestylerStatusPatternRegex = Pattern.compile(chatRestylerStatusPattern);
chatRestylerPrivateMessageToPatternRegex = Pattern.compile(chatRestylerPrivateMessageToPattern);
chatRestylerPrivateMessageFromPatternRegex = Pattern.compile(chatRestylerPrivateMessageFromPattern);

autoChatSwapperPartyStatusRegex = Pattern.compile(autoChatSwapperPartyStatus);
autoChatSwapperPartyStatusRegex2 = Pattern.compile(autoChatSwapperPartyStatus2);
Expand Down