blob: eaf20e7fc5bcbc410f962ee4b17d71e9ad65c7d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
package cuchaz.enigma.gui.config;
import cuchaz.enigma.config.ConfigContainer;
import cuchaz.enigma.network.EnigmaServer;
public final class NetConfig {
private NetConfig() {
}
private static final ConfigContainer cfg = ConfigContainer.getOrCreate("enigma/net");
public static void save() {
cfg.save();
}
public static String getUsername() {
return cfg.data().section("User").setIfAbsentString("Username", System.getProperty("user.name", "user"));
}
public static void setUsername(String username) {
cfg.data().section("User").setString("Username", username);
}
public static String getPassword() {
return cfg.data().section("Remote").getString("Password").orElse("");
}
public static void setPassword(String password) {
cfg.data().section("Remote").setString("Password", password);
}
public static String getRemoteAddress() {
return cfg.data().section("Remote").getString("Address").orElse("");
}
public static void setRemoteAddress(String address) {
cfg.data().section("Remote").setString("Address", address);
}
public static String getServerPassword() {
return cfg.data().section("Server").getString("Password").orElse("");
}
public static void setServerPassword(String password) {
cfg.data().section("Server").setString("Password", password);
}
public static int getServerPort() {
return cfg.data().section("Server").setIfAbsentInt("Port", EnigmaServer.DEFAULT_PORT);
}
public static void setServerPort(int port) {
cfg.data().section("Server").setInt("Port", port);
}
}
|