Made replaced preset sector saves auto-delete

This commit is contained in:
Anuken 2021-09-19 12:50:45 -04:00
parent cc0cdeb6c0
commit 7e0f68b24d

View File

@ -55,6 +55,16 @@ public class Saves{
}
}
//clear saves from build <130 that had the new naval sectors.
saves.removeAll(s -> {
if(s.getSector() != null && (s.getSector().id == 108 || s.getSector().id == 216) && s.meta.build <= 130 && s.meta.build > 0){
s.getSector().clearInfo();
s.file.delete();
return true;
}
return false;
});
lastSectorSave = saves.find(s -> s.isSector() && s.getName().equals(Core.settings.getString("last-sector-save", "<none>")));
//automatically assign sector save slots
@ -289,7 +299,7 @@ public class Saves{
return meta.mods;
}
public Sector getSector(){
public @Nullable Sector getSector(){
return meta == null || meta.rules == null ? null : meta.rules.sector;
}