Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. package me.coder.survivalsystem.objects;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5.  
  6. import org.bukkit.configuration.file.FileConfiguration;
  7. import org.bukkit.configuration.file.YamlConfiguration;
  8.  
  9. import me.coder.survivalsystem.MainClass;
  10. import me.coder.survivalsystem.utils.ChatUtil;
  11.  
  12. public class FileSystem {
  13.  
  14. private MainClass plugin = MainClass.getInstance();
  15.  
  16. public static FileConfiguration tpConfig;
  17. public static File tpFile;
  18.  
  19. public void setup_tpConfig() {
  20. if(!plugin.getDataFolder().exists()) {
  21. plugin.getDataFolder().mkdirs();
  22. }
  23.  
  24. tpFile = new File(plugin.getDataFolder(), "teleporter.yml");
  25.  
  26. if(!tpFile.exists()) {
  27. try {
  28. tpFile.createNewFile();
  29. plugin.log.sendMessage(ChatUtil.format("&f[&cMine&eClade &aSystem&f]&r The teleporter.yml file has been created"));
  30. } catch (IOException e) {
  31. plugin.log.sendMessage(ChatUtil.format("&f[&cMine&eClade &aSystem&f]&r Could not create the teleporter.yml file"));
  32. }
  33. }
  34.  
  35. tpConfig = YamlConfiguration.loadConfiguration(tpFile);
  36. }
  37.  
  38. public static FileConfiguration get_tpConfig() {
  39. return tpConfig;
  40. }
  41.  
  42. public void save_tpConfig() {
  43. try {
  44. tpConfig.save(tpFile);
  45. plugin.log.sendMessage(ChatUtil.format("&f[&cMine&eClade &aSystem&f]&r The teleporter.yml file has been saved"));
  46. } catch (IOException e) {
  47. plugin.log.sendMessage(ChatUtil.format("&f[&cMine&eClade &aSystem&f]&r Could not create the teleporter.yml file"));
  48. }
  49. }
  50.  
  51. public void reload_tpConfig() {
  52. tpConfig = YamlConfiguration.loadConfiguration(tpFile);
  53. plugin.log.sendMessage(ChatUtil.format("&f[&cMine&eClade &aSystem&f]&r The teleporter.yml file has been reloaded"));
  54. }
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement