From 82b193945ee235decb229229c1ee9701b8beecab Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Thu, 11 May 2023 21:08:33 -0400 Subject: [PATCH] Add more information to the 'unknown condition handler' message --- .../activity/condition/BasicActivityConditionExecutor.java | 5 +---- .../condition/all/UnknownActivityConditionHandler.java | 7 ++++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/activity/condition/BasicActivityConditionExecutor.java b/src/main/java/emu/grasscutter/game/activity/condition/BasicActivityConditionExecutor.java index 5468c41af..d4eef1254 100644 --- a/src/main/java/emu/grasscutter/game/activity/condition/BasicActivityConditionExecutor.java +++ b/src/main/java/emu/grasscutter/game/activity/condition/BasicActivityConditionExecutor.java @@ -20,9 +20,6 @@ public class BasicActivityConditionExecutor implements ActivityConditionExecutor private final Int2ObjectMap playerActivityDataByActivityCondId; private final Map activityConditionsHandlers; - private static final UnknownActivityConditionHandler UNKNOWN_CONDITION_HANDLER = - new UnknownActivityConditionHandler(); - public BasicActivityConditionExecutor( Map activityConfigItemMap, Int2ObjectMap activityConditions, @@ -66,7 +63,7 @@ public class BasicActivityConditionExecutor implements ActivityConditionExecutor (BooleanSupplier) () -> activityConditionsHandlers - .getOrDefault(c.getType(), UNKNOWN_CONDITION_HANDLER) + .getOrDefault(c.getType(), new UnknownActivityConditionHandler(c.getType())) .execute(activity, activityConfig, c.paramArray())) .collect(Collectors.toList()); diff --git a/src/main/java/emu/grasscutter/game/activity/condition/all/UnknownActivityConditionHandler.java b/src/main/java/emu/grasscutter/game/activity/condition/all/UnknownActivityConditionHandler.java index ab9f4cae0..b3e9b1a41 100644 --- a/src/main/java/emu/grasscutter/game/activity/condition/all/UnknownActivityConditionHandler.java +++ b/src/main/java/emu/grasscutter/game/activity/condition/all/UnknownActivityConditionHandler.java @@ -4,14 +4,19 @@ import emu.grasscutter.Grasscutter; import emu.grasscutter.game.activity.ActivityConfigItem; import emu.grasscutter.game.activity.PlayerActivityData; import emu.grasscutter.game.activity.condition.ActivityConditionBaseHandler; +import emu.grasscutter.game.activity.condition.ActivityConditions; +import lombok.AllArgsConstructor; /** This class is used when condition was not found */ +@AllArgsConstructor public class UnknownActivityConditionHandler extends ActivityConditionBaseHandler { + private final ActivityConditions conditions; @Override public boolean execute( PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) { - Grasscutter.getLogger().error("Called unknown condition handler"); + Grasscutter.getLogger().error("Called unknown condition handler {}.", + conditions.name()); return false; } }