-
Notifications
You must be signed in to change notification settings - Fork 0
/
SupplyDropsDataManager.java
46 lines (32 loc) · 1.24 KB
/
SupplyDropsDataManager.java
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
package net.minenite.warzairdrops;
import java.io.File;
import java.io.IOException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import net.minenite.warzairdrops.Main;
public class SupplyDropsDataManager
{
private static File customConfigFile;
private static FileConfiguration customConfig;
public static FileConfiguration getSupplyDropsData() { return customConfig; }
public static void saveDefaultConfig() {
customConfigFile = new File(Main.getPlugin().getDataFolder(), "supplydrops.yml");
if (!customConfigFile.exists()) {
customConfigFile.getParentFile().mkdirs();
Main.getPlugin().saveResource("supplydrops.yml", false);
}
customConfig = new YamlConfiguration();
try {
customConfig.load(customConfigFile);
} catch (IOException|org.bukkit.configuration.InvalidConfigurationException e) {
e.printStackTrace();
}
}
public static void saveSupplyDropsData() {
try {
getSupplyDropsData().save(customConfigFile);
} catch (IOException e) {
e.printStackTrace();
}
}
}