65 lines
1.7 KiB
Java
65 lines
1.7 KiB
Java
package de.velocityfall.manager;
|
|
|
|
import de.velocityfall.VelocityFall;
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
|
|
public class Configs {
|
|
|
|
private final VelocityFall plugin;
|
|
private YamlConfiguration arenasConfig;
|
|
private YamlConfiguration saveConfig;
|
|
private File arenasFile;
|
|
private File saveFile;
|
|
|
|
public Configs(VelocityFall plugin) {
|
|
this.plugin = plugin;
|
|
createConfigs();
|
|
loadConfigs();
|
|
}
|
|
|
|
public void createConfigs() {
|
|
if (!plugin.getDataFolder().exists()) {
|
|
plugin.getDataFolder().mkdirs();
|
|
}
|
|
|
|
arenasFile = new File(plugin.getDataFolder(), "arenas.yml");
|
|
saveFile = new File(plugin.getDataFolder(), "saves.yml");
|
|
|
|
if (!arenasFile.exists()) {
|
|
try {
|
|
arenasFile.createNewFile();
|
|
} catch (IOException e) {
|
|
plugin.getLogger().severe("Fehler bei arenas.yml: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
if (!saveFile.exists()) {
|
|
try {
|
|
saveFile.createNewFile();
|
|
} catch (IOException e) {
|
|
plugin.getLogger().severe("Fehler bei saves.yml: " + e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
|
|
private void loadConfigs() {
|
|
arenasConfig = YamlConfiguration.loadConfiguration(arenasFile);
|
|
saveConfig = YamlConfiguration.loadConfiguration(saveFile);
|
|
}
|
|
|
|
public YamlConfiguration getArenasConfig() {
|
|
return arenasConfig;
|
|
}
|
|
|
|
public YamlConfiguration getSaveConfig() {
|
|
return saveConfig;
|
|
}
|
|
|
|
public File getSaveFile() {
|
|
return saveFile;
|
|
}
|
|
}
|