Skip to content

Commit

Permalink
fix short channel names and colored friend statuses incompatibility (#52
Browse files Browse the repository at this point in the history
)
  • Loading branch information
MicrocontrollersDev authored Jan 10, 2023
1 parent 8f80504 commit 691b784
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,22 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
Matcher matcher = getLanguage().chatRestylerStatusPatternRegex.matcher(message);
if (matcher.matches()) {
final String status = matcher.group("status"); // TODO: fix short channel names so we can remove the 2nd group

String channelStarter = null; // Fixes short channel name incompatibility since it randomly popped up despite what appears to be no changes
if (matcher.group("type").contains("F")) {
if (HytilsConfig.shortChannelNames) channelStarter = "§aF > §r";
else channelStarter = "§aFriend > §r";
}
if (matcher.group("type").contains("G")) {
if (HytilsConfig.shortChannelNames) channelStarter = "§2G > §r";
else channelStarter = "§2Guild > §r";
}

if (status.equalsIgnoreCase("joined")) {
event.message = colorMessage(matcher.group("type") + " > §r" + matcher.group("player") + " §r" + "§ajoined§e.");
event.message = colorMessage(channelStarter + matcher.group("player") + " §r" + "§ajoined§e.");
}
if (status.equalsIgnoreCase("left")) {
event.message = colorMessage(matcher.group("type") + " > §r" + matcher.group("player") + " §r" + "§cleft§e.");
event.message = colorMessage(channelStarter + matcher.group("player") + " §r" + "§cleft§e.");
}
}
}
Expand Down

0 comments on commit 691b784

Please sign in to comment.