diff --git a/CHANGELOG.md b/CHANGELOG.md
index f4323be9..dbbe332c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,19 @@
+## 5.4.2 - Drip, drop, drip, drop (06/08/2022)
+
+**Compatible Spigot versions: 1.19.1**
+
+This updates addresses a few breaking bugs
+
+## Commons
+* Fix `ConcurrentModificationException` caused by self-visiting literal aliase still throwing on Spigot
+* Fix commands not being executed due to changes in how Spigot forwards command execution
+
+
## 5.4.1 - Life is your restaurant (06/08/2022)
-**Compatible Spigot versions: 1.19.0, 1.19.1, 1.19.2**
+**Note: DEFECTIVE - DO NOT USE**
+
+**Compatible Spigot versions: 1.19.0**
This update addresses a `ConcurrentModificationException` caused by self-visiting literal aliases.
@@ -10,6 +23,8 @@ This update addresses a `ConcurrentModificationException` caused by self-visitin
## 5.4.0 - When clouds go rolling by (28/06/2022)
+**Note: DEFECTIVE - DO NOT USE**
+
**Compatible Spigot versions: 1.19.0**
This update adds support for Spigot 1.19.0.
diff --git a/README.md b/README.md
index 4fd63493..5e21c5e6 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@
| Chimera Version | Minecraft Version |
|-----------------|-------------------|
-| 5.4.1 | 1.19.0 - 1.19.2 |
+| 5.4.2 | 1.19.1 |
| 5.3.0 | 1.18.2 |
| 5.2.0 | 1.18.0 - 1.18.1 |
| 5.1.0 | 1.17.1 |
@@ -63,7 +63,7 @@
com.karuslabs
annotations
- 5.4.1
+ 5.4.2
```
@@ -76,7 +76,7 @@
com.karuslabs
commons
- 5.4.1
+ 5.4.2
```
@@ -89,6 +89,6 @@
com.karuslabs
typist
- 5.4.1
+ 5.4.2
```
diff --git a/annotations/dependency-reduced-pom.xml b/annotations/dependency-reduced-pom.xml
index 03db9423..9d4263ca 100644
--- a/annotations/dependency-reduced-pom.xml
+++ b/annotations/dependency-reduced-pom.xml
@@ -3,7 +3,7 @@
chimera
com.karuslabs
- 5.4.1
+ 5.4.2-SNAPSHOT
4.0.0
annotations
diff --git a/annotations/pom.xml b/annotations/pom.xml
index acf1b516..3a8f4f7f 100644
--- a/annotations/pom.xml
+++ b/annotations/pom.xml
@@ -4,7 +4,7 @@
com.karuslabs
chimera
- 5.4.1
+ 5.4.2-SNAPSHOT
annotations
diff --git a/commons/dependency-reduced-pom.xml b/commons/dependency-reduced-pom.xml
index de0e476f..df154753 100644
--- a/commons/dependency-reduced-pom.xml
+++ b/commons/dependency-reduced-pom.xml
@@ -3,7 +3,7 @@
chimera
com.karuslabs
- 5.4.1
+ 5.4.2-SNAPSHOT
4.0.0
commons
@@ -30,9 +30,9 @@
remap
- org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:txt:maps-mojang
+ org.spigotmc:minecraft-server:1.19.1-R0.1-SNAPSHOT:txt:maps-mojang
true
- org.spigotmc:spigot:1.19-R0.1-SNAPSHOT:jar:remapped-mojang
+ org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT:jar:remapped-mojang
true
remapped-obf
@@ -45,8 +45,8 @@
${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar
- org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:csrg:maps-spigot
- org.spigotmc:spigot:1.19-R0.1-SNAPSHOT:jar:remapped-obf
+ org.spigotmc:minecraft-server:1.19.1-R0.1-SNAPSHOT:csrg:maps-spigot
+ org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT:jar:remapped-obf
@@ -75,20 +75,20 @@
org.spigotmc
spigot
- 1.19-R0.1-SNAPSHOT
+ 1.19.1-R0.1-SNAPSHOT
remapped-mojang
provided
com.mojang
brigadier
- 1.0.17
+ 1.0.18
provided
org.junit.jupiter
junit-jupiter-api
- 5.8.2
+ 5.9.0
test
@@ -108,7 +108,7 @@
org.junit.jupiter
junit-jupiter-engine
- 5.8.2
+ 5.9.0
test
@@ -124,7 +124,7 @@
org.junit.jupiter
junit-jupiter-params
- 5.8.2
+ 5.9.0
test
diff --git a/commons/pom.xml b/commons/pom.xml
index 0a410096..a3b989b5 100644
--- a/commons/pom.xml
+++ b/commons/pom.xml
@@ -4,7 +4,7 @@
com.karuslabs
chimera
- 5.4.1
+ 5.4.2-SNAPSHOT
commons
@@ -24,7 +24,7 @@
org.spigotmc
spigot
- 1.19-R0.1-SNAPSHOT
+ 1.19.1-R0.1-SNAPSHOT
remapped-mojang
provided
@@ -32,7 +32,7 @@
com.mojang
brigadier
- 1.0.17
+ 1.0.18
provided
@@ -59,9 +59,9 @@
remap-obf
- org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:txt:maps-mojang
+ org.spigotmc:minecraft-server:1.19.1-R0.1-SNAPSHOT:txt:maps-mojang
true
- org.spigotmc:spigot:1.19-R0.1-SNAPSHOT:jar:remapped-mojang
+ org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT:jar:remapped-mojang
true
remapped-obf
@@ -74,8 +74,8 @@
remap-spigot
${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar
- org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:csrg:maps-spigot
- org.spigotmc:spigot:1.19-R0.1-SNAPSHOT:jar:remapped-obf
+ org.spigotmc:minecraft-server:1.19.1-R0.1-SNAPSHOT:csrg:maps-spigot
+ org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT:jar:remapped-obf
diff --git a/commons/src/main/java/com/karuslabs/commons/command/dispatcher/DispatcherCommand.java b/commons/src/main/java/com/karuslabs/commons/command/dispatcher/DispatcherCommand.java
index 24020f59..2f51eea1 100644
--- a/commons/src/main/java/com/karuslabs/commons/command/dispatcher/DispatcherCommand.java
+++ b/commons/src/main/java/com/karuslabs/commons/command/dispatcher/DispatcherCommand.java
@@ -39,6 +39,10 @@
*
* Note:
* This class was adapted from Spigot's {@code VanillaCommand}.
+ *
+ * As of 1.19, only commands from console are forwarded to a {@code DispatcherCommand}.
+ * Commands issued by players are routed directly to the native {@code CommandDispatcher}.
+ * This behaviour is weird as fuck.
*/
public class DispatcherCommand extends Command implements PluginIdentifiableCommand {
diff --git a/commons/src/main/java/com/karuslabs/commons/command/dispatcher/SpigotMapper.java b/commons/src/main/java/com/karuslabs/commons/command/dispatcher/SpigotMapper.java
index 93e4752c..99accfb3 100644
--- a/commons/src/main/java/com/karuslabs/commons/command/dispatcher/SpigotMapper.java
+++ b/commons/src/main/java/com/karuslabs/commons/command/dispatcher/SpigotMapper.java
@@ -27,7 +27,7 @@
import com.karuslabs.commons.command.tree.Mapper;
import com.karuslabs.commons.command.types.Type;
-import com.mojang.brigadier.CommandDispatcher;
+import com.mojang.brigadier.*;
import com.mojang.brigadier.arguments.ArgumentType;
import com.mojang.brigadier.suggestion.SuggestionProvider;
import com.mojang.brigadier.tree.*;
@@ -45,6 +45,10 @@
/**
* A mapper that maps the commands in a {@link Dispatcher} to the internal dispatcher
* of the server.
+ *
+ * As of 1.19, only commands from console are forwarded to a {@code DispatcherCommand}.
+ * Commands issued by players are routed directly to the native {@code CommandDispatcher}.
+ * This behaviour is weird as fuck. We previously only mapped completion related information.
*/
class SpigotMapper extends Mapper {
@@ -80,6 +84,23 @@ protected ArgumentType> type(ArgumentCommandNode command) {
return type instanceof Type> mappable ? mappable.mapped() : type;
}
+ @Override
+ protected Command execution(CommandNode command) {
+ return reparse(command);
+ }
+
+ Command reparse(CommandNode command) {
+ return (context) -> {
+ var sender = context.getSource().getBukkitSender();
+
+ var input = context.getInput();
+ input = input.length() <= 1 ? "" : input.substring(1);
+
+ var reparsed = dispatcher.parse(input, sender).getContext().build(context.getInput());
+ return command.getCommand().run(reparsed);
+ };
+ }
+
/**
* Wraps the requirement of the given command in a predicate that transforms
* a {@code CommandListenerWrapper} into a {@code CommandSender}.
diff --git a/commons/src/main/java/com/karuslabs/commons/command/tree/TreeWalker.java b/commons/src/main/java/com/karuslabs/commons/command/tree/TreeWalker.java
index 8e4ed085..c710ce7a 100644
--- a/commons/src/main/java/com/karuslabs/commons/command/tree/TreeWalker.java
+++ b/commons/src/main/java/com/karuslabs/commons/command/tree/TreeWalker.java
@@ -132,7 +132,7 @@ public void add(RootCommandNode root, Collection extends CommandNode> co
redirect(command.getRedirect(), result, source);
descend(command.getChildren(), result, source);
}
-
+
return result;
}
diff --git a/commons/src/main/java/com/karuslabs/commons/command/tree/nodes/Nodes.java b/commons/src/main/java/com/karuslabs/commons/command/tree/nodes/Nodes.java
index 5dca2c8d..51ac3d23 100644
--- a/commons/src/main/java/com/karuslabs/commons/command/tree/nodes/Nodes.java
+++ b/commons/src/main/java/com/karuslabs/commons/command/tree/nodes/Nodes.java
@@ -114,6 +114,10 @@ public B optionally(CommandNode node) {
*/
static & Mutable, T> void addChild(Node node, CommandNode child, Consumer> addition) {
var current = node.getChild(child.getName());
+ if (current == child) { // Don't visit again if node is itself, will cause CMEs
+ return;
+ }
+
if (current != null) {
node.removeChild(current.getName()); // Needs to be removed otherwise child will not replace current
@@ -133,9 +137,7 @@ static & Mutable, T> void addChild(Node node, Co
var aliases = ((Aliasable) child).aliases();
for (var alias : aliases) {
- if (node.getChild(alias.getName()) == null) {
- addition.accept(alias);
- }
+ addition.accept(alias);
}
if (current != null) {
diff --git a/commons/src/test/java/com/karuslabs/commons/MockServer.java b/commons/src/test/java/com/karuslabs/commons/MockServer.java
index fb5e663b..7819147b 100644
--- a/commons/src/test/java/com/karuslabs/commons/MockServer.java
+++ b/commons/src/test/java/com/karuslabs/commons/MockServer.java
@@ -766,5 +766,10 @@ public boolean isEnforcingSecureProfiles() {
public int getMaxChainedNeighborUpdates() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
+
+ @Override
+ public Registry getRegistry(Class type) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
}
diff --git a/pom.xml b/pom.xml
index ecbb487f..ed20a629 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.karuslabs
chimera
- 5.4.1
+ 5.4.2-SNAPSHOT
pom
Chimera
diff --git a/typist-example-plugin/dependency-reduced-pom.xml b/typist-example-plugin/dependency-reduced-pom.xml
index a61dbb49..cb5f93f3 100644
--- a/typist-example-plugin/dependency-reduced-pom.xml
+++ b/typist-example-plugin/dependency-reduced-pom.xml
@@ -3,7 +3,7 @@
chimera
com.karuslabs
- 5.4.1
+ 5.4.2-SNAPSHOT
4.0.0
typist-example-plugin
@@ -57,6 +57,13 @@
+
+ org.spigotmc
+ spigot
+ 1.19.1-R0.1-SNAPSHOT
+ remapped-mojang
+ provided
+
com.mojang
brigadier
@@ -72,7 +79,7 @@
org.junit.jupiter
junit-jupiter-api
- 5.8.2
+ 5.9.0
test
@@ -92,7 +99,7 @@
org.junit.jupiter
junit-jupiter-engine
- 5.8.2
+ 5.9.0
test
@@ -108,7 +115,7 @@
org.junit.jupiter
junit-jupiter-params
- 5.8.2
+ 5.9.0
test
diff --git a/typist-example-plugin/pom.xml b/typist-example-plugin/pom.xml
index e83dba7a..c307e9af 100644
--- a/typist-example-plugin/pom.xml
+++ b/typist-example-plugin/pom.xml
@@ -4,7 +4,7 @@
com.karuslabs
chimera
- 5.4.1
+ 5.4.2-SNAPSHOT
typist-example-plugin
@@ -36,6 +36,14 @@
+
+ org.spigotmc
+ spigot
+ 1.19.1-R0.1-SNAPSHOT
+ remapped-mojang
+ provided
+
+
com.mojang
brigadier
diff --git a/typist/dependency-reduced-pom.xml b/typist/dependency-reduced-pom.xml
index 74ecc769..71679d38 100644
--- a/typist/dependency-reduced-pom.xml
+++ b/typist/dependency-reduced-pom.xml
@@ -3,7 +3,7 @@
chimera
com.karuslabs
- 5.4.1
+ 5.4.2-SNAPSHOT
4.0.0
typist
@@ -72,7 +72,7 @@
com.karuslabs
commons
- 5.4.1
+ 5.4.2-SNAPSHOT
provided
diff --git a/typist/pom.xml b/typist/pom.xml
index 9cdc62a4..299f6b20 100644
--- a/typist/pom.xml
+++ b/typist/pom.xml
@@ -4,7 +4,7 @@
com.karuslabs
chimera
- 5.4.1
+ 5.4.2-SNAPSHOT
typist