Skip to content

Commit 892da49

Browse files
committed
Add resetConsoleColor config
1 parent ad9e6e6 commit 892da49

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

bukkit/src/main/java/io/github/rothes/protocolstringreplacer/ConfigManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class ConfigManager {
3535
public final boolean directSkips;
3636

3737
public final String gitRawHost;
38+
public final boolean resetConsoleColor;
3839

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

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

111113
public enum LifeCycle {

bukkit/src/main/java/io/github/rothes/protocolstringreplacer/console/PsrLogEventPatternConverter.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.github.rothes.protocolstringreplacer.console;
22

3+
import io.github.rothes.protocolstringreplacer.ConfigManager;
34
import io.github.rothes.protocolstringreplacer.ProtocolStringReplacer;
45
import io.github.rothes.protocolstringreplacer.api.replacer.ReplacerConfig;
56
import io.github.rothes.protocolstringreplacer.replacer.ReplacerManager;
@@ -62,6 +63,11 @@ public void format(LogEvent event, StringBuilder toAppendTo) {
6263
toAppendTo.delete(i, m + 1);
6364
}
6465
}
66+
} else {
67+
ConfigManager configManager = plugin.getConfigManager();
68+
if (configManager.resetConsoleColor) {
69+
toAppendTo.append("\u001b[0m");
70+
}
6571
}
6672
}
6773

bukkit/src/main/resources/Languages/en-US/Configs/Config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ Options:
2828
Console:
2929
# Show loaded replacer configs in console.
3030
Print-Replacer-Config-When-Loaded: true
31+
# Reset console color after a record is ended.
32+
# You may enable this if you modify console color.
33+
Reset-Console-Color-At-End: true
3134

3235
# Custom plugin placeholder format. It is recommended to use the format that players can't think of,
3336
# so they cannot access some information that they should not be obtained.

bukkit/src/main/resources/Languages/zh-CN/Configs/Config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ Options:
2828
Console:
2929
# 在控制台内显示加载的替换配置文件.
3030
Print-Replacer-Config-When-Loaded: true
31+
# 在记录结束后重置控制台颜色.
32+
# 如果您的配置对色彩进行了修改, 您可能需要开启此设定.
33+
Reset-Console-Color-At-End: true
3134

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

0 commit comments

Comments
 (0)