From 93b5fd1c59f6a8f87b6633157aa00988e5dcac0d Mon Sep 17 00:00:00 2001 From: games647 Date: Sun, 21 May 2017 15:27:26 +0200 Subject: [PATCH] Add datestyle --- .../games647/colorconsole/bukkit/ColorConsoleBukkit.java | 3 +++ .../games647/colorconsole/sponge/ColorConsoleConfig.java | 9 +++++++++ .../games647/colorconsole/sponge/ColorConsoleSponge.java | 3 +++ src/main/resources/config.yml | 4 ++++ 4 files changed, 19 insertions(+) diff --git a/src/main/java/com/github/games647/colorconsole/bukkit/ColorConsoleBukkit.java b/src/main/java/com/github/games647/colorconsole/bukkit/ColorConsoleBukkit.java index e09a9ee..fb8d4e3 100644 --- a/src/main/java/com/github/games647/colorconsole/bukkit/ColorConsoleBukkit.java +++ b/src/main/java/com/github/games647/colorconsole/bukkit/ColorConsoleBukkit.java @@ -72,6 +72,9 @@ public class ColorConsoleBukkit extends JavaPlugin { + "TRACE=" + getConfig().getString("TRACE") + "}"); } + String dateStyle = getConfig().getString("dateStyle"); + logFormat = logFormat.replaceFirst("(%d)\\{.{1,}\\}", "%style{$0}{" + dateStyle + "}"); + PatternLayout layout = PatternLayout .createLayout(logFormat, new DefaultConfiguration(), null, Charset.defaultCharset().name(), "true"); setLayout(layout); diff --git a/src/main/java/com/github/games647/colorconsole/sponge/ColorConsoleConfig.java b/src/main/java/com/github/games647/colorconsole/sponge/ColorConsoleConfig.java index 6fd9ab6..1d58d2e 100644 --- a/src/main/java/com/github/games647/colorconsole/sponge/ColorConsoleConfig.java +++ b/src/main/java/com/github/games647/colorconsole/sponge/ColorConsoleConfig.java @@ -56,6 +56,11 @@ public class ColorConsoleConfig { @Setting(comment = "Custom plugin colors") private Map 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" + "The texts are case-sensitive") private Set hideMessages; @@ -87,4 +92,8 @@ public class ColorConsoleConfig { public Set getHideMessages() { return hideMessages; } + + public String getDateStyle() { + return dateStyle; + } } diff --git a/src/main/java/com/github/games647/colorconsole/sponge/ColorConsoleSponge.java b/src/main/java/com/github/games647/colorconsole/sponge/ColorConsoleSponge.java index 2985363..99e7519 100644 --- a/src/main/java/com/github/games647/colorconsole/sponge/ColorConsoleSponge.java +++ b/src/main/java/com/github/games647/colorconsole/sponge/ColorConsoleSponge.java @@ -94,6 +94,9 @@ public class ColorConsoleSponge { + "TRACE=" + configMapper.getInstance().getLevelColors().get("TRACE") + "}"); } + String dateStyle = configMapper.getInstance().getDateStyle(); + logFormat = logFormat.replaceFirst("(%d)\\{.{1,}\\}", "%style{$0}{" + dateStyle + "}"); + PatternLayout layout = PatternLayout .createLayout(logFormat, new DefaultConfiguration(), null, Charset.defaultCharset().name(), "true"); setLayout(layout); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 5d393e5..a858850 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -46,6 +46,10 @@ P-ChangeSkin: yellow P-ScoreboardStats: white 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 # Black | BG_Black # Red | BG_Red