Skip to content

Commit

Permalink
Fixed not getting global values on new file creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mthec committed Dec 5, 2015
1 parent dfeb2a7 commit 7386960
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/mod/wurmonline/mods/upkeepcosts/UpkeepCostsUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.file.Paths;
import java.util.Properties;
import java.util.logging.Level;

Expand Down Expand Up @@ -149,20 +150,25 @@ void initialize () {
created = file.createNewFile();
}

FileInputStream stream;
Properties properties = new Properties();

if (created) {
stream = new FileInputStream(Paths.get("mods", "upkeepcosts.properties").toString());
properties.load(stream);
configure(properties);
upkeepPropertySheet = new UpkeepPropertySheet(this);
upkeepPropertySheet.setAllToChanged();
saveUpkeep();
container.setContent(upkeepPropertySheet);
return;
}

FileInputStream stream = new FileInputStream(file.toString());
Properties properties = new Properties();
properties.load(stream);
configure(properties);
upkeepPropertySheet = new UpkeepPropertySheet(this);
container.setContent(upkeepPropertySheet);
else {
stream = new FileInputStream(file.toString());
properties.load(stream);
configure(properties);
upkeepPropertySheet = new UpkeepPropertySheet(this);
container.setContent(upkeepPropertySheet);
}
} catch (IOException ex) {
logger.warning(messages.getString("load_properties_error"));
ex.printStackTrace();
Expand Down

0 comments on commit 7386960

Please sign in to comment.