danik159

Untitled

Aug 9th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 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.  
  7. import org.bukkit.configuration.file.YamlConfiguration;
  8. import org.bukkit.entity.Player;
  9.  
  10. public class ReportsList {
  11. private static File file1;
  12. private static YamlConfiguration config1;
  13. static ArrayList<String> rlist = new ArrayList<>();
  14. public ReportsList(Main main) {
  15. file1 = new File(main.getDataFolder(), "ReportedPlayers.yml");
  16. if (!file1.exists()) {
  17. try {
  18. file1.createNewFile();
  19. } catch (IOException e) {
  20. e.printStackTrace();
  21. }
  22. }
  23. config1 = YamlConfiguration.loadConfiguration(file1);
  24. }
  25. public static void addplayer(Player player) {
  26. rlist.add(player.getDisplayName());
  27. config1.set("Reported Players:", rlist);
  28. try {
  29. config1.save(file1);
  30. } catch (IOException e) {
  31. e.printStackTrace();
  32. }
  33. }
  34.  
  35. public static java.util.List<?> getplayers() {
  36. return config1.getList("Reported Players:");
  37. }
  38. }
Add Comment
Please, Sign In to add comment