Skip to content

Commit

Permalink
Fix Save Files not being read correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ZockerAxel committed Dec 24, 2021
1 parent 2c93777 commit 3d101a0
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/eu/endercentral/crazy_advancements/save/SaveFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import com.google.gson.Gson;
import com.google.gson.JsonElement;

import eu.endercentral.crazy_advancements.NameKey;

/**
* Represents a Save File
*
Expand All @@ -20,8 +18,8 @@ public class SaveFile {

private static final Gson gson = new Gson();

private final Map<NameKey, ProgressData> progressData;
private final Map<NameKey, CriteriaData> criteriaData;
private final Map<String, ProgressData> progressData;
private final Map<String, CriteriaData> criteriaData;

/**
* Constructor for creating a Save File
Expand All @@ -32,12 +30,12 @@ public class SaveFile {
public SaveFile(List<ProgressData> progressData, List<CriteriaData> criteriaData) {
this.progressData = new HashMap<>();
for(ProgressData progress : progressData) {
this.progressData.put(progress.getName(), progress);
this.progressData.put(progress.getName().toString(), progress);
}

this.criteriaData = new HashMap<>();
for(CriteriaData criteria : criteriaData) {
this.criteriaData.put(criteria.getName(), criteria);
this.criteriaData.put(criteria.getName().toString(), criteria);
}
}

Expand Down Expand Up @@ -68,12 +66,12 @@ public Collection<CriteriaData> getCriteriaData() {
public void merge(SaveFile saveFile) {
//Merge Progress Data
for(ProgressData progress : saveFile.getProgressData()) {
this.progressData.put(progress.getName(), progress);
this.progressData.put(progress.getName().toString(), progress);
}

//Merge Criteria Data
for(CriteriaData criteria : saveFile.getCriteriaData()) {
this.criteriaData.put(criteria.getName(), criteria);
this.criteriaData.put(criteria.getName().toString(), criteria);
}
}

Expand Down

0 comments on commit 3d101a0

Please sign in to comment.