From 11f8463766cd361db3585cb4879bf59fe5e87438 Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Thu, 1 Jul 2021 13:58:31 -0400 Subject: [PATCH] Fix errors when loading old saves. --- dependency-reduced-pom.xml | 2 +- pom.xml | 2 +- .../net/seanomik/energeticstorage/files/PlayersFile.java | 7 ++++++- .../net/seanomik/energeticstorage/objects/ESSystem.java | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index 57b71b1..27ad836 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -4,7 +4,7 @@ net.seanomik energeticstorage EnergeticStorage - 0.7.1-SNAPSHOT + 0.7.2-SNAPSHOT clean package diff --git a/pom.xml b/pom.xml index 83808b2..dfd73c2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.seanomik energeticstorage - 0.7.1-SNAPSHOT + 0.7.2-SNAPSHOT jar EnergeticStorage diff --git a/src/main/java/net/seanomik/energeticstorage/files/PlayersFile.java b/src/main/java/net/seanomik/energeticstorage/files/PlayersFile.java index cd0b485..9f01280 100644 --- a/src/main/java/net/seanomik/energeticstorage/files/PlayersFile.java +++ b/src/main/java/net/seanomik/energeticstorage/files/PlayersFile.java @@ -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)); diff --git a/src/main/java/net/seanomik/energeticstorage/objects/ESSystem.java b/src/main/java/net/seanomik/energeticstorage/objects/ESSystem.java index a5d5f94..6db0672 100644 --- a/src/main/java/net/seanomik/energeticstorage/objects/ESSystem.java +++ b/src/main/java/net/seanomik/energeticstorage/objects/ESSystem.java @@ -19,7 +19,7 @@ public class ESSystem implements Cloneable, ConfigurationSerializable { private List esDrives = new ArrayList<>(); private List 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;