diff --git a/CHANGES.md b/CHANGES.md
index d1271fc7..c6f620c6 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,4 +1,7 @@
**[Infinite Elytra Parkour](https://www.spigotmc.org/resources/115322/) | [Infinite Parkour+](https://www.spigotmc.org/resources/105019/)**
-- Fixed first release of major versions not working
-- Fixed spectator permission not working with /ip join
\ No newline at end of file
+- Running Multiverse with IP now does not require VoidGen
+- Improved responsiveness of parkour and scoreboard
+- Fixed leaderboards sorting being wrong
+- Fixed placeholders returning wrong values
+- Fixed vague sorting locale in leaderboard menu
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 94a30bfd..5a79f432 100644
--- a/pom.xml
+++ b/pom.xml
@@ -120,13 +120,6 @@
provided
-
- com.onarandombox.multiversecore
- Multiverse-Core
- 4.3.0
- provided
-
-
com.github.MilkBowl
VaultAPI
diff --git a/src/main/java/dev/efnilite/ip/Command.java b/src/main/java/dev/efnilite/ip/Command.java
index 3de12bf8..8a2ee7d6 100644
--- a/src/main/java/dev/efnilite/ip/Command.java
+++ b/src/main/java/dev/efnilite/ip/Command.java
@@ -6,7 +6,6 @@
import dev.efnilite.ip.leaderboard.Leaderboard;
import dev.efnilite.ip.menu.Menus;
import dev.efnilite.ip.menu.ParkourOption;
-import dev.efnilite.ip.menu.community.SingleLeaderboardMenu;
import dev.efnilite.ip.mode.Mode;
import dev.efnilite.ip.mode.Modes;
import dev.efnilite.ip.mode.MultiMode;
@@ -451,7 +450,7 @@ private void handle2Args(@NotNull String arg1, @NotNull String arg2, @NotNull Co
if (mode == null) {
Menus.LEADERBOARDS.open(player);
} else {
- Menus.SINGLE_LEADERBOARD.open(player, mode, SingleLeaderboardMenu.Sort.SCORE);
+ Menus.SINGLE_LEADERBOARD.open(player, mode, Leaderboard.Sort.SCORE);
}
}
case "schematic" -> {
diff --git a/src/main/java/dev/efnilite/ip/Events.java b/src/main/java/dev/efnilite/ip/Events.java
index 8f8706e8..4e9d078f 100644
--- a/src/main/java/dev/efnilite/ip/Events.java
+++ b/src/main/java/dev/efnilite/ip/Events.java
@@ -10,13 +10,11 @@
import dev.efnilite.ip.player.ParkourUser;
import dev.efnilite.ip.session.Session;
import dev.efnilite.ip.world.WorldManager;
-import dev.efnilite.ip.world.WorldManagerMV;
import dev.efnilite.vilib.event.EventWatcher;
import dev.efnilite.vilib.particle.ParticleData;
import dev.efnilite.vilib.particle.Particles;
import dev.efnilite.vilib.util.Locations;
import dev.efnilite.vilib.util.Strings;
-import dev.efnilite.vilib.util.VoidGenerator;
import io.papermc.lib.PaperLib;
import org.bukkit.*;
import org.bukkit.command.CommandSender;
@@ -78,12 +76,6 @@ public void chat(AsyncPlayerChatEvent event) {
public void join(PlayerJoinEvent event) {
Player player = event.getPlayer();
- if (player.isOp() && WorldManagerMV.MANAGER != null && VoidGenerator.getMultiverseGenerator() == null) {
- send(player, "");
- send(player, IP.PREFIX + "You are running Multiverse without VoidGen. This causes extreme lag spikes and performance issues while playing. Please install the plugin 'VoidGen' to fix this.");
- send(player, "");
- }
-
if (Config.CONFIG.getBoolean("bungeecord.enabled")) {
Modes.DEFAULT.create(player);
return;
diff --git a/src/main/java/dev/efnilite/ip/config/Option.java b/src/main/java/dev/efnilite/ip/config/Option.java
index b2985e8c..e3a644f6 100644
--- a/src/main/java/dev/efnilite/ip/config/Option.java
+++ b/src/main/java/dev/efnilite/ip/config/Option.java
@@ -27,9 +27,6 @@ public class Option {
public static Map OPTIONS_ENABLED;
public static Map OPTIONS_DEFAULTS;
- // Worlds
- public static String WORLD_NAME;
-
public static Location GO_BACK_LOC;
public static void init(boolean firstLoad) {
@@ -46,15 +43,6 @@ public static void init(boolean firstLoad) {
// General settings
- // Worlds
- WORLD_NAME = Config.CONFIG.getString("world.name");
-
- if (!WORLD_NAME.matches("[a-zA-Z0-9_-]+")) {
- IP.logging().stack("Invalid world name: %s".formatted(WORLD_NAME), "world names need to contain only a-z, A-Z, 0-9, _ or -.");
-
- WORLD_NAME = "witp";
- }
-
// Options
List options = new ArrayList<>(Arrays.asList(ParkourOption.values()));
diff --git a/src/main/java/dev/efnilite/ip/generator/GeneratorOption.java b/src/main/java/dev/efnilite/ip/generator/GeneratorOption.java
index b8e1e3e1..8318b792 100644
--- a/src/main/java/dev/efnilite/ip/generator/GeneratorOption.java
+++ b/src/main/java/dev/efnilite/ip/generator/GeneratorOption.java
@@ -7,7 +7,6 @@ public enum GeneratorOption {
DISABLE_SCHEMATICS,
DISABLE_SPECIAL,
- REDUCE_RANDOM_BLOCK_SELECTION_ANGLE,
- INCREASED_TICK_ACCURACY
+ REDUCE_RANDOM_BLOCK_SELECTION_ANGLE
}
diff --git a/src/main/java/dev/efnilite/ip/generator/ParkourGenerator.java b/src/main/java/dev/efnilite/ip/generator/ParkourGenerator.java
index ef497546..115a1fd2 100644
--- a/src/main/java/dev/efnilite/ip/generator/ParkourGenerator.java
+++ b/src/main/java/dev/efnilite/ip/generator/ParkourGenerator.java
@@ -375,7 +375,7 @@ public void menu(ParkourPlayer player) {
public void startTick() {
task = Task.create(IP.getPlugin())
- .repeat(generatorOptions.contains(GeneratorOption.INCREASED_TICK_ACCURACY) ? 1 : Config.GENERATION.getInt("advanced.generator-check"))
+ .repeat(1)
.execute(this::tick)
.run();
}
diff --git a/src/main/java/dev/efnilite/ip/leaderboard/Leaderboard.java b/src/main/java/dev/efnilite/ip/leaderboard/Leaderboard.java
index 72bae190..4ce4e1c9 100644
--- a/src/main/java/dev/efnilite/ip/leaderboard/Leaderboard.java
+++ b/src/main/java/dev/efnilite/ip/leaderboard/Leaderboard.java
@@ -2,7 +2,6 @@
import dev.efnilite.ip.IP;
import dev.efnilite.ip.config.Config;
-import dev.efnilite.ip.menu.community.SingleLeaderboardMenu;
import dev.efnilite.ip.storage.Storage;
import dev.efnilite.vilib.util.Task;
import org.jetbrains.annotations.NotNull;
@@ -23,14 +22,14 @@ public class Leaderboard {
/**
* The way in which items will be sorted.
*/
- public final SingleLeaderboardMenu.Sort sort;
+ public final Sort sort;
/**
* A map of all scores for this mode
*/
public final Map scores = new LinkedHashMap<>();
- public Leaderboard(@NotNull String mode, SingleLeaderboardMenu.Sort sort) {
+ public Leaderboard(@NotNull String mode, Sort sort) {
this.mode = mode.toLowerCase();
this.sort = sort;
@@ -89,18 +88,45 @@ private void run(Runnable runnable, boolean async) {
}
}
- // sorts all scores in the map
- private void sort() {
+ /**
+ * Returns sorted copy of the score map.
+ * @param sort The sorting method.
+ * @return A sorted map of scores.
+ */
+ public Map sort(Sort sort) {
LinkedHashMap sorted = new LinkedHashMap<>();
scores.entrySet().stream()
- .sorted((one, two) -> switch (sort) {
- case SCORE -> two.getValue().score() - one.getValue().score();
- case TIME -> two.getValue().getTimeMillis() - one.getValue().getTimeMillis();
- case DIFFICULTY -> (int) Math.signum(Double.parseDouble(two.getValue().difficulty()) - Double.parseDouble(one.getValue().difficulty()));
+ .sorted((one, two) -> {
+ switch (sort) {
+ case SCORE -> {
+ int scoreComparison = two.getValue().score() - one.getValue().score();
+
+ if (scoreComparison != 0) {
+ return scoreComparison;
+ } else {
+ return one.getValue().getTimeMillis() - two.getValue().getTimeMillis();
+ }
+ }
+ case TIME -> {
+ return one.getValue().getTimeMillis() - two.getValue().getTimeMillis();
+ }
+ case DIFFICULTY -> {
+ return (int) Math.signum(Double.parseDouble(two.getValue().difficulty()) -
+ Double.parseDouble(one.getValue().difficulty()));
+ }
+ default -> throw new IllegalArgumentException("Invalid sort method");
+ }
})
.forEachOrdered(entry -> sorted.put(entry.getKey(), entry.getValue()));
+ return sorted;
+ }
+
+ // sorts all scores in the map
+ private void sort() {
+ var sorted = sort(sort);
+
scores.clear();
scores.putAll(sorted);
}
@@ -171,4 +197,8 @@ public Score getScoreAtRank(int rank) {
return new ArrayList<>(scores.values()).get(rank - 1);
}
+
+ public enum Sort {
+ SCORE, TIME, DIFFICULTY
+ }
}
\ No newline at end of file
diff --git a/src/main/java/dev/efnilite/ip/menu/community/LeaderboardsMenu.java b/src/main/java/dev/efnilite/ip/menu/community/LeaderboardsMenu.java
index 1af70b00..2658fad0 100644
--- a/src/main/java/dev/efnilite/ip/menu/community/LeaderboardsMenu.java
+++ b/src/main/java/dev/efnilite/ip/menu/community/LeaderboardsMenu.java
@@ -43,7 +43,7 @@ public void open(Player player) {
}
if (items.size() == 1) {
- Menus.SINGLE_LEADERBOARD.open(player, latest, SingleLeaderboardMenu.Sort.SCORE);
+ Menus.SINGLE_LEADERBOARD.open(player, latest, Leaderboard.Sort.SCORE);
return;
}
diff --git a/src/main/java/dev/efnilite/ip/menu/community/SingleLeaderboardMenu.java b/src/main/java/dev/efnilite/ip/menu/community/SingleLeaderboardMenu.java
index ffd98086..764a4dc9 100644
--- a/src/main/java/dev/efnilite/ip/menu/community/SingleLeaderboardMenu.java
+++ b/src/main/java/dev/efnilite/ip/menu/community/SingleLeaderboardMenu.java
@@ -21,15 +21,17 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
/**
* Menu for a single leaderboard
*/
public class SingleLeaderboardMenu {
- public void open(Player player, Mode mode, Sort sort) {
+ public void open(Player player, Mode mode, Leaderboard.Sort sort) {
Leaderboard leaderboard = mode.getLeaderboard();
if (leaderboard == null) {
@@ -37,19 +39,19 @@ public void open(Player player, Mode mode, Sort sort) {
}
// init vars
- ParkourUser user = ParkourUser.getUser(player);
- String locale = user == null ? Option.OPTIONS_DEFAULTS.get(ParkourOption.LANG) : user.locale;
- PagedMenu menu = new PagedMenu(3, Locales.getString(player, "%s.name".formatted(ParkourOption.LEADERBOARDS.path)));
+ var user = ParkourUser.getUser(player);
+ var locale = user == null ? Option.OPTIONS_DEFAULTS.get(ParkourOption.LANG) : user.locale;
+ var menu = new PagedMenu(3, Locales.getString(player, "%s.name".formatted(ParkourOption.LEADERBOARDS.path)));
- List