diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java index 8f6b8e37..7a417bfc 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -27,7 +27,6 @@ import java.util.logging.Logger; import lombok.Getter; import lombok.Setter; import lombok.Synchronized; -import static net.md_5.bungee.Logger.$; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ReconnectHandler; @@ -142,7 +141,7 @@ public class BungeeCord extends ProxyServer BungeeCord bungee = new BungeeCord(); ProxyServer.setInstance( bungee ); - $().info( "Enabled BungeeCord version " + bungee.getVersion() ); + bungee.getLogger().info( "Enabled BungeeCord version " + bungee.getVersion() ); bungee.start(); BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) ); @@ -208,7 +207,7 @@ public class BungeeCord extends ProxyServer .bind().channel(); listeners.add( server ); - $().info( "Listening on " + info.getHost() ); + getLogger().info( "Listening on " + info.getHost() ); } } @@ -216,13 +215,13 @@ public class BungeeCord extends ProxyServer { for ( Channel listener : listeners ) { - $().log( Level.INFO, "Closing listener {0}", listener ); + getLogger().log( Level.INFO, "Closing listener {0}", listener ); try { listener.close().syncUninterruptibly(); } catch ( ChannelException ex ) { - $().severe( "Could not close listen thread" ); + getLogger().severe( "Could not close listen thread" ); } } listeners.clear(); @@ -234,28 +233,28 @@ public class BungeeCord extends ProxyServer this.isRunning = false; stopListeners(); - $().info( "Closing pending connections" ); + getLogger().info( "Closing pending connections" ); - $().info( "Disconnecting " + connections.size() + " connections" ); + getLogger().info( "Disconnecting " + connections.size() + " connections" ); for ( UserConnection user : connections.values() ) { user.disconnect( "Proxy restarting, brb." ); } - $().info( "Closing IO threads" ); + getLogger().info( "Closing IO threads" ); eventLoops.shutdown(); - $().info( "Saving reconnect locations" ); + getLogger().info( "Saving reconnect locations" ); reconnectHandler.save(); saveThread.cancel(); - $().info( "Disabling plugins" ); + getLogger().info( "Disabling plugins" ); for ( Plugin plugin : pluginManager.getPlugins() ) { plugin.onDisable(); } - $().info( "Thank you and goodbye" ); + getLogger().info( "Thank you and goodbye" ); System.exit( 0 ); } @@ -287,7 +286,7 @@ public class BungeeCord extends ProxyServer @Override public Logger getLogger() { - return $(); + return BungeeLogger.instance; } @Override diff --git a/proxy/src/main/java/net/md_5/bungee/Logger.java b/proxy/src/main/java/net/md_5/bungee/BungeeLogger.java similarity index 89% rename from proxy/src/main/java/net/md_5/bungee/Logger.java rename to proxy/src/main/java/net/md_5/bungee/BungeeLogger.java index aa38547d..13ab1369 100644 --- a/proxy/src/main/java/net/md_5/bungee/Logger.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeLogger.java @@ -8,17 +8,18 @@ import java.util.logging.FileHandler; import java.util.logging.Formatter; import java.util.logging.Level; import java.util.logging.LogRecord; +import java.util.logging.Logger; /** * Logger to handle formatting and storage of the proxy's logger. */ -public class Logger extends java.util.logging.Logger +public class BungeeLogger extends Logger { private static final Formatter formatter = new ConsoleLogFormatter(); - private static final Logger instance = new Logger(); + static final BungeeLogger instance = new BungeeLogger(); - public Logger() + public BungeeLogger() { super( "BungeeCord", null ); try @@ -47,16 +48,6 @@ public class Logger extends java.util.logging.Logger } } - /** - * Gets the current logger instance. - * - * @return the current logger instance - */ - public static Logger $() - { - return instance; - } - public static class ConsoleLogFormatter extends Formatter { diff --git a/proxy/src/main/java/net/md_5/bungee/Metrics.java b/proxy/src/main/java/net/md_5/bungee/Metrics.java index dee66a90..c3d103e7 100644 --- a/proxy/src/main/java/net/md_5/bungee/Metrics.java +++ b/proxy/src/main/java/net/md_5/bungee/Metrics.java @@ -8,7 +8,6 @@ import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; -import static net.md_5.bungee.Logger.$; import net.md_5.bungee.api.ProxyServer; public class Metrics extends Thread @@ -55,7 +54,7 @@ public class Metrics extends Thread firstPost = false; } catch ( IOException ex ) { - $().info( "[Metrics] " + ex.getMessage() ); + ProxyServer.getInstance().getLogger().info( "[Metrics] " + ex.getMessage() ); } try {