Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. package to.epac.factorycraft.CombinedHit.Utils;
  2.  
  3. import java.io.File;
  4.  
  5. import org.bukkit.configuration.file.FileConfiguration;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.plugin.Plugin;
  8.  
  9. import to.epac.factorycraft.CombinedHit.Main;
  10.  
  11. public class FileHandler {
  12. private static Plugin plugin = Main.instance;
  13. static FileConfiguration file = plugin.getConfig();
  14.  
  15. public static boolean configFileExist() {
  16. File configFile = new File(plugin.getDataFolder(), "config.yml");
  17. if (!configFile.exists()) {
  18. plugin.saveDefaultConfig();
  19. plugin.getConfig().options().copyDefaults(true);
  20. plugin.saveConfig();
  21.  
  22. return false;
  23. }
  24. return true;
  25. }
  26.  
  27. public static boolean configFileEmpty() {
  28. if (file.getString("Players") == null) {
  29. plugin.saveDefaultConfig();
  30. plugin.getConfig().options().copyDefaults(true);
  31. plugin.saveConfig();
  32.  
  33. return true;
  34. }
  35. return false;
  36. }
  37.  
  38. public static int getLevel(Player p) {
  39. return file.getInt("Players." + p.getUniqueId() + ".Level");
  40. }
  41.  
  42. public static boolean isPlayerInDataBase(Player p) {
  43. return file.contains("Players." + p.getUniqueId() + ".Level");
  44. }
  45.  
  46. public static boolean isConfigFileValid() {
  47.  
  48. }
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement