Skip to content

Commit

Permalink
Empty public constructors required for Rson
Browse files Browse the repository at this point in the history
  • Loading branch information
markhughes committed Jan 5, 2017
1 parent 35d6696 commit 57d7555
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
23 changes: 12 additions & 11 deletions src/main/java/net/redstoneore/freshwilderness/store/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,21 @@ public class Config extends Rson<Config> {

private transient static Config i;
public static Config get() {
if (i == null) i = new Config();
if (i == null) {
i = new Config();

i.dataPath = Paths.get(FreshWilderness.get().getDataFolder().toString(), "config.json");
i.setup(i.dataPath, Charset.defaultCharset());
try {
i.load();
} catch (Exception e) {
e.printStackTrace();
}

}
return i;
}

private transient Path dataPath;

private Config() {
this.dataPath = Paths.get(FreshWilderness.get().getDataFolder().toString(), "config.json");
this.setup(this.dataPath, Charset.defaultCharset());
try {
this.load();
} catch (Exception e) {
e.printStackTrace();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,18 @@ public static WildernessLog get(World world) {
String uid = world.getUID().toString();

if ( ! logsMap.containsKey(uid)) {
WildernessLog log = new WildernessLog(uid);
WildernessLog log = new WildernessLog();
log.worldId = uid;

Path warpsFolder = Paths.get(FreshWilderness.get().getDataFolder().toString(), "data");

log.dataPath = Paths.get(warpsFolder.toString(), log.worldId + ".json");
log.setup(log.dataPath, Charset.defaultCharset());
try {
log.load();
} catch (Exception e) {
e.printStackTrace();
}
log.uid = uid;

logsMap.put(uid, log);
Expand All @@ -47,19 +58,7 @@ public static List<WildernessLog> getAll() {
return new ArrayList<WildernessLog>(logsMap.values());
}

private WildernessLog(String worldId) {
this.worldId = worldId;

Path warpsFolder = Paths.get(FreshWilderness.get().getDataFolder().toString(), "data");

dataPath = Paths.get(warpsFolder.toString(), this.worldId + ".json");
this.setup(this.dataPath, Charset.defaultCharset());
try {
this.load();
} catch (Exception e) {
e.printStackTrace();
}
}
public WildernessLog() { }

// -------------------------------------------------- //
// FIELDS
Expand Down

0 comments on commit 57d7555

Please sign in to comment.