Revert "driver"

This reverts commit 8482451eef.
This commit is contained in:
nearfe 2024-06-19 14:55:13 -03:00
parent 8482451eef
commit 9fd1d5c274
3 changed files with 12 additions and 56 deletions

View File

@ -110,7 +110,8 @@
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.12.7</version>
<version>3.12.11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.citizne</groupId>
@ -119,12 +120,6 @@
<scope>system</scope>
<systemPath>${basedir}/lib/Citizens-2.0.29-b2490.jar</systemPath>
</dependency>
<dependency>
<groupId>com.jonahseguin</groupId>
<artifactId>drink</artifactId>
<version>1.0.5</version> <!-- At time of writing, 1.0.5 is latest version. See the pom.xml for the latest version -->
<scope>compile</scope> <!-- Change scope to 'provided' if you are running drink as a plugin rather than shading it -->
</dependency>
<dependency>
<groupId>net.23</groupId>
<artifactId>qwoiufjwsodnmwso</artifactId>

View File

@ -40,7 +40,6 @@ 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;
@ -52,9 +51,7 @@ 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;
@ -294,7 +291,6 @@ public class Practice extends ExtendedJavaPlugin {
).forEach(listener -> this.getServer().getPluginManager().registerEvents(listener, this));
}
public CompletableFuture<Boolean> fetchNitroReward(Player player) {
return CompletableFuture.supplyAsync(() -> {
final AtomicBoolean atomicBoolean = new AtomicBoolean();

View File

@ -16,7 +16,6 @@ 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;
@ -28,9 +27,11 @@ import java.util.stream.IntStream;
* @author BattleLand Team
* @since 7/29/2021
*/
public class LeaderboardUpdateRunnable implements Runnable {
public static final List<String> GLOBAL_ELO_LEADERBOARD_LORE = new ArrayList<>();
public static final Map<Kit, List<String>> KIT_SPECIFIC_LEADERBOARD_LORE = new HashMap<>();
public static final Map<Kit, List<String>> KIT_SPECIFIC_LEADERBOARD_LORE_SHORT = new HashMap<>();
public static final Map<Kit, List<String>> KIT_SPECIFIC_WIN_STREAK_LORE = new HashMap<>();
@ -38,8 +39,6 @@ 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<UUID, Integer> allEloMap = new HashMap<>();
@ -65,6 +64,7 @@ public class LeaderboardUpdateRunnable implements Runnable {
}
allKillStreaksMap.put(playerUuid, value);
}
});
final List<UUID> sortedUuids = new HashSet<>(allEloMap.keySet()).stream()
@ -80,26 +80,7 @@ public class LeaderboardUpdateRunnable implements Runnable {
final Document playerDocument = CorePlugin.getInstance().getCoreDatabase().getPlayerCollection().find(Filters.eq("uuid", uuid.toString())).first();
if (playerDocument != null) {
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)));
lore.add(CC.GOLD + "#" + integer.incrementAndGet() + " " + CC.WHITE + playerDocument.getString("name") + CC.GRAY + " - " + CC.YELLOW + allEloMap.getOrDefault(uuid, 1000));
}
}
});
@ -109,6 +90,7 @@ public class LeaderboardUpdateRunnable implements Runnable {
}
LeaderboardUpdateRunnable.KIT_SPECIFIC_LEADERBOARD_LORE_SHORT.put(kit, loreEloShort);
LeaderboardUpdateRunnable.KIT_SPECIFIC_LEADERBOARD_LORE.put(kit, lore);
final List<String> loreForKillStreaks = new ArrayList<>();
@ -125,13 +107,15 @@ 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 + decimalFormat.format(allKillStreaksMap.get(uuid))); // Adicione decimalFormat aqui
loreForKillStreaks.add(CC.GOLD + "#" + integerForKillStreaks.incrementAndGet() + " " + CC.WHITE + playerDocument.getString("name") + CC.GRAY + " - " + CC.YELLOW + allKillStreaksMap.get(uuid));
}
}
});
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);
@ -165,26 +149,7 @@ public class LeaderboardUpdateRunnable implements Runnable {
final RankedDivision rankedDivision = RankedDivision.getByGlobalElo(globalElo);
if (rankedDivision != null) {
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
lore.add(CC.GOLD + "#" + integer.incrementAndGet() + " " + CC.WHITE + playerDocument.getString("name") + CC.GRAY + " - " + CC.YELLOW + globalElo + CC.GRAY + " - " + rankedDivision.getFancyName());
}
}
}