Skip to content

Commit

Permalink
Merge branch 'master' into twoconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyvest committed Jul 19, 2024
2 parents ca90193 + c60c56a commit e2e57b8
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 41 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod_name = Hytils Reborn
mod_id = hytils-reborn
mod_version = 1.7.1
mod_version = 1.7.2-alpha.1
# Sets the name of the jar file that you put in your 'mods' folder.
mod_archives_name=Hytils Reborn

Expand Down
11 changes: 7 additions & 4 deletions src/main/java/org/polyfrost/hytils/config/HytilsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,13 @@ public class HytilsConfig extends Config {
)
public static boolean shortChannelNames;

@Switch(
title = "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(
title = "Party Chat Swapper",
description = "Automatically change to and out of a party channel when joining/leaving a party.",
Expand Down Expand Up @@ -1439,10 +1446,6 @@ public HytilsConfig() {
if (!cleanerGameStartAnnouncements) GameStartCompactor.lastMessage = null;
});

addDependency("playerCountBeforePlayerName", "gameStatusRestyle");
addDependency("playerCountOnPlayerLeave", "gameStatusRestyle");
addDependency("padPlayerCount", "gameStatusRestyle");

addDependency("blockNumber", "blockNotify");
addDependency("blockNotifySound", "blockNotify");
addDependency("blockNotifySound", "blockNotify");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
}
}

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()) {
event.message = shortenChannelName(event.message, language.chatRestylerPrivateMessageFromPatternRegex.pattern(),
"§5" + "PM <", true);
}
}

if (HytilsConfig.coloredStatuses) {
Matcher statusMatcher = getLanguage().chatRestylerStatusPatternRegex.matcher(event.message.getFormattedText().trim());
if (statusMatcher.matches()) {
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)";
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

This file was deleted.

1 change: 0 additions & 1 deletion src/main/resources/mixins.hytils.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"verbose": true,
"client": [
"BossStatusMixin_HideBossbar",
"CommandLimboMixin_FixCommand",
"EntityLivingBaseMixin_MiningFatigue",
"EntityPlayerSPMixin_MessageHandling",
"GuiChatMixin_PlayAutocomplete",
Expand Down

0 comments on commit e2e57b8

Please sign in to comment.