[SPIGOT-4044] Datapack load errors and erroneous behavior Created: 18/Jul/18  Updated: 06/Aug/18  Resolved: 19/Jul/18

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Blake Zimmerman Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: Spigot, error
Environment:

Java 8


Attachments: Zip Archive test.zip    
Version: Spigot 1.13-pre7 - API 1.13-pre7-R0.1-SNAPSHOT (git-Spigot-83d9209-3e5fe3e)

 Description   

When loading a world with a datapack, the datapack fails to load any .mcfunction file with commands in it with the following error:

[05:01:50 ERROR]: Couldn't load function at dmz:functions/_give/pickaxe/torchwood.mcfunction
java.util.concurrent.CompletionException: java.lang.NullPointerException
 at java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source) ~[?:1.8.0_172]
 at java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source) [?:1.8.0_172]
 at java.util.concurrent.CompletableFuture.uniApply(Unknown Source) [?:1.8.0_172]
 at java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source) [?:1.8.0_172]
 at java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source) [?:1.8.0_172]
 at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) [?:1.8.0_172]
 at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source) [?:1.8.0_172]
 at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) [?:1.8.0_172]
 at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) [?:1.8.0_172]
Caused by: java.lang.NullPointerException
 at net.minecraft.server.v1_13_R1.CommandListenerWrapper.hasPermission(CommandListenerWrapper.java:126) ~[server.jar:git-Spigot-83d9d09-3e5fe3e]
 at net.minecraft.server.v1_13_R1.CommandGive.a(SourceFile:30) ~[server.jar:git-Spigot-83d9d09-3e5fe3e]
 at com.mojang.brigadier.tree.CommandNode.canUse(CommandNode.java:71) ~[server.jar:git-Spigot-83d9d09-3e5fe3e]
 at com.mojang.brigadier.CommandDispatcher.parseNodes(CommandDispatcher.java:176) ~[server.jar:git-Spigot-83d9d09-3e5fe3e]
 at com.mojang.brigadier.CommandDispatcher.parse(CommandDispatcher.java:156) ~[server.jar:git-Spigot-83d9d09-3e5fe3e]
 at net.minecraft.server.v1_13_R1.CustomFunction.a(CustomFunction.java:48) ~[server.jar:git-Spigot-83d9d09-3e5fe3e]
 at net.minecraft.server.v1_13_R1.CustomFunctionData.lambda$3(CustomFunctionData.java:169) ~[server.jar:git-Spigot-83d9d09-3e5fe3e]
 ... 7 more

 

Once in the game I can run

datapack disable "file/pack"

then enable it again and it will load fine.  However, some commands do not run within the datapack when using Spigot but run fine when not running with Spigot.  Example command:

execute as @s[type=trident,nbt={inGround:1b},tag=!UserTPd] at @s as @a[sort=random,limit=1] if score @s PlayerUID = @e[sort=random,type=trident,limit=1] PlayerUID run tag @s add TridentUser

If I take the command apart and just run the first part up it's okay, like so:

execute as @s[type=trident,nbt={inGround:1b},tag=!UserTPd] at @s as @a[sort=random,limit=1] run say test

And running the second part is fine, like so:

execute if score @s PlayerUID = @e[sort=random,type=trident,limit=1] PlayerUID run say test again

But if the command is run as intended, as one long command, it does not run.  No error is given.

 

These issues do not appear in non Spigot versions of server.jar.

 

Update 1:

Steps to reproduce the issue with the command itself (the command error happens to also occur when run from within the game, so it is not datapack specific) as well as an attached datapack which causes the loading error.

/scoreboard objectives add Test dummy
/scoreboard objectives setdisplay sidebar Test
/summon cow
/scoreboard players set @e[type=cow,sort=nearest,limit=1] Test 5
/scoreboard players set @s Test 5
/execute as @e[type=cow,limit=1] at @s as @a[sort=nearest,limit=1] if score @a[limit=1] Test = @e[sort=nearest,limit=1] Test run say hi

The player should at this point say "hi", but they do not.  If you remove

as @e[type=cow,limit=1] at @s

the command will run as expected.

Update 2:

If you also change it so that it is not looking for an entity, but another player, the command will run as expected.  It seems to be tied to entities running tests within execute.



 Comments   
Comment by Blake Zimmerman [ 18/Jul/18 ]

The command issue that I listed seems related to SPIGOT-4046. Perhaps it's tied directly to how execute is interacting with entities. Too many nests for the command and it doesn't run?

Comment by Blake Zimmerman [ 18/Jul/18 ]

Further testing shows it's a distance issue in regards to an active player.  If you force it to check the cow nearest you, it will run, but if the command is executed in a place where a player is not nearby, it will not run.

Not a distance issue. Still cannot narrow it down.

Comment by Blake Zimmerman [ 18/Jul/18 ]

I apologize, I assumed that given that there was no error when the file was called after successfully re enabling the datapack that I wouldn't be able to provide any extra feedback on what causes the server to seemingly skip the line with the command. The specific command that seems to be failing to run based on the initial execute selector.

In regards to the datapack loading issue, I believed that by stating if you have a datapack that has any function files with commands the error comes up would have offered the chance to reproduce the initial loading issue.

I tested it with a permissions plugin, and denied myself all permissions as well as had others sign on for testing. The functions ran without a permission issue regardless if the player did or did not not have a permission to run the command.

Unless there is no plan for datapack support within Spigot developments future for now, would you like me to upload a test datapack that would provide the same error during loading time?

Comment by md_5 [ 18/Jul/18 ]

Also when reporting bugs you need to provide a MINIMAL reproduction case. I.e. only the essential features that cause the bug

This means it is YOUR responsibility to narrow it down.

Comment by md_5 [ 18/Jul/18 ]

No data pack provided.
Also note that data pack support is not guaranteed on Craftbukkit and vanilla should be used if this is a priority
Craftbukkit provides many enhanced features such as permissions which may not be compatible.

Generated at Sat Apr 05 09:04:15 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.