mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-13 13:54:37 +01:00
Fix error with hero paths on login if they dont exist in the database
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user