This repository was archived by the owner on Feb 17, 2024. It is now read-only.
forked from CivClassic/SimpleAdminHacks
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathBuildLimitsConfig.java
More file actions
49 lines (42 loc) · 1.5 KB
/
BuildLimitsConfig.java
File metadata and controls
49 lines (42 loc) · 1.5 KB
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
package com.programmerdan.minecraft.simpleadminhacks.configs;
import com.programmerdan.minecraft.simpleadminhacks.SimpleAdminHacks;
import com.programmerdan.minecraft.simpleadminhacks.framework.SimpleHackConfig;
import com.programmerdan.minecraft.simpleadminhacks.framework.utilities.BuildLimit;
import org.bukkit.configuration.ConfigurationSection;
import java.util.List;
public final class BuildLimitsConfig extends SimpleHackConfig {
private boolean enabled;
private BuildLimit[] buildLimits;
public BuildLimitsConfig(SimpleAdminHacks plugin, ConfigurationSection base) {
super(plugin, base);
}
public BuildLimitsConfig(ConfigurationSection base) {
super(SimpleAdminHacks.instance(), base);
}
@Override
protected void wireup(ConfigurationSection config) {
this.enabled = config.getBoolean("enabled");
if (this.enabled) {
List<?> rawList = config.getList("limits");
if (rawList != null && rawList.size() > 0) {
try {
this.buildLimits = rawList.toArray(new BuildLimit[rawList.size()]);
plugin().getLogger().info("buildlimits enabled");
} catch(ArrayStoreException ase) {
plugin().getLogger().warning("buildlimits was enabled, but is invalid");
ase.printStackTrace();
}
} else {
plugin().getLogger().warning("buildlimits was enabled, but is missing or empty");
}
} else {
plugin().getLogger().info("buildlimits disabled");
}
}
public boolean isEnabled() {
return this.enabled;
}
public BuildLimit[] getBuildLimits() {
return this.buildLimits;
}
}