Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. @SuppressWarnings("deprecation")
  2. public void update() {
  3. for (String s : getConfig().getKeys(false)) {
  4. String locationWins = s + ".wins";
  5. String locationKills = s + ".kills";
  6. String locationGp = s + ".gp";
  7. String locationSco = s + ".sco";
  8. OfflinePlayer player = Bukkit.getOfflinePlayer(s);
  9. UUID uuid = player.getUniqueId();
  10.  
  11. boolean shouldReplace = true;
  12.  
  13. try {
  14. @SuppressWarnings("unused")
  15. UUID testUUID = UUID.fromString(s);
  16. shouldReplace = false;
  17. break;
  18. } catch (Exception e) {
  19.  
  20. }
  21.  
  22. if (s.contains("-")) {
  23. shouldReplace = false;
  24. }
  25.  
  26. if (shouldReplace) {
  27. String newLocationWins = uuid.toString() + ".wins";
  28. String newLocationKills = uuid.toString() + ".kills";
  29. String newLocationGp = uuid.toString() + ".gp";
  30. String newLocationSco = uuid.toString() + ".sco";
  31. String newLocationName = uuid.toString() + ".name";
  32.  
  33. set(newLocationName, s);
  34.  
  35. if (getConfig().contains(locationWins)) {
  36. set(newLocationWins, getConfig().getInt(locationWins));
  37. set(locationWins, null);
  38. }
  39. if (getConfig().contains(locationKills)) {
  40. set(newLocationKills, getConfig().getInt(locationKills));
  41. set(locationKills, null);
  42. }
  43. if (getConfig().contains(locationGp)) {
  44. set(newLocationGp, getConfig().getInt(locationGp));
  45. set(locationGp, null);
  46. }
  47. if (getConfig().contains(locationSco)) {
  48. set(newLocationSco, getConfig().getInt(locationSco));
  49. set(locationSco, null);
  50. }
  51. set(s, null);
  52. }
  53. }
  54. save();
  55. }
  56.  
  57.  
  58. // EN DAN
  59.  
  60. public OfflinePlayer[] getTop3(String data) {
  61. OfflinePlayer one = null;
  62. int onei = 0;
  63. OfflinePlayer two = null;
  64. int twoi = 0;
  65. OfflinePlayer tree = null;
  66. int treei = 0;
  67. if (true) {
  68. for (String s : getConfig().getKeys(false)) {
  69. if (getConfig().contains(s + "." + data)) {
  70. int wins = getConfig().getInt(s + "." + data);
  71.  
  72. OfflinePlayer p = null;
  73. try {
  74. p = Bukkit.getOfflinePlayer(UUID.fromString(s));
  75. } catch (IllegalArgumentException e) {
  76. System.out.println("hey2");
  77. break;
  78. }
  79.  
  80. if (p.getName() == null) {
  81. break;
  82. }
  83.  
  84. if (wins >= onei) {
  85. if (one != null) {
  86. tree = two;
  87. treei = twoi;
  88.  
  89. two = one;
  90. twoi = onei;
  91. }
  92. one = p;
  93. onei = wins;
  94. } else if (wins >= twoi) {
  95. if (two != null) {
  96. tree = two;
  97. treei = twoi;
  98. }
  99. two = p;
  100. twoi = wins;
  101. } else if (wins >= treei) {
  102. tree = p;
  103. treei = wins;
  104. }
  105. }
  106. }
  107. }
  108.  
  109. OfflinePlayer[] b = { one, two, tree };
  110. return b;
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement