mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-30 14:13:47 +01:00
Fix some static analysis warnings.
This commit is contained in:
parent
4dfd510583
commit
19bb8f72c7
@ -104,7 +104,7 @@ public class BungeeCord extends ProxyServer
|
||||
/**
|
||||
* Server socket listener.
|
||||
*/
|
||||
private Collection<Channel> listeners = new HashSet<>();
|
||||
private final Collection<Channel> listeners = new HashSet<>();
|
||||
/**
|
||||
* Fully qualified connections.
|
||||
*/
|
||||
@ -127,7 +127,7 @@ public class BungeeCord extends ProxyServer
|
||||
@Getter
|
||||
private final BungeeScheduler scheduler = new BungeeScheduler();
|
||||
@Getter
|
||||
private ConsoleReader consoleReader;
|
||||
private final ConsoleReader consoleReader;
|
||||
@Getter
|
||||
private final Logger logger;
|
||||
public final Gson gson = new GsonBuilder()
|
||||
@ -251,7 +251,7 @@ public class BungeeCord extends ProxyServer
|
||||
if ( future.isSuccess() )
|
||||
{
|
||||
listeners.add( future.channel() );
|
||||
getLogger().info( "Listening on " + info.getHost() );
|
||||
getLogger().log( Level.INFO, "Listening on {0}", info.getHost() );
|
||||
} else
|
||||
{
|
||||
getLogger().log( Level.WARNING, "Could not bind to host " + info.getHost(), future.cause() );
|
||||
@ -277,7 +277,7 @@ public class BungeeCord extends ProxyServer
|
||||
if ( future.isSuccess() )
|
||||
{
|
||||
listeners.add( future.channel() );
|
||||
getLogger().info( "Started query on " + future.channel().localAddress() );
|
||||
getLogger().log( Level.INFO, "Started query on {0}", future.channel().localAddress() );
|
||||
} else
|
||||
{
|
||||
getLogger().log( Level.WARNING, "Could not bind to host " + info.getHost(), future.cause() );
|
||||
@ -311,6 +311,7 @@ public class BungeeCord extends ProxyServer
|
||||
new Thread( "Shutdown Thread" )
|
||||
{
|
||||
@Override
|
||||
@SuppressWarnings("TooBroadCatch")
|
||||
public void run()
|
||||
{
|
||||
BungeeCord.this.isRunning = false;
|
||||
@ -321,7 +322,7 @@ public class BungeeCord extends ProxyServer
|
||||
connectionLock.readLock().lock();
|
||||
try
|
||||
{
|
||||
getLogger().info( "Disconnecting " + connections.size() + " connections" );
|
||||
getLogger().log( Level.INFO, "Disconnecting {0} connections", connections.size() );
|
||||
for ( UserConnection user : connections.values() )
|
||||
{
|
||||
user.disconnect( getTranslation( "restart" ) );
|
||||
@ -362,8 +363,7 @@ public class BungeeCord extends ProxyServer
|
||||
}
|
||||
} catch ( Throwable t )
|
||||
{
|
||||
getLogger().severe( "Exception disabling plugin " + plugin.getDescription().getName() );
|
||||
t.printStackTrace();
|
||||
getLogger().log( Level.SEVERE, "Exception disabling plugin " + plugin.getDescription().getName(), t );
|
||||
}
|
||||
getScheduler().cancel( plugin );
|
||||
plugin.getExecutorService().shutdownNow();
|
||||
@ -458,6 +458,7 @@ public class BungeeCord extends ProxyServer
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProxiedPlayer getPlayer(UUID uuid)
|
||||
{
|
||||
connectionLock.readLock().lock();
|
||||
|
@ -26,7 +26,7 @@ public class EncryptionUtil
|
||||
private static final Random random = new Random();
|
||||
public static KeyPair keys;
|
||||
@Getter
|
||||
private static SecretKey secret = new SecretKeySpec( new byte[ 16 ], "AES" );
|
||||
private static final SecretKey secret = new SecretKeySpec( new byte[ 16 ], "AES" );
|
||||
|
||||
static
|
||||
{
|
||||
|
@ -229,6 +229,7 @@ public final class UserConnection implements ProxiedPlayer
|
||||
ChannelFutureListener listener = new ChannelFutureListener()
|
||||
{
|
||||
@Override
|
||||
@SuppressWarnings("ThrowableResultIgnored")
|
||||
public void operationComplete(ChannelFuture future) throws Exception
|
||||
{
|
||||
if ( callback != null )
|
||||
@ -295,7 +296,10 @@ public final class UserConnection implements ProxiedPlayer
|
||||
{
|
||||
if ( ch.getHandle().isActive() )
|
||||
{
|
||||
bungee.getLogger().log( Level.INFO, "[" + getName() + "] disconnected with: " + BaseComponent.toLegacyText( reason ) );
|
||||
bungee.getLogger().log( Level.INFO, "[{0}] disconnected with: {1}", new Object[]
|
||||
{
|
||||
getName(), BaseComponent.toLegacyText( reason )
|
||||
} );
|
||||
unsafe().sendPacket( new Kick( ComponentSerializer.toString( reason ) ) );
|
||||
ch.close();
|
||||
if ( server != null )
|
||||
|
@ -120,12 +120,14 @@ public class Configuration implements ProxyConfig
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public String getFavicon()
|
||||
{
|
||||
return getFaviconObject().getEncoded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Favicon getFaviconObject()
|
||||
{
|
||||
return favicon;
|
||||
|
@ -29,6 +29,7 @@ public class HttpClient
|
||||
public static final int TIMEOUT = 5000;
|
||||
private static final Cache<String, InetAddress> addressCache = CacheBuilder.newBuilder().expireAfterWrite( 5, TimeUnit.MINUTES ).build();
|
||||
|
||||
@SuppressWarnings("UnusedAssignment")
|
||||
public static void get(String url, EventLoop eventLoop, final Callback<String> callback)
|
||||
{
|
||||
Preconditions.checkNotNull( url, "url" );
|
||||
|
@ -14,6 +14,10 @@ public class BungeeLogger extends Logger
|
||||
private final Formatter formatter = new ConciseFormatter();
|
||||
private final LogDispatcher dispatcher = new LogDispatcher( this );
|
||||
|
||||
@SuppressWarnings(
|
||||
{
|
||||
"CallToPrintStackTrace", "CallToThreadStartDuringObjectConstruction"
|
||||
})
|
||||
public BungeeLogger(BungeeCord bungee)
|
||||
{
|
||||
super( "BungeeCord", null );
|
||||
|
@ -13,6 +13,7 @@ public class ConciseFormatter extends Formatter
|
||||
private final DateFormat date = new SimpleDateFormat( System.getProperty( "net.md_5.bungee.log-date-format", "HH:mm:ss" ) );
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("ThrowableResultIgnored")
|
||||
public String format(LogRecord record)
|
||||
{
|
||||
StringBuilder formatted = new StringBuilder();
|
||||
|
@ -96,13 +96,16 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
|
||||
{
|
||||
if ( cause instanceof ReadTimeoutException )
|
||||
{
|
||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, handler + " - read timed out" );
|
||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - read timed out", handler );
|
||||
} else if ( cause instanceof BadPacketException )
|
||||
{
|
||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, handler + " - bad packet ID, are mods in use!?" );
|
||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - bad packet ID, are mods in use!?", handler );
|
||||
} else if ( cause instanceof IOException )
|
||||
{
|
||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, handler + " - IOException: " + cause.getMessage() );
|
||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - IOException: {1}", new Object[]
|
||||
{
|
||||
handler, cause.getMessage()
|
||||
} );
|
||||
} else
|
||||
{
|
||||
ProxyServer.getInstance().getLogger().log( Level.SEVERE, handler + " - encountered exception", cause );
|
||||
|
@ -22,8 +22,8 @@ public class Custom extends TabListAdapter implements CustomTabList
|
||||
/*========================================================================*/
|
||||
private final Collection<String> sentStuff = new HashSet<>();
|
||||
/*========================================================================*/
|
||||
private String[][] sent = new String[ ROWS ][ COLUMNS ];
|
||||
private String[][] slots = new String[ ROWS ][ COLUMNS ];
|
||||
private final String[][] sent = new String[ ROWS ][ COLUMNS ];
|
||||
private final String[][] slots = new String[ ROWS ][ COLUMNS ];
|
||||
private int rowLim;
|
||||
private int colLim;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.md_5.bungee.tab;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.protocol.packet.PlayerListItem;
|
||||
|
||||
public class GlobalPing extends Global
|
||||
|
Loading…
Reference in New Issue
Block a user