Don't publish/broadcast log entries from the import process - towards #317

This commit is contained in:
Luck 2017-09-04 20:47:45 +01:00
parent 03f342a21c
commit dadd8e2c50
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 9 additions and 2 deletions

View File

@ -45,10 +45,16 @@ public class LogDispatcher {
private final LuckPermsPlugin plugin;
public void dispatch(LogEntry entry, Sender sender) {
if (!plugin.getApiProvider().getEventFactory().handleLogPublish(false, entry)) {
// set the event to cancelled if the sender is import
if (!plugin.getApiProvider().getEventFactory().handleLogPublish(sender.isImport(), entry)) {
plugin.getStorage().logAction(entry);
}
// don't dispatch log entries sent by an import process
if (sender.isImport()) {
return;
}
InternalMessagingService messagingService = plugin.getMessagingService();
if (!sender.isImport() && !(messagingService instanceof NoopMessagingService)) {
messagingService.pushLog(entry);

View File

@ -134,7 +134,8 @@ public final class AbstractSender<T> implements Sender {
@Override
public boolean isImport() {
return this.uuid.equals(Constants.IMPORT_UUID);
// the importer uses it's own instance of Sender
return false;
}
@Override