Add more information to the 'unknown condition handler' message

This commit is contained in:
KingRainbow44 2023-05-11 21:08:33 -04:00
parent 02a9c55b0f
commit 82b193945e
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
2 changed files with 7 additions and 5 deletions

View File

@ -20,9 +20,6 @@ public class BasicActivityConditionExecutor implements ActivityConditionExecutor
private final Int2ObjectMap<PlayerActivityData> playerActivityDataByActivityCondId;
private final Map<ActivityConditions, ActivityConditionBaseHandler> activityConditionsHandlers;
private static final UnknownActivityConditionHandler UNKNOWN_CONDITION_HANDLER =
new UnknownActivityConditionHandler();
public BasicActivityConditionExecutor(
Map<Integer, ActivityConfigItem> activityConfigItemMap,
Int2ObjectMap<ActivityCondExcelConfigData> 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());

View File

@ -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;
}
}