Updated the ServerConfiguration.java
This commit is contained in:
parent
ff01c76130
commit
b9e0ead151
@ -14,7 +14,7 @@ public class ServerConfiguration {
|
|||||||
private final static Logger LOG = new Logger(ServerConfiguration.class);
|
private final static Logger LOG = new Logger(ServerConfiguration.class);
|
||||||
|
|
||||||
@Expose(serialize = false, deserialize = false)
|
@Expose(serialize = false, deserialize = false)
|
||||||
private File file;
|
public File file;
|
||||||
|
|
||||||
@Expose
|
@Expose
|
||||||
private String name;
|
private String name;
|
||||||
@ -59,13 +59,25 @@ public class ServerConfiguration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ServerConfiguration(String name, String type, String version, String description, int memory, boolean autoStart) {
|
||||||
|
this.name = name;
|
||||||
|
this.type = type;
|
||||||
|
this.version = version;
|
||||||
|
this.description = description;
|
||||||
|
this.memory = memory;
|
||||||
|
this.autoStart = autoStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerConfiguration() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the server configuration to the file
|
* Saves the server configuration to the file
|
||||||
*/
|
*/
|
||||||
public void save() {
|
public void save() {
|
||||||
if (file == null) return;
|
if (file == null) return;
|
||||||
Gson gson = new Gson();
|
String json = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(this);
|
||||||
String json = gson.toJson(this);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FileUtils.writeStringToFile(file, json, "UTF-8");
|
FileUtils.writeStringToFile(file, json, "UTF-8");
|
||||||
|
Reference in New Issue
Block a user