Advertisement
Guest User

Untitled

a guest
Aug 12th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. package plugin;
  2.  
  3. import org.bukkit.configuration.file.FileConfiguration;
  4. import org.bukkit.configuration.file.YamlConfiguration;
  5. import org.bukkit.plugin.java.JavaPlugin;
  6.  
  7. import java.io.File;
  8. import java.io.IOException;
  9. import java.util.ArrayList;
  10. import java.util.List;
  11.  
  12. public class Main extends JavaPlugin {
  13.  
  14.  
  15. FileConfiguration data;
  16. File datafile = new File(getDataFolder() + File.separator + "data.yml");
  17.  
  18.  
  19. @Override
  20. public void onEnable(){
  21. getServer().getPluginManager().registerEvents(new RegisterEvents(this),this);
  22. if (!datafile.exists()) {
  23. try {
  24. getDataFolder().mkdir();
  25. datafile.createNewFile();
  26. } catch (IOException e) {
  27. e.printStackTrace();
  28. }
  29. }
  30. data = YamlConfiguration.loadConfiguration(datafile);
  31.  
  32. SaveData();
  33. }
  34.  
  35. void SaveData() {
  36. try {
  37. data.save(datafile);
  38. } catch (IOException e) {
  39. e.printStackTrace();
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement