Advertisement
mmuziek

Untitled

Sep 23rd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. public void saveconfig(File filename, FileConfiguration config) {
  2.  
  3. try {
  4. config.save(filename);
  5. } catch (IOException e) {
  6.  
  7. }
  8.  
  9. }
  10.  
  11. public void saveplayerconfig(UUID uuid, FileConfiguration config) {
  12. File PC = new File(getDataFolder() + "/playerdata/" + uuid.toString());
  13. saveconfig(PC, config);
  14.  
  15. }
  16.  
  17. public FileConfiguration getplayerconfig(UUID uuid) {
  18.  
  19. File PC = new File(getDataFolder() + "/playerdata/" + uuid.toString());
  20.  
  21. return loadconfig(PC);
  22.  
  23. }
  24.  
  25. public FileConfiguration loadconfig(File filename) {
  26. FileConfiguration config = YamlConfiguration.loadConfiguration(filename);
  27.  
  28. return config;
  29.  
  30. }
  31.  
  32.  
  33. // example loading and editing:
  34. FileConfiguration plc = pl.getplayerconfig(e.getPlayer().getUniqueId());
  35. plc.set("donotedit", true);
  36. pl.saveplayerconfig(e.getPlayer().getUniqueId(), plc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement