From c0f48d63dea9cd65f29b73ffb708dd8d92de7e91 Mon Sep 17 00:00:00 2001 From: Alexteens24 Date: Sun, 21 Jun 2026 13:44:07 +0700 Subject: [PATCH] fix(logging): rename isEventEnabled to shouldLogEvent with clear semantics Align LoggingConfig with DiscordWebhookConfig: the method now returns true when an event should be logged, preventing confusion from the inverted name. Co-authored-by: Cursor --- .../github/nighter/smartspawner/logging/LoggingConfig.java | 4 ++-- .../nighter/smartspawner/logging/SpawnerActionLogger.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/github/nighter/smartspawner/logging/LoggingConfig.java b/core/src/main/java/github/nighter/smartspawner/logging/LoggingConfig.java index 8864948e..3654662d 100644 --- a/core/src/main/java/github/nighter/smartspawner/logging/LoggingConfig.java +++ b/core/src/main/java/github/nighter/smartspawner/logging/LoggingConfig.java @@ -97,7 +97,7 @@ public Set getEnabledEvents() { return new HashSet<>(enabledEvents); } - public boolean isEventEnabled(SpawnerEventType eventType) { - return !enabled || !enabledEvents.contains(eventType); + public boolean shouldLogEvent(SpawnerEventType eventType) { + return enabled && enabledEvents.contains(eventType); } } diff --git a/core/src/main/java/github/nighter/smartspawner/logging/SpawnerActionLogger.java b/core/src/main/java/github/nighter/smartspawner/logging/SpawnerActionLogger.java index 295b92ad..9f78e3b5 100644 --- a/core/src/main/java/github/nighter/smartspawner/logging/SpawnerActionLogger.java +++ b/core/src/main/java/github/nighter/smartspawner/logging/SpawnerActionLogger.java @@ -58,7 +58,7 @@ public SpawnerActionLogger(SmartSpawner plugin, LoggingConfig config) { * Logs a spawner action asynchronously. */ public void log(SpawnerLogEntry entry) { - if (!config.isEnabled() || config.isEventEnabled(entry.getEventType())) { + if (!config.isEnabled() || !config.shouldLogEvent(entry.getEventType())) { return; } @@ -79,7 +79,7 @@ public void log(SpawnerLogEntry entry) { * Logs a spawner action using a builder pattern. */ public void log(SpawnerEventType eventType, LogEntryConsumer consumer) { - if (!config.isEnabled() || config.isEventEnabled(eventType)) { + if (!config.isEnabled() || !config.shouldLogEvent(eventType)) { return; }