Only broadcast a notifcation message in the event of a warning.
Dieser Commit ist enthalten in:
Ursprung
b135bf86c3
Commit
f6f8c9f80f
@ -19,6 +19,7 @@ package com.comphenix.protocol;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.logging.Handler;
|
import java.util.logging.Handler;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.LogRecord;
|
import java.util.logging.LogRecord;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@ -129,7 +130,7 @@ public class ProtocolLibrary extends JavaPlugin {
|
|||||||
commandPacket = new CommandPacket(detailedReporter, this, logger, protocolManager);
|
commandPacket = new CommandPacket(detailedReporter, this, logger, protocolManager);
|
||||||
|
|
||||||
// Send logging information to player listeners too
|
// Send logging information to player listeners too
|
||||||
broadcastUsers(PERMISSION_INFO);
|
setupBroadcastUsers(PERMISSION_INFO);
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
detailedReporter.reportDetailed(this, "Cannot load ProtocolLib.", e, protocolManager);
|
detailedReporter.reportDetailed(this, "Cannot load ProtocolLib.", e, protocolManager);
|
||||||
@ -151,7 +152,7 @@ public class ProtocolLibrary extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void broadcastUsers(final String permission) {
|
private void setupBroadcastUsers(final String permission) {
|
||||||
// Guard against multiple calls
|
// Guard against multiple calls
|
||||||
if (redirectHandler != null)
|
if (redirectHandler != null)
|
||||||
return;
|
return;
|
||||||
@ -160,7 +161,10 @@ public class ProtocolLibrary extends JavaPlugin {
|
|||||||
redirectHandler = new Handler() {
|
redirectHandler = new Handler() {
|
||||||
@Override
|
@Override
|
||||||
public void publish(LogRecord record) {
|
public void publish(LogRecord record) {
|
||||||
commandPacket.broadcastMessageSilently(record.getMessage(), permission);
|
// Only display warnings and above
|
||||||
|
if (record.getLevel().intValue() >= Level.WARNING.intValue()) {
|
||||||
|
commandPacket.broadcastMessageSilently(record.getMessage(), permission);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren