Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SuppressWarnings("deprecation")
- public void update() {
- for (String s : getConfig().getKeys(false)) {
- String locationWins = s + ".wins";
- String locationKills = s + ".kills";
- String locationGp = s + ".gp";
- String locationSco = s + ".sco";
- OfflinePlayer player = Bukkit.getOfflinePlayer(s);
- UUID uuid = player.getUniqueId();
- boolean shouldReplace = true;
- try {
- @SuppressWarnings("unused")
- UUID testUUID = UUID.fromString(s);
- shouldReplace = false;
- break;
- } catch (Exception e) {
- }
- if (s.contains("-")) {
- shouldReplace = false;
- }
- if (shouldReplace) {
- String newLocationWins = uuid.toString() + ".wins";
- String newLocationKills = uuid.toString() + ".kills";
- String newLocationGp = uuid.toString() + ".gp";
- String newLocationSco = uuid.toString() + ".sco";
- String newLocationName = uuid.toString() + ".name";
- set(newLocationName, s);
- if (getConfig().contains(locationWins)) {
- set(newLocationWins, getConfig().getInt(locationWins));
- set(locationWins, null);
- }
- if (getConfig().contains(locationKills)) {
- set(newLocationKills, getConfig().getInt(locationKills));
- set(locationKills, null);
- }
- if (getConfig().contains(locationGp)) {
- set(newLocationGp, getConfig().getInt(locationGp));
- set(locationGp, null);
- }
- if (getConfig().contains(locationSco)) {
- set(newLocationSco, getConfig().getInt(locationSco));
- set(locationSco, null);
- }
- set(s, null);
- }
- }
- save();
- }
- // EN DAN
- public OfflinePlayer[] getTop3(String data) {
- OfflinePlayer one = null;
- int onei = 0;
- OfflinePlayer two = null;
- int twoi = 0;
- OfflinePlayer tree = null;
- int treei = 0;
- if (true) {
- for (String s : getConfig().getKeys(false)) {
- if (getConfig().contains(s + "." + data)) {
- int wins = getConfig().getInt(s + "." + data);
- OfflinePlayer p = null;
- try {
- p = Bukkit.getOfflinePlayer(UUID.fromString(s));
- } catch (IllegalArgumentException e) {
- System.out.println("hey2");
- break;
- }
- if (p.getName() == null) {
- break;
- }
- if (wins >= onei) {
- if (one != null) {
- tree = two;
- treei = twoi;
- two = one;
- twoi = onei;
- }
- one = p;
- onei = wins;
- } else if (wins >= twoi) {
- if (two != null) {
- tree = two;
- treei = twoi;
- }
- two = p;
- twoi = wins;
- } else if (wins >= treei) {
- tree = p;
- treei = wins;
- }
- }
- }
- }
- OfflinePlayer[] b = { one, two, tree };
- return b;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement