mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 07:37:43 +00:00
feat: ability to register new achievements
This commit is contained in:
parent
873d190e46
commit
87d58d2a6f
@ -318,6 +318,18 @@ public class Achievements {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
this.registerNewAchievementsIfExist();
|
||||
this.player.sendPacket(new PacketAchievementAllDataNotify(this.player));
|
||||
}
|
||||
|
||||
private void registerNewAchievementsIfExist() {
|
||||
GameData.getAchievementDataMap().values().stream()
|
||||
.filter(AchievementData::isUsed)
|
||||
.filter(a -> !this.achievementList.containsKey(a.getId()))
|
||||
.forEach(a -> {
|
||||
Grasscutter.getLogger().info("Registering a new achievement (id: {})", a.getId());
|
||||
this.achievementList.put(a.getId(), new Achievement(AchievementStatus.UNFINISHED, a.getId(), a.getProgress(), 0, 0));
|
||||
});
|
||||
this.save();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user