Archiviert
13
0

Small fix for OpenJDK (FindBugs).

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-11-20 06:48:05 +01:00
Ursprung 95dbddf9bb
Commit dc186df695

Datei anzeigen

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