Skip to content

Commit efad610

Browse files
committed
fix: exception during player login related to exclusion changes
FTBTeam/FTB-Mods-Issues#1591
1 parent dae5765 commit efad610

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

common/src/main/java/dev/ftb/mods/ftbquests/quest/TeamData.java

+14-3
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,8 @@ public boolean areDependenciesVisible(Quest quest) {
547547
}
548548

549549
public boolean canStartTasks(Quest quest) {
550-
return !isExcludedByOtherQuestline(quest) &&
551-
(quest.getProgressionMode() == ProgressionMode.FLEXIBLE || areDependenciesComplete(quest));
550+
return (quest.getProgressionMode() == ProgressionMode.FLEXIBLE || areDependenciesComplete(quest))
551+
&& !isExcludedByOtherQuestline(quest);
552552
}
553553

554554
public void claimReward(ServerPlayer player, Reward reward, boolean notify) {
@@ -778,7 +778,18 @@ public LongSet getPinnedQuestIds(Player player) {
778778
}
779779

780780
public boolean isExcludedByOtherQuestline(QuestObject qo) {
781-
return qo instanceof Excludable e && exclusionCache.computeIfAbsent(e.getId(), k -> e.isQuestObjectExcluded(this));
781+
if (qo instanceof Excludable e) {
782+
// note: computeIfAbsent() won't work well here due to indirect recursion
783+
// (can throw exception with both standard and fastutil maps)
784+
if (exclusionCache.containsKey(e.getId())) {
785+
return exclusionCache.get(e.getId());
786+
}
787+
boolean excluded = e.isQuestObjectExcluded(this);
788+
exclusionCache.put(e.getId(), excluded);
789+
return excluded;
790+
791+
}
792+
return false;
782793
}
783794

784795
private static class PerPlayerData {

0 commit comments

Comments
 (0)