Advertisement
cj89898_2

Untitled

Aug 7th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. package net.cjservers.resourcegens;
  2.  
  3. import java.io.File;
  4.  
  5. import net.cjservers.resourcegens.Main;
  6. import net.cjservers.resourcegens.Commands;
  7.  
  8. import org.bukkit.configuration.file.FileConfiguration;
  9. import org.bukkit.event.Listener;
  10. import org.bukkit.plugin.java.JavaPlugin;
  11.  
  12. public class Main extends JavaPlugin implements Listener {
  13.  
  14. private static Main instance;
  15. private Utils utils;
  16. public String version;
  17.  
  18. public File confYml = new File(getDataFolder(), "config.yml");
  19. public FileConfiguration conf;
  20.  
  21. public File genYml = new File(getDataFolder(), "generators.yml");
  22. public FileConfiguration genConfig;
  23.  
  24. @Override
  25. public void onEnable(){
  26. instance = this;
  27. utils = new Utils(this);
  28.  
  29. fixConf();
  30. conf = Utils.getConfiguration("config.yml");
  31. genConfig = Utils.getConfiguration("generators.yml");
  32. version = getDescription().getVersion();
  33. new DestroyGen(this);
  34.  
  35. getServer().getPluginManager().registerEvents(this, this);
  36.  
  37. this.getCommand("rg").setExecutor(new Commands(this));
  38. }
  39.  
  40. @Override
  41. public void onDisable(){
  42.  
  43. }
  44.  
  45. public static Main getInstance() {
  46. return instance;
  47. }
  48.  
  49. public Utils getUtils() {
  50. return utils;
  51. }
  52.  
  53. public void fixConf(){
  54. if (!(confYml.exists())) {
  55. saveDefaultConfig();
  56. System.out.println("[ResourceGens] - Created config.yml");
  57. }
  58. if (!(genYml.exists())) {
  59. Utils.save(genConfig, "generators.yml");
  60. System.out.println("[ResourceGens] - Created generators.yml");
  61. }
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement