Remove outdated $() logger getter.

This commit is contained in:
md_5 2013-03-14 21:33:22 +11:00
parent 704fe11b05
commit bd479ba083
3 changed files with 16 additions and 27 deletions

View File

@ -27,7 +27,6 @@ import java.util.logging.Logger;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.Synchronized; import lombok.Synchronized;
import static net.md_5.bungee.Logger.$;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.ReconnectHandler; import net.md_5.bungee.api.ReconnectHandler;
@ -142,7 +141,7 @@ public class BungeeCord extends ProxyServer
BungeeCord bungee = new BungeeCord(); BungeeCord bungee = new BungeeCord();
ProxyServer.setInstance( bungee ); ProxyServer.setInstance( bungee );
$().info( "Enabled BungeeCord version " + bungee.getVersion() ); bungee.getLogger().info( "Enabled BungeeCord version " + bungee.getVersion() );
bungee.start(); bungee.start();
BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) ); BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
@ -208,7 +207,7 @@ public class BungeeCord extends ProxyServer
.bind().channel(); .bind().channel();
listeners.add( server ); 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 ) for ( Channel listener : listeners )
{ {
$().log( Level.INFO, "Closing listener {0}", listener ); getLogger().log( Level.INFO, "Closing listener {0}", listener );
try try
{ {
listener.close().syncUninterruptibly(); listener.close().syncUninterruptibly();
} catch ( ChannelException ex ) } catch ( ChannelException ex )
{ {
$().severe( "Could not close listen thread" ); getLogger().severe( "Could not close listen thread" );
} }
} }
listeners.clear(); listeners.clear();
@ -234,28 +233,28 @@ public class BungeeCord extends ProxyServer
this.isRunning = false; this.isRunning = false;
stopListeners(); 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() ) for ( UserConnection user : connections.values() )
{ {
user.disconnect( "Proxy restarting, brb." ); user.disconnect( "Proxy restarting, brb." );
} }
$().info( "Closing IO threads" ); getLogger().info( "Closing IO threads" );
eventLoops.shutdown(); eventLoops.shutdown();
$().info( "Saving reconnect locations" ); getLogger().info( "Saving reconnect locations" );
reconnectHandler.save(); reconnectHandler.save();
saveThread.cancel(); saveThread.cancel();
$().info( "Disabling plugins" ); getLogger().info( "Disabling plugins" );
for ( Plugin plugin : pluginManager.getPlugins() ) for ( Plugin plugin : pluginManager.getPlugins() )
{ {
plugin.onDisable(); plugin.onDisable();
} }
$().info( "Thank you and goodbye" ); getLogger().info( "Thank you and goodbye" );
System.exit( 0 ); System.exit( 0 );
} }
@ -287,7 +286,7 @@ public class BungeeCord extends ProxyServer
@Override @Override
public Logger getLogger() public Logger getLogger()
{ {
return $(); return BungeeLogger.instance;
} }
@Override @Override

View File

@ -8,17 +8,18 @@ import java.util.logging.FileHandler;
import java.util.logging.Formatter; import java.util.logging.Formatter;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.LogRecord; import java.util.logging.LogRecord;
import java.util.logging.Logger;
/** /**
* Logger to handle formatting and storage of the proxy's 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 Formatter formatter = new ConsoleLogFormatter();
private static final Logger instance = new Logger(); static final BungeeLogger instance = new BungeeLogger();
public Logger() public BungeeLogger()
{ {
super( "BungeeCord", null ); super( "BungeeCord", null );
try 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 public static class ConsoleLogFormatter extends Formatter
{ {

View File

@ -8,7 +8,6 @@ import java.io.UnsupportedEncodingException;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.net.URLEncoder; import java.net.URLEncoder;
import static net.md_5.bungee.Logger.$;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
public class Metrics extends Thread public class Metrics extends Thread
@ -55,7 +54,7 @@ public class Metrics extends Thread
firstPost = false; firstPost = false;
} catch ( IOException ex ) } catch ( IOException ex )
{ {
$().info( "[Metrics] " + ex.getMessage() ); ProxyServer.getInstance().getLogger().info( "[Metrics] " + ex.getMessage() );
} }
try try
{ {