mirror of https://github.com/GeyserMC/Geyser.git
Fix fetching advancements with invalid parents
(cherry picked from commit 2475452f73039165ce5cda35ba445acfebddb37f)
This commit is contained in:
parent
a24f684123
commit
bc6ded53fb
|
@ -82,11 +82,15 @@ public class GeyserAdvancement {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue