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

IllegalArgumentException: The nativeTask provided must be a BukkitTask. #28

Open
base2code opened this issue Sep 14, 2024 · 2 comments
Open

Comments

@base2code
Copy link

base2code commented Sep 14, 2024

Hi,
this is the full stacktrace regarding: #27

server-1 | [20:35:10 WARN]: [TestPlugin] Task #117 for TestPlugin v2.51 generated an exception
server-1 | java.lang.IllegalArgumentException: The nativeTask provided must be a BukkitTask. Got: com.tcoded.folialib.wrapper.task.WrappedBukkitTask instead.
server-1 | at TestPlugin-2.51.jar/com.tcoded.folialib.impl.SpigotImplementation.wrapTask(SpigotImplementation.java:455) ~[TestPlugin-2.51.jar:?]
server-1 | at TestPlugin-2.51.jar/com.tcoded.folialib.impl.SpigotImplementation.lambda$runAtEntityLater$8(SpigotImplementation.java:300) ~[TestPlugin-2.51.jar:?]
server-1 | at TestPlugin-2.51.jar/com.tcoded.folialib.impl.SpigotImplementation.lambda$runLater$2(SpigotImplementation.java:110) ~[TestPlugin-2.51.jar:?]
server-1 | at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:88) ~[paper-1.21.jar:1.21-130-b1b5d4c]
server-1 | at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:475) ~[paper-1.21.jar:1.21-130-b1b5d4c]
server-1 | at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1726) ~[paper-1.21.jar:1.21-130-b1b5d4c]
server-1 | at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:473) ~[paper-1.21.jar:1.21-130-b1b5d4c]
server-1 | at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1598) ~[paper-1.21.jar:1.21-130-b1b5d4c]
server-1 | at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1304) ~[paper-1.21.jar:1.21-130-b1b5d4c]
server-1 | at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:330) ~[paper-1.21.jar:1.21-130-b1b5d4c]
server-1 | at java.base/java.lang.Thread.run(Unknown Source) ~[?:?]

I currently can not say which call to the scheduler is causing this.

@base2code
Copy link
Author

I found my issue:
I used:
getScheduler().runAtEntityLater(player, (task) -> { player.updateInventory(); }, 20L);
but it should be:
getScheduler().runAtEntityLater(player, player::updateInventory, 20L);

@TechnicallyCoded
Copy link
Owner

TechnicallyCoded commented Sep 14, 2024

Still valid, unlikely user error. Using the overloaded method which takes in a runnable should work just as well as the one taking in the consumer.

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

2 participants