EffPlaySound fails on Spigot server when another plugin implements AdventureAPI
ShaneBeee opened this issue ยท 3 comments
Skript/Server Version
[Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
[Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
[Skript] Server Version: 4404-Spigot-33ece3e-d628417 (MC: 1.21.4)
[Skript] Skript Version: 2.9.5 (skriptlang-github)
[Skript] Installed Skript Addons:
[Skript] - skript-reflect v2.5.1 (https://github.com/SkriptLang/skript-reflect)
[Skript] - SkBee v3.6.5 (https://github.com/SkriptHub/SkBee)
[Skript] - SkBriggy v1.4.3 (https://github.com/ShaneBeee/SkBriggy)
[Skript] Installed dependencies:
[Skript] - Vault v1.7.3-b131
Bug Description
When running a Spigot server, the adventure API is obviously missing.
Some plugins will implement the AdventureAPI, which can cause some issues.
For example, in ch.njol.skript.bukkitutil.sounds.SoundReceiver
there is this field:
boolean ADVENTURE_API = Skript.classExists("net.kyori.adventure.sound.Sound$Builder");
If another plugin has implemented AdventureAPI, this will result in this field being true.
But when running the play sound effect, we get the following error:
IncompatibleClassChangeError: Class org.bukkit.SoundCategory does not implement the requested interface net.kyori.adventure.sound.Sound$Source$Provider
That is because the Bukkit class doesn't implement the adventure class (that paper does)
Expected Behavior
For the error to not happen, and the sound to play!
Steps to Reproduce
- start up a server on Spigot
- make sure to have another plugin with AdventureAPI implemented (I can provide one if need be)
- Login
- run play sound, ex:
play sound "test"
- get error
- profit!
Errors or Screenshots
Longer version of the error:
[13:43:54] [Async Chat Thread - #1/ERROR]: Could not pass event AsyncPlayerChatEvent to Skript v2.9.5
org.bukkit.event.EventException: null
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-api-1.21.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot-api-1.21.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:601) ~[spigot-api-1.21.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:588) ~[spigot-api-1.21.4-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.network.PlayerConnection.chat(PlayerConnection.java:2111) ~[spigot-1.21.4-R0.1-SNAPSHOT.jar:4404-Spigot-33ece3e-d628417]
at net.minecraft.server.network.PlayerConnection.b(PlayerConnection.java:2233) ~[spigot-1.21.4-R0.1-SNAPSHOT.jar:4404-Spigot-33ece3e-d628417]
at net.minecraft.server.network.PlayerConnection.lambda$handleChat$5(PlayerConnection.java:1889) ~[spigot-1.21.4-R0.1-SNAPSHOT.jar:4404-Spigot-33ece3e-d628417]
at net.minecraft.util.FutureChain.a(SourceFile:30) ~[spigot-1.21.4-R0.1-SNAPSHOT.jar:4404-Spigot-33ece3e-d628417]
at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?]
at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Boolean.booleanValue()" because the return value of "java.util.concurrent.Future.get()" is null
at ch.njol.skript.command.Commands$2.onPlayerChat(Commands.java:313) ~[?:?]
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.21.4-R0.1-SNAPSHOT.jar:?]
... 12 more
[13:43:54] [Server thread/WARN]: [Skript] Task #18 for Skript v2.9.5 generated an exception
java.lang.IncompatibleClassChangeError: Class org.bukkit.SoundCategory does not implement the requested interface net.kyori.adventure.sound.Sound$Source$Provider
at net.kyori.adventure.sound.SoundImpl$BuilderImpl.source(SoundImpl.java:181) ~[?:?]
at ch.njol.skript.bukkitutil.sounds.AdventureSoundUtils.getAdventureSound(AdventureSoundUtils.java:17) ~[?:?]
at ch.njol.skript.bukkitutil.sounds.AdventureSoundUtils.playSound(AdventureSoundUtils.java:43) ~[?:?]
at ch.njol.skript.bukkitutil.sounds.SoundReceiver$PlayerSoundReceiver.playSound(SoundReceiver.java:46) ~[?:?]
at ch.njol.skript.effects.EffPlaySound.execute(EffPlaySound.java:189) ~[?:?]
at ch.njol.skript.lang.Effect.run(Effect.java:49) ~[?:?]
at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61) ~[?:?]
at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:88) ~[?:?]
at ch.njol.skript.command.Commands.handleEffectCommand(Commands.java:210) ~[?:?]
at ch.njol.skript.command.Commands$2.lambda$onPlayerChat$0(Commands.java:309) ~[?:?]
at org.bukkit.craftbukkit.v1_21_R3.scheduler.CraftFuture.run(CraftFuture.java:88) ~[spigot-1.21.4-R0.1-SNAPSHOT.jar:4404-Spigot-33ece3e-d628417]
at org.bukkit.craftbukkit.v1_21_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:415) ~[spigot-1.21.4-R0.1-SNAPSHOT.jar:4404-Spigot-33ece3e-d628417]
at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:1502) ~[spigot-1.21.4-R0.1-SNAPSHOT.jar:4404-Spigot-33ece3e-d628417]
at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1391) ~[spigot-1.21.4-R0.1-SNAPSHOT.jar:4404-Spigot-33ece3e-d628417]
at net.minecraft.server.MinecraftServer.y(MinecraftServer.java:1093) ~[spigot-1.21.4-R0.1-SNAPSHOT.jar:4404-Spigot-33ece3e-d628417]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:329) ~[spigot-1.21.4-R0.1-SNAPSHOT.jar:4404-Spigot-33ece3e-d628417]
at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
[13:43:54] [Async Chat Thread - #1/INFO]: [Not Secure] <ShaneBee> !play sound "test"
Other
No response
Agreement
- I have read the guidelines above and affirm I am following them with this report.
We might be able to try some different checks, but I would think that any plugins shading Adventure API ought to relocate it.
is this related to #7158?
is this related to #7158?
doesn't appear to be related.