-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfigManager
62 lines (50 loc) · 1.57 KB
/
ConfigManager
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
56
57
58
59
60
61
62
package me.longerdays_fork;
import me.longerdays_fork.LongerDaysUtil;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static sun.net.www.protocol.http.AuthCacheValue.Type.Server;
public class ConfigManager {
private int day;
private int night;
private Set<String> worlds;
public ConfigManager(
final int day,
final int night,
final List<String> worlds
) {
if(day <= 0) {
this.day = 30;
LongerDaysUtil.consoleWarning("Set day cycle to " + day + " minutes is not safe, reverting to default...");
} else {
this.day = day;
}
LongerDaysUtil.console("Set day cycle to " + day + " minutes");
if(night <= 0) {
this.night = 5;
LongerDaysUtil.consoleWarning("Set night cycle to " + night + " minutes is not safe, reverting to default...");
} else {
this.night = night;
}
LongerDaysUtil.console("Set night cycle to " + night + " minutes");
this.worlds = new HashSet<>();
this.worlds.addAll(worlds);
this.worlds = Collections.unmodifiableSet(this.worlds);
}
public int getDay() {
return this.day;
}
public void setDay(final int day) {
this.day = day;
}
public int getNight() {
return this.night;
}
public void setNight(final int night) {
this.night = night;
}
public Set<String> getWorlds() {
return Collections.unmodifiableSet(this.worlds);
}
}