diff --git a/src/main/java/com/bgsoftware/superiorskyblock/core/events/EventsBus.java b/src/main/java/com/bgsoftware/superiorskyblock/core/events/EventsBus.java index 208813bed..6fd7f34f4 100644 --- a/src/main/java/com/bgsoftware/superiorskyblock/core/events/EventsBus.java +++ b/src/main/java/com/bgsoftware/superiorskyblock/core/events/EventsBus.java @@ -24,6 +24,8 @@ import com.bgsoftware.superiorskyblock.api.upgrades.cost.UpgradeCost; import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer; import com.bgsoftware.superiorskyblock.core.ChunkPosition; +import com.bgsoftware.superiorskyblock.core.logging.Debug; +import com.bgsoftware.superiorskyblock.core.logging.Log; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.PortalType; @@ -653,23 +655,38 @@ private EventResult callEvent(Supplier if (plugin.getSettings().getDisabledEvents().contains(eventName)) return EventResult.of(false, def); + Log.debug(Debug.FIRE_EVENT, "EventsBus", "callEvent", eventName); + E event = eventSupplier.get(); Bukkit.getPluginManager().callEvent(event); - return EventResult.of(event.isCancelled(), getResultFunction.apply(event)); + + boolean cancelled = event.isCancelled(); + T result = getResultFunction.apply(event); + + Log.debugResult(Debug.FIRE_EVENT, "EventsBus", "callEvent", "Cancelled:", cancelled); + Log.debugResult(Debug.FIRE_EVENT, "EventsBus", "callEvent", "Result:", result); + + return EventResult.of(cancelled, result); } private boolean callEvent(Supplier eventSupplier, String eventName) { if (plugin.getSettings().getDisabledEvents().contains(eventName)) return true; + Log.debug(Debug.FIRE_EVENT, "EventsBus", "callEvent", eventName); + E event = eventSupplier.get(); Bukkit.getPluginManager().callEvent(event); + + Log.debugResult(Debug.FIRE_EVENT, "EventsBus", "callEvent", "Cancelled:", event.isCancelled()); + return !event.isCancelled(); } private static T callEvent(T event) { + Log.debug(Debug.FIRE_EVENT, "EventsBus", "callEvent", event.getEventName()); Bukkit.getPluginManager().callEvent(event); return event; } diff --git a/src/main/java/com/bgsoftware/superiorskyblock/core/logging/Debug.java b/src/main/java/com/bgsoftware/superiorskyblock/core/logging/Debug.java index 5f38f6e5d..1c53cdcde 100644 --- a/src/main/java/com/bgsoftware/superiorskyblock/core/logging/Debug.java +++ b/src/main/java/com/bgsoftware/superiorskyblock/core/logging/Debug.java @@ -130,6 +130,7 @@ public enum Debug { TELEPORT_PLAYER, LOAD_CHUNK, PASTE_SCHEMATIC, + FIRE_EVENT, SHOW_STACKTRACE;