Fix error with hero paths on login if they dont exist in the database

This commit is contained in:
Melledy
2023-11-22 03:14:11 -08:00
parent b8a758ea15
commit b7d9a46535
2 changed files with 5 additions and 5 deletions

View File

@@ -72,7 +72,7 @@ public class AvatarStorage extends BasePlayerManager implements Iterable<GameAva
/**
* Updates hero types for players. Will create hero types if they dont exist already.
*/
public void setupHeroPaths() {
public void validateHeroPaths() {
for (HeroExcel heroExcel : GameData.getHeroExcelMap().values()) {
if (getHeroPaths().containsKey(heroExcel.getId())) continue;
@@ -108,6 +108,9 @@ public class AvatarStorage extends BasePlayerManager implements Iterable<GameAva
this.heroPaths.put(heroPath.getId(), heroPath);
});
// Setup hero paths if they dont exist
this.validateHeroPaths();
// Load avatars
Stream<GameAvatar> stream = LunarCore.getGameDatabase().getObjects(GameAvatar.class, "ownerUid", this.getPlayer().getUid());

View File

@@ -150,7 +150,7 @@ public class Player {
this.gachaInfo = new PlayerGachaInfo();
// Setup hero paths
this.getAvatars().setupHeroPaths();
this.getAvatars().validateHeroPaths();
// Give us the main character
// TODO script tutorial
@@ -622,9 +622,6 @@ public class Player {
this.getChallengeManager().loadFromDatabase();
this.getRogueManager().loadFromDatabase();
// Post database load
this.getAvatars().setupHeroPaths();
// Update stamina
this.updateStamina();