Functions with custom commands fail to load with Spigot 1.16
See original GitHub issueCommandAPI version v3.2
Minecraft version 1.16.1, affecting both Spigot and Paper (tested on Paper-90 and Paper-1)
Describe the bug Functions that have commands created by the API do not load properly, acting as though the command does not exist. /execute and chat commands work properly.
Given error:
[18:44:22 ERROR]: Failed to load function test:hi
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Whilst parsing command on line 2: Unknown or incomplete command, see below for error at position 0: <--[HERE]
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314) ~[?:?]
at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319) ~[?:?]
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1766) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) [?:?]
at java.lang.Thread.run(Thread.java:832) [?:?]
Caused by: java.lang.IllegalArgumentException: Whilst parsing command on line 2: Unknown or incomplete command, see below for error at position 0: <--[HERE]
at net.minecraft.server.v1_16_R1.CustomFunction.a(CustomFunction.java:69) ~[patched_1.16.1.jar:git-Paper-90]
at net.minecraft.server.v1_16_R1.CustomFunctionManager.a(SourceFile:84) ~[patched_1.16.1.jar:git-Paper-90]
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1764) ~[?:?]
... 3 more
My code This code (copied from documentation) reproduces the behavior:
public void onLoad() {
new CommandAPICommand("killall")
.executes((sender, args) -> {
//Kills all enemies in all worlds
Bukkit.getWorlds().forEach(w -> w.getLivingEntities().forEach(e -> e.setHealth(0)));
})
.register();
}
function test:hi
say hi
killall
Expected behavior The function loads properly and successfully recognizes the commands.
Additional context In 1.14.4 and 1.15.2, Paper does load the function properly. The difference seems to be that Spigot 1.16 switched the startup sequence so that data packs load before plugins. Maybe that means that an issue should be reported to Spigot but I wanted to see if something could be done within the API first.
/minecraft:reload still errors, even after commands have been registered.
Issue Analytics
- State:
- Created 3 years ago
- Comments:20 (13 by maintainers)
I have the
java.lang.NoSuchFieldException: modifiers
problem too. I have seen this before in plugins, and it usually means you’re trying to use reflection to make something non-final. This happens on Java 12+. A workaround is found here: https://stackoverflow.com/a/56043252/8584806Oh, you shouldn’t have to use multi-release jars to solve this. As I said, I’ve seen this before with other projects, and the solution did not require anything requiring multi-release jars, and worked with java 8, as well as new java versions. I’ll get back to you tomorrow with more details.