sla
This commit is contained in:
parent
de85d51556
commit
e69d767b40
@ -45,6 +45,7 @@ public class LeaderboardUpdateRunnable implements Runnable {
|
|||||||
final Map<UUID, Integer> allKillStreaksMap = new HashMap<>();
|
final Map<UUID, Integer> allKillStreaksMap = new HashMap<>();
|
||||||
|
|
||||||
final List<String> lore = new ArrayList<>();
|
final List<String> lore = new ArrayList<>();
|
||||||
|
final List<String> loreShort = new ArrayList<>();
|
||||||
|
|
||||||
MongoManager.getInstance().getPlayers().find().forEach((Block<? super Document>) document -> {
|
MongoManager.getInstance().getPlayers().find().forEach((Block<? super Document>) document -> {
|
||||||
final Map<String, Integer> eloMap = CorePlugin.GSON.fromJson(document.getString("elo"), PracticeConstants.STRING_INTEGER_MAP_TYPE);
|
final Map<String, Integer> eloMap = CorePlugin.GSON.fromJson(document.getString("elo"), PracticeConstants.STRING_INTEGER_MAP_TYPE);
|
||||||
@ -72,8 +73,6 @@ public class LeaderboardUpdateRunnable implements Runnable {
|
|||||||
|
|
||||||
final AtomicInteger integer = new AtomicInteger();
|
final AtomicInteger integer = new AtomicInteger();
|
||||||
|
|
||||||
final List<String> loreEloShort = new ArrayList<>();
|
|
||||||
|
|
||||||
sortedUuids.forEach(uuid -> {
|
sortedUuids.forEach(uuid -> {
|
||||||
if (integer.get() < 3) { // primeiro, segundo e terceiro lugar
|
if (integer.get() < 3) { // primeiro, segundo e terceiro lugar
|
||||||
final Document playerDocument = CorePlugin.getInstance().getCoreDatabase().getPlayerCollection().find(Filters.eq("uuid", uuid.toString())).first();
|
final Document playerDocument = CorePlugin.getInstance().getCoreDatabase().getPlayerCollection().find(Filters.eq("uuid", uuid.toString())).first();
|
||||||
@ -81,7 +80,6 @@ public class LeaderboardUpdateRunnable implements Runnable {
|
|||||||
if (playerDocument != null) {
|
if (playerDocument != null) {
|
||||||
int rank = integer.incrementAndGet();
|
int rank = integer.incrementAndGet();
|
||||||
String color = String.valueOf(CC.YELLOW);
|
String color = String.valueOf(CC.YELLOW);
|
||||||
String symbol = "✫";
|
|
||||||
|
|
||||||
switch (rank) {
|
switch (rank) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -95,24 +93,23 @@ public class LeaderboardUpdateRunnable implements Runnable {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
lore.add(color + symbol + rank + " " + playerDocument.getString("name") + CC.GRAY + " - " + CC.YELLOW + decimalFormat.format(allEloMap.getOrDefault(uuid, 1000)));
|
lore.add(color + "✫" + rank + " " + playerDocument.getString("name") + CC.GRAY + " - " + CC.YELLOW + decimalFormat.format(allEloMap.getOrDefault(uuid, 1000)));
|
||||||
}
|
}
|
||||||
} else if (integer.get() >= 3 && integer.get() < 10) { // quarto até o décimo lugar
|
} else if (integer.get() >= 3 && integer.get() < 10) {
|
||||||
final Document playerDocument = CorePlugin.getInstance().getCoreDatabase().getPlayerCollection().find(Filters.eq("uuid", uuid.toString())).first();
|
final Document playerDocument = CorePlugin.getInstance().getCoreDatabase().getPlayerCollection().find(Filters.eq("uuid", uuid.toString())).first();
|
||||||
|
|
||||||
if (playerDocument != null) {
|
if (playerDocument != null) {
|
||||||
int rank = integer.incrementAndGet();
|
int rank = integer.incrementAndGet();
|
||||||
|
|
||||||
lore.add(String.valueOf(CC.YELLOW) + "#" + rank + " " + playerDocument.getString("name") + CC.GRAY + " - " + CC.YELLOW + decimalFormat.format(allEloMap.getOrDefault(uuid, 1000)));
|
lore.add(String.valueOf(CC.YELLOW) + "#" + rank + " " + playerDocument.getString("name") + CC.GRAY + " - " + CC.YELLOW + decimalFormat.format(allEloMap.getOrDefault(uuid, 1000)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (lore.size() >= 3) {
|
if (lore.size() >= 3) {
|
||||||
IntStream.range(0, 3).forEach(i -> loreEloShort.add(" " + lore.get(i)));
|
IntStream.range(0, 3).forEach(i -> loreShort.add(" " + lore.get(i).replace("✫", "#")));
|
||||||
}
|
}
|
||||||
|
|
||||||
LeaderboardUpdateRunnable.KIT_SPECIFIC_LEADERBOARD_LORE_SHORT.put(kit, loreEloShort);
|
LeaderboardUpdateRunnable.KIT_SPECIFIC_LEADERBOARD_LORE_SHORT.put(kit, loreShort);
|
||||||
LeaderboardUpdateRunnable.KIT_SPECIFIC_LEADERBOARD_LORE.put(kit, lore);
|
LeaderboardUpdateRunnable.KIT_SPECIFIC_LEADERBOARD_LORE.put(kit, lore);
|
||||||
|
|
||||||
final List<String> loreForKillStreaks = new ArrayList<>();
|
final List<String> loreForKillStreaks = new ArrayList<>();
|
||||||
@ -141,7 +138,7 @@ public class LeaderboardUpdateRunnable implements Runnable {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (loreForKillStreaks.size() >= 3) {
|
if (loreForKillStreaks.size() >= 3) {
|
||||||
IntStream.range(0, 3).forEach(i -> loreForKillStreaksShort.add(" " + loreForKillStreaks.get(i)));
|
IntStream.range(0, 3).forEach(i -> loreForKillStreaksShort.add(" " + loreForKillStreaks.get(i).replace("✫", ""))); // Remove ✫ from loreForKillStreaksShort
|
||||||
}
|
}
|
||||||
|
|
||||||
LeaderboardUpdateRunnable.KIT_SPECIFIC_WIN_STREAK_LORE.put(kit, loreForKillStreaks);
|
LeaderboardUpdateRunnable.KIT_SPECIFIC_WIN_STREAK_LORE.put(kit, loreForKillStreaks);
|
||||||
@ -177,22 +174,9 @@ public class LeaderboardUpdateRunnable implements Runnable {
|
|||||||
if (rankedDivision != null) {
|
if (rankedDivision != null) {
|
||||||
int rank = integer.incrementAndGet();
|
int rank = integer.incrementAndGet();
|
||||||
String color = String.valueOf(CC.YELLOW);
|
String color = String.valueOf(CC.YELLOW);
|
||||||
String symbol = "✫";
|
|
||||||
|
|
||||||
lore.add(color + symbol + rank + " " + playerDocument.getString("name") + CC.GRAY + " - " + CC.YELLOW + decimalFormat.format(globalElo) + CC.GRAY + " - " + rankedDivision.getFancyName()); // Adic
|
lore.add(color + "✫" + rank + " " + playerDocument.getString("name") + CC.GRAY + " - " +
|
||||||
switch (rank) {
|
String.valueOf(CC.YELLOW) + decimalFormat.format(globalElo) + CC.GRAY + " - " + rankedDivision.getFancyName());
|
||||||
case 1:
|
|
||||||
color = String.valueOf(CC.GOLD);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
color = String.valueOf(CC.WHITE);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
color = String.valueOf(CC.BLACK);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
lore.add(color + symbol + rank + " " + playerDocument.getString("name") + CC.GRAY + " - " + CC.YELLOW + decimalFormat.format(globalElo) + CC.GRAY + " - " + rankedDivision.getFancyName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (integer.get() >= 3 && integer.get() < 11) { // quarto até o décimo primeiro lugar
|
} else if (integer.get() >= 3 && integer.get() < 11) { // quarto até o décimo primeiro lugar
|
||||||
|
Loading…
Reference in New Issue
Block a user