funkemunky

Untitled

Apr 15th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. public void reloadReclaim() {
  2. if (reclaimFile == null) {
  3. reclaimFile = new File(getDataFolder(), "reclaim.yml");
  4. }
  5. reclaimConfig = YamlConfiguration.loadConfiguration(reclaimFile);
  6. Reader defConfigStream = null;
  7. try {
  8. defConfigStream = new InputStreamReader(this.getResource("reclaim.yml"), "UTF8");
  9. } catch (UnsupportedEncodingException e) {
  10. e.printStackTrace();
  11. }
  12. if (defConfigStream != null) {
  13. YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
  14. reclaimConfig.setDefaults(defConfig);
  15. }
  16. }
  17. public FileConfiguration getReclaim() {
  18. if (reclaimConfig == null) {
  19. reloadReclaim();
  20. }
  21. return reclaimConfig;
  22. }
  23. public void saveReclaim() {
  24. if (reclaimConfig == null || reclaimFile == null) {
  25. return;
  26. }
  27. try {
  28. getReclaim().save(reclaimFile);
  29. } catch (IOException ex) {
  30. getLogger().log(Level.SEVERE, "Could not save config to " + reclaimFile, ex);
  31. }
  32. }
  33.  
  34. public void saveDefaultReclaim() {
  35. if (reclaimFile == null) {
  36. reclaimFile = new File(getDataFolder(), "reclaim.yml");
  37. }
  38. if (!reclaimFile.exists()) {
  39. getLogger().log(Level.WARNING, "No previous dbs file was found! Creating one now...");
  40. saveResource("dbs.yml", false);
  41. getLogger().log(Level.INFO, "dbs file was created!");
  42. }
  43. }
  44.  
  45. (REPLACE THOSE)
Add Comment
Please, Sign In to add comment