Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. public class Config
  2. {
  3. private static Config inst;
  4. private FileConfiguration cfg;
  5. private static File mainDir;
  6. private static File cfgFile;
  7. public String checkSpawnWorld;
  8. public int checkSpawnX;
  9. public int checkSpawnY;
  10. public int checkSpawnZ;
  11. public String TeamSpeak;
  12.  
  13. static {
  14. Config.mainDir = Main.getInst().getDataFolder();
  15. Config.cfgFile = new File(Config.mainDir, "config.yml");
  16. }
  17.  
  18. private Config() {
  19. this.cfg = Main.getInst().getConfig();
  20. Config.inst = this;
  21. }
  22.  
  23. public void load() {
  24. this.checkSpawnWorld = this.cfg.getString("check.World");
  25. this.checkSpawnX = this.cfg.getInt("check.X");
  26. this.checkSpawnY = this.cfg.getInt("check.Y");
  27. this.checkSpawnZ = this.cfg.getInt("check.Z");
  28. this.TeamSpeak = this.cfg.getString("check.TeamSpeak");
  29. }
  30.  
  31. public static Config getInst() {
  32. if (Config.inst == null) {
  33. return new Config();
  34. }
  35. return Config.inst;
  36. }
  37.  
  38. public static void check() {
  39. if (!Config.mainDir.exists()) {
  40. Config.mainDir.mkdir();
  41. }
  42. if (!Config.cfgFile.exists()) {
  43. Main.getInst().saveDefaultConfig();
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement