Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Settings() {}
- private static Settings instance = new Settings();
- public static Settings getInstance() {
- return instance;
- }
- private FileConfiguration data;
- private File dfile;
- public void setup(Plugin p) {
- if (!p.getDataFolder().exists()) {
- p.getDataFolder().mkdir();
- }
- dfile = new File(p.getDataFolder(), "data.yml");
- if (!dfile.exists()) {
- try {
- dfile.createNewFile();
- } catch (IOException ex) {
- Bukkit.getServer().getLogger().severe(ChatColor.RED + "Could not create data.yml!");
- }
- }
- data = YamlConfiguration.loadConfiguration(dfile);
- }
- public FileConfiguration getData() {
- return data;
- }
- public void saveData() {
- try {
- data.save(dfile);
- } catch (IOException ex) {
- Bukkit.getServer().getLogger().severe(ChatColor.RED + "Could not save data.yml!");
- }
- }
- public void reloadData() {
- data = YamlConfiguration.loadConfiguration(dfile);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement