mirror of
https://github.com/TotalFreedomMC/TFGuilds.git
synced 2024-05-15 17:11:25 +00:00
11b3e194ec
Simplify removing color codes by using ChatColor#stripColor Have an option to use sqlite or mysql, by default it will be sqlite
52 lines
1 KiB
Java
52 lines
1 KiB
Java
package me.totalfreedom.tfguilds.config;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import me.totalfreedom.tfguilds.TFGuilds;
|
|
import org.bukkit.configuration.InvalidConfigurationException;
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
|
|
public class Config extends YamlConfiguration
|
|
{
|
|
|
|
private final TFGuilds plugin;
|
|
private final File file;
|
|
|
|
public Config(String fileName)
|
|
{
|
|
this.plugin = TFGuilds.getPlugin();
|
|
this.file = new File(plugin.getDataFolder(), fileName);
|
|
|
|
if (!file.exists())
|
|
{
|
|
plugin.saveResource(fileName, false);
|
|
}
|
|
|
|
load();
|
|
}
|
|
|
|
public void save()
|
|
{
|
|
try
|
|
{
|
|
super.save(file);
|
|
}
|
|
catch (IOException ex)
|
|
{
|
|
ex.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public void load()
|
|
{
|
|
try
|
|
{
|
|
super.load(file);
|
|
}
|
|
catch (IOException | InvalidConfigurationException ex)
|
|
{
|
|
ex.printStackTrace();
|
|
}
|
|
}
|
|
}
|