Skip to content

Commit

Permalink
Prepare for 5.4.2-SNAPSHOT
Browse files Browse the repository at this point in the history
  • Loading branch information
Pante committed Aug 6, 2022
1 parent df6397d commit ca8ea41
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 38 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -63,7 +63,7 @@
<dependency>
<groupId>com.karuslabs</groupId>
<artifactId>annotations</artifactId>
<version>5.4.1</version>
<version>5.4.2</version>
</dependency>
```

Expand All @@ -76,7 +76,7 @@
<dependency>
<groupId>com.karuslabs</groupId>
<artifactId>commons</artifactId>
<version>5.4.1</version>
<version>5.4.2</version>
</dependency>
```

Expand All @@ -89,6 +89,6 @@
<dependency>
<groupId>com.karuslabs</groupId>
<artifactId>typist</artifactId>
<version>5.4.1</version>
<version>5.4.2</version>
</dependency>
```
2 changes: 1 addition & 1 deletion annotations/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>chimera</artifactId>
<groupId>com.karuslabs</groupId>
<version>5.4.1</version>
<version>5.4.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>annotations</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.karuslabs</groupId>
<artifactId>chimera</artifactId>
<version>5.4.1</version>
<version>5.4.2-SNAPSHOT</version>
</parent>

<artifactId>annotations</artifactId>
Expand Down
20 changes: 10 additions & 10 deletions commons/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>chimera</artifactId>
<groupId>com.karuslabs</groupId>
<version>5.4.1</version>
<version>5.4.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>commons</artifactId>
Expand All @@ -30,9 +30,9 @@
<goal>remap</goal>
</goals>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<srgIn>org.spigotmc:minecraft-server:1.19.1-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.19-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedDependencies>org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
Expand All @@ -45,8 +45,8 @@
</goals>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.19-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
<srgIn>org.spigotmc:minecraft-server:1.19.1-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
Expand Down Expand Up @@ -75,20 +75,20 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<version>1.19.1-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
<version>1.0.17</version>
<version>1.0.18</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.2</version>
<version>5.9.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand All @@ -108,7 +108,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.2</version>
<version>5.9.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand All @@ -124,7 +124,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.8.2</version>
<version>5.9.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand Down
14 changes: 7 additions & 7 deletions commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.karuslabs</groupId>
<artifactId>chimera</artifactId>
<version>5.4.1</version>
<version>5.4.2-SNAPSHOT</version>
</parent>

<artifactId>commons</artifactId>
Expand All @@ -24,15 +24,15 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<version>1.19.1-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
<version>1.0.17</version>
<version>1.0.18</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand All @@ -59,9 +59,9 @@
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<srgIn>org.spigotmc:minecraft-server:1.19.1-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.19-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedDependencies>org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
Expand All @@ -74,8 +74,8 @@
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.19-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
<srgIn>org.spigotmc:minecraft-server:1.19.1-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
* <br><br>
* <b>Note:</b><br>
* 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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand All @@ -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<CommandSender, CommandSourceStack> {

Expand Down Expand Up @@ -80,6 +84,23 @@ protected ArgumentType<?> type(ArgumentCommandNode<CommandSender, ?> command) {
return type instanceof Type<?> mappable ? mappable.mapped() : type;
}

@Override
protected Command<CommandSourceStack> execution(CommandNode<CommandSender> command) {
return reparse(command);
}

Command<CommandSourceStack> reparse(CommandNode<CommandSender> 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}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void add(RootCommandNode<R> root, Collection<? extends CommandNode<T>> co
redirect(command.getRedirect(), result, source);
descend(command.getChildren(), result, source);
}

return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ public B optionally(CommandNode<T> node) {
*/
static <Node extends CommandNode<T> & Mutable<T>, T> void addChild(Node node, CommandNode<T> child, Consumer<CommandNode<T>> 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

Expand All @@ -133,9 +137,7 @@ static <Node extends CommandNode<T> & Mutable<T>, T> void addChild(Node node, Co
var aliases = ((Aliasable<T>) child).aliases();

for (var alias : aliases) {
if (node.getChild(alias.getName()) == null) {
addition.accept(alias);
}
addition.accept(alias);
}

if (current != null) {
Expand Down
5 changes: 5 additions & 0 deletions commons/src/test/java/com/karuslabs/commons/MockServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 <T extends Keyed> Registry<T> getRegistry(Class<T> type) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.karuslabs</groupId>
<artifactId>chimera</artifactId>
<version>5.4.1</version>
<version>5.4.2-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Chimera</name>
Expand Down
15 changes: 11 additions & 4 deletions typist-example-plugin/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>chimera</artifactId>
<groupId>com.karuslabs</groupId>
<version>5.4.1</version>
<version>5.4.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>typist-example-plugin</artifactId>
Expand Down Expand Up @@ -57,6 +57,13 @@
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.1-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
Expand All @@ -72,7 +79,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.2</version>
<version>5.9.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand All @@ -92,7 +99,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.2</version>
<version>5.9.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand All @@ -108,7 +115,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.8.2</version>
<version>5.9.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand Down
10 changes: 9 additions & 1 deletion typist-example-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.karuslabs</groupId>
<artifactId>chimera</artifactId>
<version>5.4.1</version>
<version>5.4.2-SNAPSHOT</version>
</parent>

<artifactId>typist-example-plugin</artifactId>
Expand Down Expand Up @@ -36,6 +36,14 @@
</repositories>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.1-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
Expand Down
Loading

0 comments on commit ca8ea41

Please sign in to comment.