Skip to content

Commit

Permalink
fix: don't check whether it is a Single Player session or not
Browse files Browse the repository at this point in the history
  • Loading branch information
70CentsApple committed Oct 1, 2024
1 parent da54006 commit a4be942
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,8 @@ public static void addChatBubble(Text text) {
boolean serverAddressPass = false;
boolean fallback = false;
for (SpecialUnits.BubbleRuleUnit unit : SpecialUnits.BubbleRuleUnit.fromList((List) ChatTools.CONFIG.get("bubble.List"))) {
if (mc.getCurrentServerEntry() == null) {
// single player world
if ("*".equals(unit.address)) {
serverAddressPass = true;
pattern = unit.pattern;
fallback = unit.fallback;
break;
}
} else if ("*".equals(unit.address) || Pattern.compile(unit.address)
.matcher(ContextUtils.getSessionIdentifier()).matches()) {
if ("*".equals(unit.address) || Pattern.compile(unit.address).matcher(ContextUtils.getSessionIdentifier())
.matches()) {
serverAddressPass = true;
pattern = unit.pattern;
fallback = unit.fallback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,7 @@ public static String work(String message) {
boolean matched = false;
String formatter = "{text}";
for (SpecialUnits.FormatterUnit unit : SpecialUnits.FormatterUnit.fromList((List) ChatTools.CONFIG.get("formatter.List"))) {
if ("*".equals(unit.address)) {
matched = true;
formatter = unit.formatter;
// we just need the first match result, break immediately.
break;
} else if (MinecraftClient.getInstance().getCurrentServerEntry() == null) {
// It is in a single player world
continue;
} else if (Pattern.compile(unit.address).matcher(ContextUtils.getSessionIdentifier()).matches()) {
if (Pattern.compile(unit.address).matcher(ContextUtils.getSessionIdentifier()).matches()) {
matched = true;
formatter = unit.formatter;
// we just need the first match result, break immediately.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,7 @@ public static void work(Text text) {
long delayInMilliseconds = 0;
boolean forceDisableFormatter = false;
for (SpecialUnits.ResponderRuleUnit unit : SpecialUnits.ResponderRuleUnit.fromList((List) ChatTools.CONFIG.get("responder.List"))) {
if (mc.getCurrentServerEntry() == null) {
if ("*".equals(unit.address)) {
if (Pattern.compile(unit.pattern, Pattern.MULTILINE).matcher(messageReceived).matches()) {
shouldRespond = true;
pattern = unit.pattern;
message = unit.message;
delayInMilliseconds = unit.delayInMilliseconds;
forceDisableFormatter = unit.forceDisableFormatter;
break;
}
}
} else if ("*".equals(unit.address) || Pattern.compile(unit.address)
.matcher(ContextUtils.getSessionIdentifier()).matches()) {
if ("*".equals(unit.address) || Pattern.compile(unit.address).matcher(ContextUtils.getSessionIdentifier()).matches()) {
if (Pattern.compile(unit.pattern, Pattern.MULTILINE).matcher(messageReceived).matches()) {
shouldRespond = true;
pattern = unit.pattern;
Expand Down

0 comments on commit a4be942

Please sign in to comment.