question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Functions with custom commands fail to load with Spigot 1.16

See original GitHub issue

CommandAPI 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:closed
  • Created 3 years ago
  • Comments:20 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
Justsnoopy30commented, Jul 18, 2020

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/8584806

0reactions
Justsnoopy30commented, Jul 22, 2020

Oh, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Functions with custom commands fail to load with Spigot 1.16
The solution isn't perfect, but it does work. When running the server, it will initially throw the error since it cannot be parsed...
Read more >
CustomCommands [1.8-1.16] 2.3.1 - SpigotMC
Custom Commands 2.3.0. Create unlimited commands and sub commands. Easy, Simple, Reliable. This plugin offers fully customizability.
Read more >
Functions & Tags - CommandAPI Documentation v6.4.0
Minecraft 1.16 + change the way that datapacks are loaded on the server, so that they load before plugins are enabled. This means...
Read more >
MyCommand - Bukkit Plugins - Projects
Thank you :D. Make your own, customized Minecraft commands. Features: Make new commands!. (Also registered ...
Read more >
Structure Block - Minecraft Wiki - Fandom
In Bedrock Edition, data mode structure block cannot be obtained with commands. Custom Data Tag Name: The name of the function to run....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found