TheSilentPro / HeadDB

Provides access to a database of over 100k heads
GNU General Public License v3.0
24 stars 21 forks source link

An unexpected error occurred #75

Closed lewmilburn closed 5 days ago

lewmilburn commented 6 months ago

Describe the bug A clear and concise description of what the bug is. "An unexpected error occurred trying to execute that command" when running /headdb

Information Plugin Version: 5.0.0-rc.10 Server Version: 1.20.6 Client Version: 1.20.6

Errors Provide any relevant errors that occur in the console. Use pastebin or hastebin No console errors, just chat.

Screenshots If applicable, add screenshots to help explain your problem. image image

impact112 commented 5 months ago

I can replicate the issue and I was able to get debug info in the console.

[00:18:29 INFO]: REDACTED issued server command: /headdb
[00:18:29 ERROR]: Command exception: /headdb
org.bukkit.command.CommandException: Unhandled exception executing command 'headdb' in plugin HeadDB v5.0.0-rc.10
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
    at io.papermc.paper.command.brigadier.bukkit.BukkitCommandNode$BukkitBrigCommand.run(BukkitCommandNode.java:91) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73) ~[brigadier-1.2.9.jar:?]
    at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:31) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:19) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.commands.execution.UnboundEntryAction.lambda$bind$0(UnboundEntryAction.java:8) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.commands.execution.CommandQueueEntry.execute(CommandQueueEntry.java:5) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.commands.execution.ExecutionContext.runCommandQueue(ExecutionContext.java:103) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.commands.Commands.executeCommandInContext(Commands.java:448) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.commands.Commands.performCommand(Commands.java:355) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.commands.Commands.performCommand(Commands.java:342) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.commands.Commands.performCommand(Commands.java:337) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.performUnsignedChatCommand(ServerGamePacketListenerImpl.java:2202) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$14(ServerGamePacketListenerImpl.java:2176) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:151) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1511) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:195) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:125) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1488) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1411) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:135) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1562) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1231) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:323) ~[paper-1.20.6.jar:1.20.6-138-906df69]
    at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.ExceptionInInitializerError
    at HeadDB.jar/tsp.headdb.core.util.Utils.asItem(Utils.java:285) ~[HeadDB.jar:?]
    at HeadDB.jar/tsp.headdb.implementation.head.Head.getItem(Head.java:42) ~[HeadDB.jar:?]
    at HeadDB.jar/tsp.headdb.implementation.category.Category.lambda$getItem$0(Category.java:65) ~[HeadDB.jar:?]
    at java.base/java.util.Optional.ifPresentOrElse(Optional.java:196) ~[?:?]
    at HeadDB.jar/tsp.headdb.implementation.category.Category.getItem(Category.java:64) ~[HeadDB.jar:?]
    at HeadDB.jar/tsp.headdb.core.command.CommandMain.handle(CommandMain.java:56) ~[HeadDB.jar:?]
    at HeadDB.jar/tsp.headdb.core.command.CommandMain.onCommand(CommandMain.java:173) ~[HeadDB.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
    ... 26 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
    at HeadDB.jar/tsp.nexuslib.server.ServerVersion.<clinit>(ServerVersion.java:35) ~[HeadDB.jar:?]
    at HeadDB.jar/tsp.headdb.core.util.Utils.asItem(Utils.java:285) ~[HeadDB.jar:?]
    at HeadDB.jar/tsp.headdb.implementation.head.Head.getItem(Head.java:42) ~[HeadDB.jar:?]
    at HeadDB.jar/tsp.headdb.implementation.category.Category.lambda$getItem$0(Category.java:65) ~[HeadDB.jar:?]
    at java.base/java.util.Optional.ifPresentOrElse(Optional.java:196) ~[?:?]
    at HeadDB.jar/tsp.headdb.implementation.category.Category.getItem(Category.java:64) ~[HeadDB.jar:?]
    at HeadDB.jar/tsp.headdb.core.command.CommandMain.handle(CommandMain.java:56) ~[HeadDB.jar:?]
    at HeadDB.jar/tsp.headdb.core.command.CommandMain.onCommand(CommandMain.java:173) ~[HeadDB.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
    ... 26 more

This looks like its caused by the 1.20.5 change to Java 21 from 17 since other plugins had similar out of bounds errors before being updated for 1.20.5/1.20.6.

TheSilentPro commented 5 months ago

It's an issue with the ServerVersion and the new minecraft versions. Im working on a bigger update for the whole plugin already but if someone prs this though ill merge it