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> <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>

View File

@ -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);
}
} }
} }