henkelmax / audio-player

Put your own audio files on music discs!
54 stars 17 forks source link

audioplayer play and stop commands don't work in functions #70

Closed SmajloSlovakian closed 6 months ago

SmajloSlovakian commented 6 months ago

tested on

i also have another server with more mods (mainly optimization mods and some utilities like worldedit and more) and command blocks seem to not work as well (similarly to https://github.com/henkelmax/audio-player/issues/62)

datapack for testing: test.zip

to see if it works, look in the log after /reload or try to type in chat /function audioplayer:test - if autocompletion works, it most probably works

Console log when loading the function from datapack:

[20:19:39] [Server thread/ERROR]: Failed to load function audioplayer:test java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "net.minecraft.server.MinecraftServer.method_21714()" because the return value of "net.minecraft.class_2168.method_9211()" is null at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ~[?:?] at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ~[?:?] at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770) ~[?:?] at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ~[?:?] at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.server.MinecraftServer.method_21714()" because the return value of "net.minecraft.class_2168.method_9211()" is null at de.maxhenkel.audioplayer.AudioPlayerPermissionManager.hasPermission(AudioPlayerPermissionManager.java:39) ~[audioplayer-fabric-1.20.4-1.8.6.jar:?] at de.maxhenkel.audioplayer.AudioPlayerPermissionManager.hasPermission(AudioPlayerPermissionManager.java:13) ~[audioplayer-fabric-1.20.4-1.8.6.jar:?] at de.maxhenkel.admiral.impl.permissions.PermissionNode.hasPermission(PermissionNode.java:25) ~[admiral-0.4.4+1.20.4-18d14e3e2c3ec76b.jar:?] at de.maxhenkel.admiral.impl.AdmiralMethod.lambda$permission$2(AdmiralMethod.java:122) ~[admiral-0.4.4+1.20.4-18d14e3e2c3ec76b.jar:?] at java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90) ~[?:?] at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1602) ~[?:?] at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129) ~[?:?] at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527) ~[?:?] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513) ~[?:?] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?] at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230) ~[?:?] at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196) ~[?:?] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?] at java.util.stream.ReferencePipeline.allMatch(ReferencePipeline.java:637) ~[?:?] at de.maxhenkel.admiral.impl.AdmiralMethod.lambda$permission$3(AdmiralMethod.java:122) ~[admiral-0.4.4+1.20.4-18d14e3e2c3ec76b.jar:?] at java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90) ~[?:?] at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1602) ~[?:?] at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129) ~[?:?] at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527) ~[?:?] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513) ~[?:?] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?] at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230) ~[?:?] at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196) ~[?:?] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?] at java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:632) ~[?:?] at de.maxhenkel.admiral.impl.AdmiralMethod.lambda$permission$4(AdmiralMethod.java:122) ~[admiral-0.4.4+1.20.4-18d14e3e2c3ec76b.jar:?] at com.mojang.brigadier.tree.CommandNode.canUse(CommandNode.java:65) ~[brigadier-1.2.9.jar:?] at com.mojang.brigadier.CommandDispatcher.parseNodes(CommandDispatcher.java:301) ~[brigadier-1.2.9.jar:?] at com.mojang.brigadier.CommandDispatcher.parseNodes(CommandDispatcher.java:335) ~[brigadier-1.2.9.jar:?] at com.mojang.brigadier.CommandDispatcher.parse(CommandDispatcher.java:291) ~[brigadier-1.2.9.jar:?] at net.minecraft.class_2158.method_54417(class_2158.java:85) ~[server-intermediary.jar:?] at net.minecraft.class_2158.method_9195(class_2158.java:74) ~[server-intermediary.jar:?] at net.minecraft.class_5349.method_29451(class_5349.java:83) ~[server-intermediary.jar:?] at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?] ... 6 more

Notes:

the commands also don't work on command blocks for whatever reason with this mod config on the same server software:

SmajloSlovakian commented 6 months ago

there is a workaround: you can make the line inside that function a macro line... this makes it so that the line isn't parsed when loading the function but at every* call of the function and it seems to work then

henkelmax commented 6 months ago

Thank you for reporting this issue! This should be fixed in the next version.