Skip to content

Commit

Permalink
Fix fetching advancements with invalid parents
Browse files Browse the repository at this point in the history
  • Loading branch information
eclipseisoffline committed Apr 14, 2024
1 parent 890b124 commit 2475452
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,15 @@ public String getDisplayColor() {
this.rootId = this.advancement.getId();
} else {
// Go through our cache, and descend until we find the root ID
GeyserAdvancement advancement = advancementsCache.getStoredAdvancements().get(this.advancement.getParentId());
if (advancement.getParentId() == null) {
this.rootId = advancement.getId();
GeyserAdvancement parent = advancementsCache.getStoredAdvancements().get(this.advancement.getParentId());
if (parent == null) {
// Parent doesn't exist, is invalid, or couldn't be found for another reason
// So assuming there is no parent and this is the root
this.rootId = this.advancement.getId();
} else if (parent.getParentId() == null) {
this.rootId = parent.getId();
} else {
this.rootId = advancement.getRootId(advancementsCache);
this.rootId = parent.getRootId(advancementsCache);
}
}
}
Expand Down

0 comments on commit 2475452

Please sign in to comment.