Skip to content

Commit

Permalink
chore: some debug texts; add tooltip for Chat Responser
Browse files Browse the repository at this point in the history
  • Loading branch information
70CentsApple committed Sep 9, 2023
1 parent dc61b54 commit 7cf14cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ public static ConfigBuilder getConfigBuilder() {
// ========== Chat Responser Category ==========
ConfigCategory chatResponserCategory = builder.getOrCreateCategory(Text.translatable("key.chattools.category.responser"));
// 启用聊天回应
chatResponserCategory.addEntry(eb.startBooleanToggle(Text.translatable("text.config.chattools.option.responserEnabled"), config.chatResponserEnabled).setDefaultValue(new ModConfigFallback().chatResponserEnabled).setSaveConsumer(v -> config.chatResponserEnabled = v).build());
chatResponserCategory.addEntry(eb.startBooleanToggle(Text.translatable("text.config.chattools.option.responserEnabled"), config.chatResponserEnabled).setDefaultValue(new ModConfigFallback().chatResponserEnabled).setSaveConsumer(v -> config.chatResponserEnabled = v).setTooltip(Text.translatable("text.config.chattools.option.responserEnabled.@Tooltip")).build());
// 回应规则
if (MinecraftClient.getInstance().getCurrentServerEntry() == null) {
label = Text.translatable("text.config.chattools.option.responserRulesList", "§f-");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public void setAddress(String address) {
public String getPattern() {
return pattern;
}

public void setPattern(String pattern) {
this.pattern = pattern;
}
Expand Down Expand Up @@ -80,7 +81,6 @@ static String replaceAllGroupNames(String rawMessageReceived, String rawPattern,
Matcher rawMessageMatcher = Pattern.compile(rawPattern).matcher(rawMessageReceived);
while (matcher.find()) {
String groupName = matcher.group("group");
System.out.println("groupName = " + groupName);
if (rawMessageMatcher.find()) {
String context = rawMessageMatcher.group(groupName);
if (context != null && !context.isBlank()) { // 捕获到的组内容非空
Expand Down Expand Up @@ -123,8 +123,9 @@ public static void work(String messageReceived) {
if (mc.player != null) {
message = message.replace("{pos}", String.format("(%d,%d,%d)", (int) mc.player.getX(), (int) mc.player.getY(), (int) mc.player.getZ()));
}
ChatTools.LOGGER.info("[ChatTools] Respond to `" + pattern + "`, with message `" + message + "`");
message = message.replace("\\{", "{").replace("\\}", "}");
ChatTools.sendPlayerChat(message,forceDisableInjector);
ChatTools.sendPlayerChat(message, forceDisableInjector);
}
}
}

0 comments on commit 7cf14cd

Please sign in to comment.