From e3da7b9a2e534f2994da21c4b97583f14eaf9171 Mon Sep 17 00:00:00 2001 From: Pablo Herrera Date: Mon, 13 Jan 2025 10:16:09 +0100 Subject: [PATCH] Fix blockglitch incident querying Signed-off-by: Pablo Herrera --- .../moderation/feature/loggers/BlockGlitchLogger.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/dev/pgm/community/moderation/feature/loggers/BlockGlitchLogger.java b/core/src/main/java/dev/pgm/community/moderation/feature/loggers/BlockGlitchLogger.java index a7e7ebd..0df7cdd 100644 --- a/core/src/main/java/dev/pgm/community/moderation/feature/loggers/BlockGlitchLogger.java +++ b/core/src/main/java/dev/pgm/community/moderation/feature/loggers/BlockGlitchLogger.java @@ -78,10 +78,10 @@ public List getIncidents() { } public Incident getIncident(int id) { - if (pastIncidents.isEmpty()) return null; - int idx = id - pastIncidents.getFirst().id; - if (idx < 0 || idx >= pastIncidents.size()) return null; - return pastIncidents.get(idx); + for (Incident i : pastIncidents) { + if (i.id == id) return i; + } + return null; } @EventHandler(priority = EventPriority.MONITOR) @@ -92,7 +92,7 @@ public void onBlockTransform(ParticipantBlockTransformEvent event) { Player pl = bpe.getPlayer(); boolean isBlockglitch = event.isCancelled() - && playerState.getLocation().getY() > event.getBlock().getY() + && (playerState.getLocation().getY() - 0.75) > event.getBlock().getY() && pl != null && !pl.isOnGround() && !pl.isFlying();