mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
f5265d6688
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 6ff65c82 SPIGOT-5908: CompassMeta for new lodestone compass data CraftBukkit Changes:3b9cf0f8
Improve code formatting008f039f
SPIGOT-5913: MOTD no longer supports new line characterb8b65eb7
SPIGOT-5908: CompassMeta for new lodestone compass data Spigot Changes: 4d9262cf Rebuild patches d27f7952 SPIGOT-5912: Outdated client message shows outdated server message
30 lines
1.7 KiB
Diff
30 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: virustotalop <virustotalop@gmail.com>
|
|
Date: Thu, 16 Apr 2020 20:51:32 -0700
|
|
Subject: [PATCH] Optimize brigadier child sorting performance
|
|
|
|
|
|
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
|
index 5b305320937eafdabbdc3d41475eb8d1c4b3b324..5e3fc338b0fe69a74465567e69721bc28c64dd17 100644
|
|
--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
|
+++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
|
@@ -27,7 +27,7 @@ import java.util.stream.Collectors;
|
|
import net.minecraft.server.CommandListenerWrapper; // CraftBukkit
|
|
|
|
public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
|
|
- private Map<String, CommandNode<S>> children = Maps.newLinkedHashMap();
|
|
+ private Map<String, CommandNode<S>> children = Maps.newTreeMap(); //Paper - Switch to tree map for automatic sorting
|
|
private Map<String, LiteralCommandNode<S>> literals = Maps.newLinkedHashMap();
|
|
private Map<String, ArgumentCommandNode<S, ?>> arguments = Maps.newLinkedHashMap();
|
|
private final Predicate<S> requirement;
|
|
@@ -107,8 +107,7 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
|
|
arguments.put(node.getName(), (ArgumentCommandNode<S, ?>) node);
|
|
}
|
|
}
|
|
-
|
|
- children = children.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
|
|
+ //Paper - Remove manual sorting, it is no longer needed
|
|
}
|
|
|
|
public void findAmbiguities(final AmbiguityConsumer<S> consumer) {
|