2020-10-31 04:58:12 +00:00
|
|
|
package me.totalfreedom.plex.command;
|
2020-10-28 03:49:56 +00:00
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import me.totalfreedom.plex.Plex;
|
|
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
|
|
|
|
|
|
public class MainConfig extends YamlConfiguration
|
|
|
|
{
|
2020-10-29 02:10:47 +00:00
|
|
|
private Plex plugin;
|
|
|
|
private File file;
|
2020-10-28 03:49:56 +00:00
|
|
|
|
2020-10-29 00:54:23 +00:00
|
|
|
public MainConfig(Plex plugin)
|
2020-10-28 03:49:56 +00:00
|
|
|
{
|
|
|
|
this.plugin = plugin;
|
2020-10-29 00:54:23 +00:00
|
|
|
this.file = new File(plugin.getDataFolder(), "config.yml");
|
2020-10-28 03:49:56 +00:00
|
|
|
|
|
|
|
if (!file.exists())
|
|
|
|
{
|
2020-10-29 00:54:23 +00:00
|
|
|
saveDefault();
|
2020-10-28 03:49:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void load()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
super.load(file);
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
ex.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void save()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
super.save(file);
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
ex.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-29 00:54:23 +00:00
|
|
|
private void saveDefault()
|
2020-10-28 03:49:56 +00:00
|
|
|
{
|
2020-10-29 00:54:23 +00:00
|
|
|
plugin.saveResource("config.yml", false);
|
2020-10-28 03:49:56 +00:00
|
|
|
}
|
|
|
|
}
|