Add datestyle

This commit is contained in:
games647 2017-05-21 15:27:26 +02:00
parent c8690398df
commit 93b5fd1c59
No known key found for this signature in database
GPG Key ID: E9E962F08F621538
4 changed files with 19 additions and 0 deletions

View File

@ -72,6 +72,9 @@ public class ColorConsoleBukkit extends JavaPlugin {
+ "TRACE=" + getConfig().getString("TRACE") + "}"); + "TRACE=" + getConfig().getString("TRACE") + "}");
} }
String dateStyle = getConfig().getString("dateStyle");
logFormat = logFormat.replaceFirst("(%d)\\{.{1,}\\}", "%style{$0}{" + dateStyle + "}");
PatternLayout layout = PatternLayout PatternLayout layout = PatternLayout
.createLayout(logFormat, new DefaultConfiguration(), null, Charset.defaultCharset().name(), "true"); .createLayout(logFormat, new DefaultConfiguration(), null, Charset.defaultCharset().name(), "true");
setLayout(layout); setLayout(layout);

View File

@ -56,6 +56,11 @@ public class ColorConsoleConfig {
@Setting(comment = "Custom plugin colors") @Setting(comment = "Custom plugin colors")
private Map<String, String> pluginColors; private Map<String, String> pluginColors;
@Setting(comment = "How should the time be highlighted\n" +
"Like below it could also be default which means it's the default font color depending on " +
"your terminal settings.")
private String dateStyle;
@Setting(comment = "Hides the log message if it contains one or more of the following texts\n" @Setting(comment = "Hides the log message if it contains one or more of the following texts\n"
+ "The texts are case-sensitive") + "The texts are case-sensitive")
private Set<String> hideMessages; private Set<String> hideMessages;
@ -87,4 +92,8 @@ public class ColorConsoleConfig {
public Set<String> getHideMessages() { public Set<String> getHideMessages() {
return hideMessages; return hideMessages;
} }
public String getDateStyle() {
return dateStyle;
}
} }

View File

@ -94,6 +94,9 @@ public class ColorConsoleSponge {
+ "TRACE=" + configMapper.getInstance().getLevelColors().get("TRACE") + "}"); + "TRACE=" + configMapper.getInstance().getLevelColors().get("TRACE") + "}");
} }
String dateStyle = configMapper.getInstance().getDateStyle();
logFormat = logFormat.replaceFirst("(%d)\\{.{1,}\\}", "%style{$0}{" + dateStyle + "}");
PatternLayout layout = PatternLayout PatternLayout layout = PatternLayout
.createLayout(logFormat, new DefaultConfiguration(), null, Charset.defaultCharset().name(), "true"); .createLayout(logFormat, new DefaultConfiguration(), null, Charset.defaultCharset().name(), "true");
setLayout(layout); setLayout(layout);

View File

@ -46,6 +46,10 @@ P-ChangeSkin: yellow
P-ScoreboardStats: white P-ScoreboardStats: white
P-mcMMOAction: blue P-mcMMOAction: blue
# How should the time be highlighted
# Like below it could also be default which means it's the default font color depending on your terminal settings.
dateStyle: cyan
# Available foreground colors | Available background colors # Available foreground colors | Available background colors
# Black | BG_Black # Black | BG_Black
# Red | BG_Red # Red | BG_Red