mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-12-26 19:18:12 +01:00
Small fix for OpenJDK (FindBugs).
This commit is contained in:
parent
95dbddf9bb
commit
dc186df695
@ -79,6 +79,7 @@ public class ProtocolLibrary extends JavaPlugin {
|
||||
|
||||
// Logger
|
||||
private Logger logger;
|
||||
private Handler redirectHandler;
|
||||
|
||||
// Commands
|
||||
private CommandProtocol commandProtocol;
|
||||
@ -137,8 +138,12 @@ public class ProtocolLibrary extends JavaPlugin {
|
||||
}
|
||||
|
||||
private void broadcastUsers(final String permission) {
|
||||
// Guard against multiple calls
|
||||
if (redirectHandler != null)
|
||||
return;
|
||||
|
||||
// Broadcast information to every user too
|
||||
logger.addHandler(new Handler() {
|
||||
redirectHandler = new Handler() {
|
||||
@Override
|
||||
public void publish(LogRecord record) {
|
||||
commandPacket.broadcastMessageSilently(record.getMessage(), permission);
|
||||
@ -153,7 +158,9 @@ public class ProtocolLibrary extends JavaPlugin {
|
||||
public void close() throws SecurityException {
|
||||
// Do nothing.
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
logger.addHandler(redirectHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -293,6 +300,11 @@ public class ProtocolLibrary extends JavaPlugin {
|
||||
asyncPacketTask = -1;
|
||||
}
|
||||
|
||||
// And redirect handler too
|
||||
if (redirectHandler != null) {
|
||||
logger.removeHandler(redirectHandler);
|
||||
}
|
||||
|
||||
unhookTask.close();
|
||||
protocolManager.close();
|
||||
protocolManager = null;
|
||||
|
Loading…
Reference in New Issue
Block a user