Advertisement
danik159

Untitled

Aug 9th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. package com.chickenstyle.report;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5. import java.util.ArrayList;
  6. import java.util.UUID;
  7.  
  8. import org.bukkit.configuration.file.YamlConfiguration;
  9.  
  10. public class ReportsYML {
  11.  
  12. private static File file;
  13. private static YamlConfiguration config;
  14. static ArrayList<String> list = new ArrayList<>();
  15. public ReportsYML(Main main) {
  16. file = new File(main.getDataFolder(), "Reports.yml");
  17. if (!file.exists()) {
  18. try {
  19. file.createNewFile();
  20. } catch (IOException e) {
  21. e.printStackTrace();
  22. }
  23. }
  24. config = YamlConfiguration.loadConfiguration(file);
  25.  
  26.  
  27. }
  28.  
  29. public static void SetReason(UUID uuid,String nickname,String reportedby,String ip, String reason) {
  30. list.add(reason);
  31.  
  32. String uniqueid = uuid.toString();
  33. config.set(uniqueid + ".Nickname", nickname);
  34. config.set(uniqueid + ".ReportedBy", reportedby);
  35. config.set(uniqueid + ".IP", ip);
  36. config.set(uniqueid + ".Reason", list);
  37. try {
  38. config.save(file);
  39. } catch (IOException e) {
  40. e.printStackTrace();
  41. }
  42.  
  43. }
  44.  
  45. public String getName(UUID name) {
  46. return "hello";
  47.  
  48. }
  49. public static YamlConfiguration file() {
  50. return config;
  51. }
  52. public static void SetUpdate(UUID uuid,String reportedby,String reason) {
  53. String uniqueid = uuid.toString();
  54. list = config.getList(uuid + ".Reason");
  55. list.add(reason);
  56. config.set(uniqueid + ".ReportedBy", reportedby + config.getString("Nickname"));
  57. config.set(uniqueid + ".Reason", list);
  58. try {
  59. config.save(file);
  60. } catch (IOException e) {
  61. e.printStackTrace();
  62. }
  63. }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement