Fix ignored events also getting whitelisted
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bea 2022-11-12 07:08:45 +01:00
parent 36dd8afec1
commit fea420f2bc

View File

@ -35,7 +35,7 @@ public class SuperListener implements Listener
private final String[] dontLog = { "PlayerMoveEvent", "BlockFadeEvent", "BlockPhysicsEvent", "LeavesDecayEvent", private final String[] dontLog = { "PlayerMoveEvent", "BlockFadeEvent", "BlockPhysicsEvent", "LeavesDecayEvent",
"PlayerStatisticIncrementEvent", "PlayerRecipeDiscoverEvent", "PlayerArmSwingEvent", "BlockDropItemEvent", "PlayerStatisticIncrementEvent", "PlayerRecipeDiscoverEvent", "PlayerArmSwingEvent", "BlockDropItemEvent",
"BlockFertilizeEvent", "AsyncPlayerChatPreviewEvent", "InventoryOpenEvent", "ItemSpawnEvent" "BlockFertilizeEvent", "AsyncPlayerChatPreviewEvent", "ItemSpawnEvent", "InventoryOpenEvent", "BlockIgniteEvent"
}; };
@ -49,9 +49,6 @@ public class SuperListener implements Listener
}; };
public void iGetCalledForEveryEvent(Event event) { public void iGetCalledForEveryEvent(Event event) {
if (Arrays.stream(dontLog).anyMatch(ignored -> event.getEventName().equals(ignored))) {
return;
}
if(Arrays.stream(allowed).noneMatch(allowed -> event.getEventName().equals(allowed))) { if(Arrays.stream(allowed).noneMatch(allowed -> event.getEventName().equals(allowed))) {
if(event instanceof Cancellable) if(event instanceof Cancellable)
@ -60,6 +57,10 @@ public class SuperListener implements Listener
} }
} }
if (Arrays.stream(dontLog).anyMatch(ignored -> event.getEventName().equals(ignored))) {
return;
}
if(event instanceof Cancellable) if(event instanceof Cancellable)
{ {
if(Arrays.stream(allowed).noneMatch(allowed -> event.getEventName().equals(allowed))) { if(Arrays.stream(allowed).noneMatch(allowed -> event.getEventName().equals(allowed))) {