Advertisement
danik159

Untitled

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