Add debug property to log missing ability actions

This commit is contained in:
KingRainbow44 2023-08-27 13:37:14 -04:00
parent 93460ab0aa
commit bf3e390ce6
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
2 changed files with 4 additions and 3 deletions

View File

@ -6,6 +6,7 @@ public final class DebugConstants {
public static boolean LOG_QUEST_START = false; public static boolean LOG_QUEST_START = false;
public static boolean LOG_MISSING_ABILITIES = false; public static boolean LOG_MISSING_ABILITIES = false;
public static boolean LOG_MISSING_LUA_SCRIPTS = 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. * WARNING: THIS IS A DANGEROUS SETTING. DO NOT ENABLE UNLESS YOU KNOW WHAT YOU ARE DOING.

View File

@ -91,9 +91,9 @@ public final class AbilityManager extends BasePlayerManager {
Ability ability, AbilityModifierAction action, ByteString abilityData, GameEntity target) { Ability ability, AbilityModifierAction action, ByteString abilityData, GameEntity target) {
var handler = actionHandlers.get(action.type); var handler = actionHandlers.get(action.type);
if (handler == null || ability == null) { if (handler == null || ability == null) {
if (DebugConstants.LOG_ABILITIES) { if (DebugConstants.LOG_MISSING_ABILITY_HANDLERS) {
Grasscutter.getLogger() Grasscutter.getLogger()
.debug("Could not execute ability action {} at {}", action.type, ability); .debug("Missing ability action handler for {} (invoker: {}).", action.type, ability);
} }
return; return;
@ -103,7 +103,7 @@ public final class AbilityManager extends BasePlayerManager {
() -> { () -> {
if (!handler.execute(ability, action, abilityData, target)) { if (!handler.execute(ability, action, abilityData, target)) {
Grasscutter.getLogger() Grasscutter.getLogger()
.debug("Ability execute action failed for {} at {}.", action.type, ability); .debug("Ability execute action failed for {} at {}.", action.type, ability);
} }
}); });
} }