From bf3e390ce6ecb22457e58f3f4a7f6e63b23d3798 Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Sun, 27 Aug 2023 13:37:14 -0400 Subject: [PATCH] Add debug property to log missing ability actions --- src/main/java/emu/grasscutter/DebugConstants.java | 1 + .../java/emu/grasscutter/game/ability/AbilityManager.java | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/emu/grasscutter/DebugConstants.java b/src/main/java/emu/grasscutter/DebugConstants.java index 503238c64..f0f111de9 100644 --- a/src/main/java/emu/grasscutter/DebugConstants.java +++ b/src/main/java/emu/grasscutter/DebugConstants.java @@ -6,6 +6,7 @@ public final class DebugConstants { public static boolean LOG_QUEST_START = false; public static boolean LOG_MISSING_ABILITIES = false; public static boolean LOG_MISSING_LUA_SCRIPTS = false; + public static boolean LOG_MISSING_ABILITY_HANDLERS = true; /** * WARNING: THIS IS A DANGEROUS SETTING. DO NOT ENABLE UNLESS YOU KNOW WHAT YOU ARE DOING. diff --git a/src/main/java/emu/grasscutter/game/ability/AbilityManager.java b/src/main/java/emu/grasscutter/game/ability/AbilityManager.java index 5e7082597..68f08b62c 100644 --- a/src/main/java/emu/grasscutter/game/ability/AbilityManager.java +++ b/src/main/java/emu/grasscutter/game/ability/AbilityManager.java @@ -91,9 +91,9 @@ public final class AbilityManager extends BasePlayerManager { Ability ability, AbilityModifierAction action, ByteString abilityData, GameEntity target) { var handler = actionHandlers.get(action.type); if (handler == null || ability == null) { - if (DebugConstants.LOG_ABILITIES) { + if (DebugConstants.LOG_MISSING_ABILITY_HANDLERS) { Grasscutter.getLogger() - .debug("Could not execute ability action {} at {}", action.type, ability); + .debug("Missing ability action handler for {} (invoker: {}).", action.type, ability); } return; @@ -103,7 +103,7 @@ public final class AbilityManager extends BasePlayerManager { () -> { if (!handler.execute(ability, action, abilityData, target)) { Grasscutter.getLogger() - .debug("Ability execute action failed for {} at {}.", action.type, ability); + .debug("Ability execute action failed for {} at {}.", action.type, ability); } }); }