mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-06-12 16:03:38 +08:00
Implement group-based item giving & Add content handler for item giving
This commit is contained in:
@@ -11,16 +11,15 @@ public final class ExecDeactivateItemGiving extends QuestExecHandler {
|
||||
@Override
|
||||
public boolean execute(GameQuest quest, QuestData.QuestExecParam condition, String... paramStr) {
|
||||
var questManager = quest.getOwner().getQuestManager();
|
||||
var activeGivings = questManager.getActiveGivings();
|
||||
|
||||
var givingId = Integer.parseInt(condition.getParam()[0]);
|
||||
if (!activeGivings.contains(givingId)) {
|
||||
Grasscutter.getLogger().debug("Quest {} attempted to remove give action {} when it isn't active.",
|
||||
try {
|
||||
questManager.removeGivingItemAction(givingId);
|
||||
return true;
|
||||
} catch (IllegalStateException ignored) {
|
||||
Grasscutter.getLogger().warn("Quest {} attempted to remove give action {} twice.",
|
||||
quest.getSubQuestId(), givingId);
|
||||
return false;
|
||||
} else {
|
||||
activeGivings.remove(givingId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user