Skip to content

Commit

Permalink
Add resetConsoleColor config
Browse files Browse the repository at this point in the history
  • Loading branch information
Rothes committed Jul 26, 2024
1 parent ad9e6e6 commit 892da49
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class ConfigManager {
public final boolean directSkips;

public final String gitRawHost;
public final boolean resetConsoleColor;

public ConfigManager(ProtocolStringReplacer instance) {
CommentYamlConfiguration config = instance.getConfig();
Expand Down Expand Up @@ -106,6 +107,7 @@ public ConfigManager(ProtocolStringReplacer instance) {
this.removeCacheWhenMerchantTrade = config.getBoolean("Options.Features.ItemMetaCache.Remove-Cache-When-Merchant-Trade", false);

directSkips = config.getBoolean("Options.Features.Replace-Mode.Skip-When-Direct-Replaced", true);
resetConsoleColor = config.getBoolean("Options.Features.Console.Reset-Console-Color-At-End", true);
}

public enum LifeCycle {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.rothes.protocolstringreplacer.console;

import io.github.rothes.protocolstringreplacer.ConfigManager;
import io.github.rothes.protocolstringreplacer.ProtocolStringReplacer;
import io.github.rothes.protocolstringreplacer.api.replacer.ReplacerConfig;
import io.github.rothes.protocolstringreplacer.replacer.ReplacerManager;
Expand Down Expand Up @@ -62,6 +63,11 @@ public void format(LogEvent event, StringBuilder toAppendTo) {
toAppendTo.delete(i, m + 1);
}
}
} else {
ConfigManager configManager = plugin.getConfigManager();
if (configManager.resetConsoleColor) {
toAppendTo.append("\u001b[0m");
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions bukkit/src/main/resources/Languages/en-US/Configs/Config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ Options:
Console:
# Show loaded replacer configs in console.
Print-Replacer-Config-When-Loaded: true
# Reset console color after a record is ended.
# You may enable this if you modify console color.
Reset-Console-Color-At-End: true

# Custom plugin placeholder format. It is recommended to use the format that players can't think of,
# so they cannot access some information that they should not be obtained.
Expand Down
3 changes: 3 additions & 0 deletions bukkit/src/main/resources/Languages/zh-CN/Configs/Config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ Options:
Console:
# 在控制台内显示加载的替换配置文件.
Print-Replacer-Config-When-Loaded: true
# 在记录结束后重置控制台颜色.
# 如果您的配置对色彩进行了修改, 您可能需要开启此设定.
Reset-Console-Color-At-End: true

# 自定义插件占位符的使用格式. 建议使用玩家想不到的格式
# 以防止玩家通过占位符获取到不该获取的信息.
Expand Down

0 comments on commit 892da49

Please sign in to comment.