mirror of
https://github.com/games647/ColorConsole.git
synced 2024-11-27 12:55:58 +01:00
Depend only on the bungee api
This commit is contained in:
parent
9100b697da
commit
85629d0c4a
12
pom.xml
12
pom.xml
@ -100,12 +100,6 @@
|
|||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
<!--BungeeCord with also the part outside the API-->
|
|
||||||
<repository>
|
|
||||||
<id>bungee-repo</id>
|
|
||||||
<url>https://repo.extension.ws/content/repositories/snapshots/</url>
|
|
||||||
</repository>
|
|
||||||
|
|
||||||
<!--Sponge-API-->
|
<!--Sponge-API-->
|
||||||
<repository>
|
<repository>
|
||||||
<id>sponge-repo</id>
|
<id>sponge-repo</id>
|
||||||
@ -124,9 +118,9 @@
|
|||||||
|
|
||||||
<!--Normally should you move this to a extra module, but this project is currently so small-->
|
<!--Normally should you move this to a extra module, but this project is currently so small-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>tc.oc</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-proxy</artifactId>
|
<artifactId>bungeecord-api</artifactId>
|
||||||
<version>1.11-SNAPSHOT</version>
|
<version>1.12-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -10,12 +10,11 @@ import java.util.logging.Handler;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.md_5.bungee.BungeeCord;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.md_5.bungee.config.Configuration;
|
import net.md_5.bungee.config.Configuration;
|
||||||
import net.md_5.bungee.config.ConfigurationProvider;
|
import net.md_5.bungee.config.ConfigurationProvider;
|
||||||
import net.md_5.bungee.config.YamlConfiguration;
|
import net.md_5.bungee.config.YamlConfiguration;
|
||||||
import net.md_5.bungee.log.ColouredWriter;
|
|
||||||
|
|
||||||
public class ColorConsoleBungee extends Plugin {
|
public class ColorConsoleBungee extends Plugin {
|
||||||
|
|
||||||
@ -40,16 +39,14 @@ public class ColorConsoleBungee extends Plugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
//restore the old format
|
//restore the old format
|
||||||
BungeeCord bungee = BungeeCord.getInstance();
|
ProxyServer bungee = ProxyServer.getInstance();
|
||||||
Logger bungeeLogger = bungee.getLogger();
|
Logger bungeeLogger = bungee.getLogger();
|
||||||
|
|
||||||
Handler[] handlers = bungeeLogger.getHandlers();
|
Handler[] handlers = bungeeLogger.getHandlers();
|
||||||
for (Handler handler : handlers) {
|
for (Handler handler : handlers) {
|
||||||
if (handler instanceof ColouredWriter) {
|
Formatter formatter = handler.getFormatter();
|
||||||
Formatter formatter = handler.getFormatter();
|
if (formatter instanceof ColorLogFormatter) {
|
||||||
if (formatter instanceof ColorLogFormatter) {
|
handler.setFormatter(((ColorLogFormatter) formatter).getOldFormatter());
|
||||||
handler.setFormatter(((ColorLogFormatter) formatter).getOldFormatter());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,18 +56,16 @@ public class ColorConsoleBungee extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void installLogFormat() {
|
private void installLogFormat() {
|
||||||
BungeeCord bungee = BungeeCord.getInstance();
|
ProxyServer bungee = ProxyServer.getInstance();
|
||||||
Logger bungeeLogger = bungee.getLogger();
|
Logger bungeeLogger = bungee.getLogger();
|
||||||
|
|
||||||
Handler[] handlers = bungeeLogger.getHandlers();
|
Handler[] handlers = bungeeLogger.getHandlers();
|
||||||
for (Handler handler : handlers) {
|
for (Handler handler : handlers) {
|
||||||
if (handler instanceof ColouredWriter) {
|
Formatter oldFormatter = handler.getFormatter();
|
||||||
Formatter oldFormatter = handler.getFormatter();
|
|
||||||
|
|
||||||
ColorLogFormatter newFormatter = new ColorLogFormatter(this, oldFormatter);
|
ColorLogFormatter newFormatter = new ColorLogFormatter(this, oldFormatter);
|
||||||
newFormatter.initPluginColors(getConfiguration().getString("PLUGIN"));
|
newFormatter.initPluginColors(getConfiguration().getString("PLUGIN"));
|
||||||
handler.setFormatter(newFormatter);
|
handler.setFormatter(newFormatter);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user