diff --git a/pom.xml b/pom.xml
index 249005c..6e36a3b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -110,8 +110,7 @@
org.mongodb
mongo-java-driver
- 3.12.11
- compile
+ 3.12.7
net.citizne
@@ -120,6 +119,12 @@
system
${basedir}/lib/Citizens-2.0.29-b2490.jar
+
+ com.jonahseguin
+ drink
+ 1.0.5
+ compile
+
net.23
qwoiufjwsodnmwso
diff --git a/src/main/java/land/battle/practice/Practice.java b/src/main/java/land/battle/practice/Practice.java
index 3de7dd8..e8adc81 100644
--- a/src/main/java/land/battle/practice/Practice.java
+++ b/src/main/java/land/battle/practice/Practice.java
@@ -40,6 +40,7 @@ import land.battle.practice.shop.item.statreset.NameColorItem;
import land.battle.practice.shop.item.statreset.StatisticResetItem;
import land.battle.practice.util.Animation;
import land.battle.practice.util.CC;
+import land.battle.practice.util.ClassUtil;
import land.battle.practice.util.timer.TimerManager;
import land.battle.practice.util.timer.impl.EnderpearlTimer;
import land.battle.practice.vote.VoteManager;
@@ -51,7 +52,9 @@ import me.lucko.helper.plugin.ExtendedJavaPlugin;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
+import org.bukkit.event.Listener;
+import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
@@ -291,6 +294,7 @@ public class Practice extends ExtendedJavaPlugin {
).forEach(listener -> this.getServer().getPluginManager().registerEvents(listener, this));
}
+
public CompletableFuture fetchNitroReward(Player player) {
return CompletableFuture.supplyAsync(() -> {
final AtomicBoolean atomicBoolean = new AtomicBoolean();
diff --git a/src/main/java/land/battle/practice/runnable/LeaderboardUpdateRunnable.java b/src/main/java/land/battle/practice/runnable/LeaderboardUpdateRunnable.java
index 92cf4d3..d455be9 100644
--- a/src/main/java/land/battle/practice/runnable/LeaderboardUpdateRunnable.java
+++ b/src/main/java/land/battle/practice/runnable/LeaderboardUpdateRunnable.java
@@ -16,6 +16,7 @@ import land.battle.practice.util.CC;
import land.battle.practice.util.division.RankedDivision;
import org.bson.Document;
+import java.text.DecimalFormat;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicInteger;
@@ -27,11 +28,9 @@ import java.util.stream.IntStream;
* @author BattleLand Team
* @since 7/29/2021
*/
-
public class LeaderboardUpdateRunnable implements Runnable {
public static final List GLOBAL_ELO_LEADERBOARD_LORE = new ArrayList<>();
-
public static final Map> KIT_SPECIFIC_LEADERBOARD_LORE = new HashMap<>();
public static final Map> KIT_SPECIFIC_LEADERBOARD_LORE_SHORT = new HashMap<>();
public static final Map> KIT_SPECIFIC_WIN_STREAK_LORE = new HashMap<>();
@@ -39,6 +38,8 @@ public class LeaderboardUpdateRunnable implements Runnable {
@Override
public void run() {
+ DecimalFormat decimalFormat = new DecimalFormat("#,###");
+
CompletableFuture.runAsync(() -> {
Practice.getInstance().getKitManager().getKits().stream().filter(Kit::isRanked).forEach(kit -> {
final Map allEloMap = new HashMap<>();
@@ -64,7 +65,6 @@ public class LeaderboardUpdateRunnable implements Runnable {
}
allKillStreaksMap.put(playerUuid, value);
}
-
});
final List sortedUuids = new HashSet<>(allEloMap.keySet()).stream()
@@ -80,7 +80,26 @@ public class LeaderboardUpdateRunnable implements Runnable {
final Document playerDocument = CorePlugin.getInstance().getCoreDatabase().getPlayerCollection().find(Filters.eq("uuid", uuid.toString())).first();
if (playerDocument != null) {
- lore.add(CC.GOLD + "#" + integer.incrementAndGet() + " " + CC.WHITE + playerDocument.getString("name") + CC.GRAY + " - " + CC.YELLOW + allEloMap.getOrDefault(uuid, 1000));
+ int rank = integer.incrementAndGet();
+ String color = String.valueOf(CC.YELLOW);
+ String star = "";
+
+ switch (rank) {
+ case 1:
+ color = String.valueOf(CC.GOLD);
+ star = "✫";
+ break;
+ case 2:
+ color = String.valueOf(CC.GRAY);
+ star = "✫";
+ break;
+ case 3:
+ color = String.valueOf(CC.DARK_GRAY);
+ star = "✫";
+ break;
+ }
+
+ lore.add(color + "#" + rank + " " + playerDocument.getString("name") + star + CC.GRAY + " - " + CC.YELLOW + decimalFormat.format(allEloMap.getOrDefault(uuid, 1000)));
}
}
});
@@ -90,7 +109,6 @@ public class LeaderboardUpdateRunnable implements Runnable {
}
LeaderboardUpdateRunnable.KIT_SPECIFIC_LEADERBOARD_LORE_SHORT.put(kit, loreEloShort);
-
LeaderboardUpdateRunnable.KIT_SPECIFIC_LEADERBOARD_LORE.put(kit, lore);
final List loreForKillStreaks = new ArrayList<>();
@@ -107,15 +125,13 @@ public class LeaderboardUpdateRunnable implements Runnable {
final Document playerDocument = CorePlugin.getInstance().getCoreDatabase().getPlayerCollection().find(Filters.eq("uuid", uuid.toString())).first();
if (playerDocument != null) {
- loreForKillStreaks.add(CC.GOLD + "#" + integerForKillStreaks.incrementAndGet() + " " + CC.WHITE + playerDocument.getString("name") + CC.GRAY + " - " + CC.YELLOW + allKillStreaksMap.get(uuid));
+ loreForKillStreaks.add(CC.GOLD + "#" + integerForKillStreaks.incrementAndGet() + " " + CC.WHITE + playerDocument.getString("name") + CC.GRAY + " - " + CC.YELLOW + decimalFormat.format(allKillStreaksMap.get(uuid))); // Adicione decimalFormat aqui
}
}
});
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)));
}
LeaderboardUpdateRunnable.KIT_SPECIFIC_WIN_STREAK_LORE.put(kit, loreForKillStreaks);
@@ -149,7 +165,26 @@ public class LeaderboardUpdateRunnable implements Runnable {
final RankedDivision rankedDivision = RankedDivision.getByGlobalElo(globalElo);
if (rankedDivision != null) {
- lore.add(CC.GOLD + "#" + integer.incrementAndGet() + " " + CC.WHITE + playerDocument.getString("name") + CC.GRAY + " - " + CC.YELLOW + globalElo + CC.GRAY + " - " + rankedDivision.getFancyName());
+ int rank = integer.incrementAndGet();
+ String color = String.valueOf(CC.YELLOW);
+ String star = "";
+
+ switch (rank) {
+ case 1:
+ color = String.valueOf(CC.GOLD);
+ star = "✫";
+ break;
+ case 2:
+ color = String.valueOf(CC.WHITE);
+ star = "✫";
+ break;
+ case 3:
+ color = String.valueOf(CC.BLACK);
+ star = "✫";
+ break;
+ }
+
+ lore.add(color + "#" + rank + " " + playerDocument.getString("name") + star + CC.GRAY + " - " + CC.YELLOW + decimalFormat.format(globalElo) + CC.GRAY + " - " + rankedDivision.getFancyName()); // Adicione decimalFormat aqui
}
}
}