Depend only on the bungee api

This commit is contained in:
games647 2017-07-01 19:24:53 +02:00
parent 9100b697da
commit 85629d0c4a
No known key found for this signature in database
GPG Key ID: BFC68C8708713A88
2 changed files with 13 additions and 24 deletions

12
pom.xml
View File

@ -100,12 +100,6 @@
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</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-->
<repository>
<id>sponge-repo</id>
@ -124,9 +118,9 @@
<!--Normally should you move this to a extra module, but this project is currently so small-->
<dependency>
<groupId>tc.oc</groupId>
<artifactId>bungeecord-proxy</artifactId>
<version>1.11-SNAPSHOT</version>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.12-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

View File

@ -10,12 +10,11 @@ import java.util.logging.Handler;
import java.util.logging.Level;
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.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
import net.md_5.bungee.log.ColouredWriter;
public class ColorConsoleBungee extends Plugin {
@ -40,16 +39,14 @@ public class ColorConsoleBungee extends Plugin {
@Override
public void onDisable() {
//restore the old format
BungeeCord bungee = BungeeCord.getInstance();
ProxyServer bungee = ProxyServer.getInstance();
Logger bungeeLogger = bungee.getLogger();
Handler[] handlers = bungeeLogger.getHandlers();
for (Handler handler : handlers) {
if (handler instanceof ColouredWriter) {
Formatter formatter = handler.getFormatter();
if (formatter instanceof ColorLogFormatter) {
handler.setFormatter(((ColorLogFormatter) formatter).getOldFormatter());
}
Formatter formatter = handler.getFormatter();
if (formatter instanceof ColorLogFormatter) {
handler.setFormatter(((ColorLogFormatter) formatter).getOldFormatter());
}
}
}
@ -59,18 +56,16 @@ public class ColorConsoleBungee extends Plugin {
}
private void installLogFormat() {
BungeeCord bungee = BungeeCord.getInstance();
ProxyServer bungee = ProxyServer.getInstance();
Logger bungeeLogger = bungee.getLogger();
Handler[] handlers = bungeeLogger.getHandlers();
for (Handler handler : handlers) {
if (handler instanceof ColouredWriter) {
Formatter oldFormatter = handler.getFormatter();
Formatter oldFormatter = handler.getFormatter();
ColorLogFormatter newFormatter = new ColorLogFormatter(this, oldFormatter);
newFormatter.initPluginColors(getConfiguration().getString("PLUGIN"));
handler.setFormatter(newFormatter);
}
ColorLogFormatter newFormatter = new ColorLogFormatter(this, oldFormatter);
newFormatter.initPluginColors(getConfiguration().getString("PLUGIN"));
handler.setFormatter(newFormatter);
}
}