Fix errors when loading old saves.

This commit is contained in:
SeanOMik 2021-07-01 13:58:31 -04:00
parent e568d27d41
commit 11f8463766
No known key found for this signature in database
GPG Key ID: CA09E5BE1F32728A
4 changed files with 9 additions and 4 deletions

View File

@ -4,7 +4,7 @@
<groupId>net.seanomik</groupId>
<artifactId>energeticstorage</artifactId>
<name>EnergeticStorage</name>
<version>0.7.1-SNAPSHOT</version>
<version>0.7.2-SNAPSHOT</version>
<build>
<defaultGoal>clean package</defaultGoal>
<resources>

View File

@ -6,7 +6,7 @@
<groupId>net.seanomik</groupId>
<artifactId>energeticstorage</artifactId>
<version>0.7.1-SNAPSHOT</version>
<version>0.7.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>EnergeticStorage</name>

View File

@ -158,7 +158,12 @@ public class PlayersFile extends YamlConfiguration {
}
boolean isPublic = getConfig().getBoolean(systemPath + "public");
ESSystem.SortOrder sortOrder = ESSystem.SortOrder.valueOf(getConfig().getString(systemPath + "sortOrder"));
ESSystem.SortOrder sortOrder;
if (getConfig().contains(systemPath + "sortOrder")) {
sortOrder = ESSystem.SortOrder.valueOf(getConfig().getString(systemPath + "sortOrder"));
} else {
sortOrder = ESSystem.SortOrder.ALPHABETICAL;
}
Location loc = Utils.convertStringToLocation(getConfig().getString(systemPath + "loc"));
systems.add(new ESSystem(uuid, UUID.fromString(systemUUID), loc, drives, trustedUUIDs, isPublic, sortOrder));

View File

@ -19,7 +19,7 @@ public class ESSystem implements Cloneable, ConfigurationSerializable {
private List<ESDrive> esDrives = new ArrayList<>();
private List<UUID> trustedPlayers = new ArrayList<>();
private boolean isPublic;
private SortOrder sortOrder;
private SortOrder sortOrder = SortOrder.ALPHABETICAL;
public ESSystem(UUID owner, UUID uuid, Location location) {
this.owner = owner;