Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skript loads everything for some reason tries to call a class that isn't there even if it wouldn't be used #127

Open
Blazin3330 opened this issue Dec 16, 2024 · 6 comments

Comments

@Blazin3330
Copy link

Blazin3330 commented Dec 16, 2024

Describe the bug
Skript loads everything for some reason tries to call a class that isn't there even if it wouldn't be used

To reproduce
`import:
com.nexomc.nexo.api.NexoItems

command /test:
trigger:
set {_item} to NexoItems.itemFromId("nexo-item").build()`

Expected behavior
Should use the 1.21.3 class but instead uses the 1.21.4 class...
As it loads everything, it throws an error

Server information

  • skript-reflect: 2.5.1
  • Skript: 2.9.5
  • Paper: 1.21.3-81-master@da71382
  • Minecraft: 1.21.3
  • Java: Java 21
  • OS: Windows 10

Additional context
I have asked Nexo about this, the owner (Boy) confirms it is a Skript issue

Error message:
[18:41:32 ERROR]: Command exception: /test
org.bukkit.command.CommandException: Unhandled exception executing command 'test' in plugin Skript v2.9.5
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.21.3-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.command.brigadier.bukkit.BukkitCommandNode$BukkitBrigCommand.run(BukkitCommandNode.java:82) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73) ~[brigadier-1.3.10.jar:?]
at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:31) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:19) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.commands.execution.UnboundEntryAction.lambda$bind$0(UnboundEntryAction.java:8) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.commands.execution.CommandQueueEntry.execute(CommandQueueEntry.java:5) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.commands.execution.ExecutionContext.runCommandQueue(ExecutionContext.java:103) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.commands.Commands.executeCommandInContext(Commands.java:448) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.commands.Commands.performCommand(Commands.java:355) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.commands.Commands.performCommand(Commands.java:342) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.commands.Commands.performCommand(Commands.java:337) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.server.network.ServerGamePacketListenerImpl.performUnsignedChatCommand(ServerGamePacketListenerImpl.java:2241) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$11(ServerGamePacketListenerImpl.java:2215) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:154) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1578) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:207) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:128) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1555) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1548) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:138) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.server.MinecraftServer.managedBlock(MinecraftServer.java:1499) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1509) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1345) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:340) ~[paper-1.21.3.jar:1.21.3-81-da71382]
at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.NoClassDefFoundError: org/bukkit/inventory/meta/components/CustomModelDataComponent
at java.base/java.lang.Class.getDeclaredMethods0(Native Method) ~[?:?]
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3578) ~[?:?]
at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3603) ~[?:?]
at java.base/java.lang.Class.getMethods(Class.java:2185) ~[?:?]
at skript-reflect-2.5.1.jar/com.btk5h.skriptmirror.util.JavaUtil.methods(JavaUtil.java:80) ~[skript-reflect-2.5.1.jar:?]
at skript-reflect-2.5.1.jar/com.btk5h.skriptmirror.skript.reflect.ExprJavaCall.createCallSite(ExprJavaCall.java:406) ~[skript-reflect-2.5.1.jar:?]
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1228) ~[?:?]
at skript-reflect-2.5.1.jar/com.btk5h.skriptmirror.skript.reflect.ExprJavaCall.getCallSite(ExprJavaCall.java:366) ~[skript-reflect-2.5.1.jar:?]
at skript-reflect-2.5.1.jar/com.btk5h.skriptmirror.skript.reflect.ExprJavaCall.findCompatibleMethod(ExprJavaCall.java:566) ~[skript-reflect-2.5.1.jar:?]
at skript-reflect-2.5.1.jar/com.btk5h.skriptmirror.skript.reflect.ExprJavaCall.invoke(ExprJavaCall.java:469) ~[skript-reflect-2.5.1.jar:?]
at skript-reflect-2.5.1.jar/com.btk5h.skriptmirror.skript.reflect.ExprJavaCall.getSingle(ExprJavaCall.java:228) ~[skript-reflect-2.5.1.jar:?]
at skript-reflect-2.5.1.jar/com.btk5h.skriptmirror.skript.reflect.ExprJavaCall.getArray(ExprJavaCall.java:233) ~[skript-reflect-2.5.1.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.expressions.base.PropertyExpression.get(PropertyExpression.java:88) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.util.SimpleExpression.getArray(SimpleExpression.java:97) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.effects.EffBroadcast.execute(EffBroadcast.java:117) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.Effect.run(Effect.java:49) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:88) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.Trigger.execute(Trigger.java:52) ~[Skript-2.9.5.jar:?]
at skript-reflect-2.5.1.jar/org.skriptlang.reflect.syntax.expression.elements.CustomExpression.getByStandard(CustomExpression.java:100) ~[skript-reflect-2.5.1.jar:?]
at skript-reflect-2.5.1.jar/org.skriptlang.reflect.syntax.expression.elements.CustomExpression.getAll(CustomExpression.java:94) ~[skript-reflect-2.5.1.jar:?]
at skript-reflect-2.5.1.jar/org.skriptlang.reflect.syntax.expression.elements.CustomExpression.getArray(CustomExpression.java:75) ~[skript-reflect-2.5.1.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.effects.EffChange.execute(EffChange.java:284) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.Effect.run(Effect.java:49) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:88) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.Trigger.execute(Trigger.java:52) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:345) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.command.ScriptCommand.lambda$execute$0(ScriptCommand.java:304) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:315) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.command.ScriptCommand.onCommand(ScriptCommand.java:250) ~[Skript-2.9.5.jar:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.21.3-R0.1-SNAPSHOT.jar:?]
... 27 more
Caused by: java.lang.ClassNotFoundException: org.bukkit.inventory.meta.components.CustomModelDataComponent
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:197) ~[paper-api-1.21.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:164) ~[paper-api-1.21.3-R0.1-SNAPSHOT.jar:?]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?]
at java.base/java.lang.Class.getDeclaredMethods0(Native Method) ~[?:?]
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3578) ~[?:?]
at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3603) ~[?:?]
at java.base/java.lang.Class.getMethods(Class.java:2185) ~[?:?]
at skript-reflect-2.5.1.jar/com.btk5h.skriptmirror.util.JavaUtil.methods(JavaUtil.java:80) ~[skript-reflect-2.5.1.jar:?]
at skript-reflect-2.5.1.jar/com.btk5h.skriptmirror.skript.reflect.ExprJavaCall.createCallSite(ExprJavaCall.java:406) ~[skript-reflect-2.5.1.jar:?]
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1228) ~[?:?]
at skript-reflect-2.5.1.jar/com.btk5h.skriptmirror.skript.reflect.ExprJavaCall.getCallSite(ExprJavaCall.java:366) ~[skript-reflect-2.5.1.jar:?]
at skript-reflect-2.5.1.jar/com.btk5h.skriptmirror.skript.reflect.ExprJavaCall.findCompatibleMethod(ExprJavaCall.java:566) ~[skript-reflect-2.5.1.jar:?]
at skript-reflect-2.5.1.jar/com.btk5h.skriptmirror.skript.reflect.ExprJavaCall.invoke(ExprJavaCall.java:469) ~[skript-reflect-2.5.1.jar:?]
at skript-reflect-2.5.1.jar/com.btk5h.skriptmirror.skript.reflect.ExprJavaCall.getSingle(ExprJavaCall.java:228) ~[skript-reflect-2.5.1.jar:?]
at skript-reflect-2.5.1.jar/com.btk5h.skriptmirror.skript.reflect.ExprJavaCall.getArray(ExprJavaCall.java:233) ~[skript-reflect-2.5.1.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.expressions.base.PropertyExpression.get(PropertyExpression.java:88) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.util.SimpleExpression.getArray(SimpleExpression.java:97) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.effects.EffBroadcast.execute(EffBroadcast.java:117) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.Effect.run(Effect.java:49) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:88) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.Trigger.execute(Trigger.java:52) ~[Skript-2.9.5.jar:?]
at skript-reflect-2.5.1.jar/org.skriptlang.reflect.syntax.expression.elements.CustomExpression.getByStandard(CustomExpression.java:100) ~[skript-reflect-2.5.1.jar:?]
at skript-reflect-2.5.1.jar/org.skriptlang.reflect.syntax.expression.elements.CustomExpression.getAll(CustomExpression.java:94) ~[skript-reflect-2.5.1.jar:?]
at skript-reflect-2.5.1.jar/org.skriptlang.reflect.syntax.expression.elements.CustomExpression.getArray(CustomExpression.java:75) ~[skript-reflect-2.5.1.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.effects.EffChange.execute(EffChange.java:284) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.Effect.run(Effect.java:49) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:88) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.lang.Trigger.execute(Trigger.java:52) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:345) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.command.ScriptCommand.lambda$execute$0(ScriptCommand.java:304) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:315) ~[Skript-2.9.5.jar:?]
at Skript-2.9.5.jar/ch.njol.skript.command.ScriptCommand.onCommand(ScriptCommand.java:250) ~[Skript-2.9.5.jar:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.21.3-R0.1-SNAPSHOT.jar:?]
... 27 more

@sovdeeth
Copy link
Member

All reflect does is load the class through the java class loading api. This is not a problem with reflect, to my knowledge.

@Blazin3330
Copy link
Author

All reflect does is load the class through the java class loading api. This is not a problem with reflect, to my knowledge.

According to "Boy":
ItemBuilder contains a field that is 1.21.4 only
it never uses that field on 1.21.3
BUT skript works in a way where it tries to sue said field
even on 1.21.3
thus it throws an error

@sovdeeth
Copy link
Member

Yes, that's how class loading works. It's not something we can get around with reflect and keep its flexibility, to my knowledge.

@Blazin3330
Copy link
Author

Yes, that's how class loading works. It's not something we can get around with reflect and keep its flexibility, to my knowledge.

Ahh... Would there be a way to make this work at all then?.. Maybe some form of work-around? Possibly loading in the plugin or something

@sovdeeth
Copy link
Member

Make a proper addon for it.

@Asleeepp
Copy link

https://github.com/finder1793/skript-nexo
There is one for what you are looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants