Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.coder.survivalsystem.objects;
- import java.io.File;
- import java.io.IOException;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.configuration.file.YamlConfiguration;
- import me.coder.survivalsystem.MainClass;
- import me.coder.survivalsystem.utils.ChatUtil;
- public class FileSystem {
- private MainClass plugin = MainClass.getInstance();
- public static FileConfiguration tpConfig;
- public static File tpFile;
- public void setup_tpConfig() {
- if(!plugin.getDataFolder().exists()) {
- plugin.getDataFolder().mkdirs();
- }
- tpFile = new File(plugin.getDataFolder(), "teleporter.yml");
- if(!tpFile.exists()) {
- try {
- tpFile.createNewFile();
- plugin.log.sendMessage(ChatUtil.format("&f[&cMine&eClade &aSystem&f]&r The teleporter.yml file has been created"));
- } catch (IOException e) {
- plugin.log.sendMessage(ChatUtil.format("&f[&cMine&eClade &aSystem&f]&r Could not create the teleporter.yml file"));
- }
- }
- tpConfig = YamlConfiguration.loadConfiguration(tpFile);
- }
- public static FileConfiguration get_tpConfig() {
- return tpConfig;
- }
- public void save_tpConfig() {
- try {
- tpConfig.save(tpFile);
- plugin.log.sendMessage(ChatUtil.format("&f[&cMine&eClade &aSystem&f]&r The teleporter.yml file has been saved"));
- } catch (IOException e) {
- plugin.log.sendMessage(ChatUtil.format("&f[&cMine&eClade &aSystem&f]&r Could not create the teleporter.yml file"));
- }
- }
- public void reload_tpConfig() {
- tpConfig = YamlConfiguration.loadConfiguration(tpFile);
- plugin.log.sendMessage(ChatUtil.format("&f[&cMine&eClade &aSystem&f]&r The teleporter.yml file has been reloaded"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement