Small fix for OpenJDK (FindBugs).
Dieser Commit ist enthalten in:
Ursprung
95dbddf9bb
Commit
dc186df695
@ -79,6 +79,7 @@ public class ProtocolLibrary extends JavaPlugin {
|
|||||||
|
|
||||||
// Logger
|
// Logger
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
private Handler redirectHandler;
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
private CommandProtocol commandProtocol;
|
private CommandProtocol commandProtocol;
|
||||||
@ -137,8 +138,12 @@ public class ProtocolLibrary extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void broadcastUsers(final String permission) {
|
private void broadcastUsers(final String permission) {
|
||||||
// Broadcast information to every user too
|
// Guard against multiple calls
|
||||||
logger.addHandler(new Handler() {
|
if (redirectHandler != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Broadcast information to every user too
|
||||||
|
redirectHandler = new Handler() {
|
||||||
@Override
|
@Override
|
||||||
public void publish(LogRecord record) {
|
public void publish(LogRecord record) {
|
||||||
commandPacket.broadcastMessageSilently(record.getMessage(), permission);
|
commandPacket.broadcastMessageSilently(record.getMessage(), permission);
|
||||||
@ -153,7 +158,9 @@ public class ProtocolLibrary extends JavaPlugin {
|
|||||||
public void close() throws SecurityException {
|
public void close() throws SecurityException {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
logger.addHandler(redirectHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -293,6 +300,11 @@ public class ProtocolLibrary extends JavaPlugin {
|
|||||||
asyncPacketTask = -1;
|
asyncPacketTask = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// And redirect handler too
|
||||||
|
if (redirectHandler != null) {
|
||||||
|
logger.removeHandler(redirectHandler);
|
||||||
|
}
|
||||||
|
|
||||||
unhookTask.close();
|
unhookTask.close();
|
||||||
protocolManager.close();
|
protocolManager.close();
|
||||||
protocolManager = null;
|
protocolManager = null;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren