-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
HPConfig.java
34 lines (28 loc) · 890 Bytes
/
HPConfig.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
package io.github.thatsmusic99.headsplus.config;
import io.github.thatsmusic99.configurationmaster.api.ConfigFile;
import io.github.thatsmusic99.headsplus.HeadsPlus;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.IOException;
public abstract class HPConfig extends ConfigFile {
public HPConfig(@NotNull String name) throws Exception {
super(getOrCreateFile(name));
}
@Override
public void reload() throws Exception {
super.reload();
moveToNew();
save();
postSave();
}
protected static File getOrCreateFile(String name) {
File file = new File(HeadsPlus.get().getDataFolder(), name);
try {
if (!file.exists()) file.createNewFile();
return file;
} catch (IOException e) {
e.printStackTrace();
}
return file;
}
}