RockinChaos / ItemJoin

Get custom items on join.
https://www.craftationgaming.com/
GNU Lesser General Public License v3.0
139 stars 36 forks source link

When a player has a ItemJoin item in inventory, its spams in the console an error #517

Closed iSeitan closed 1 year ago

iSeitan commented 1 year ago

Used ChestSort version ChestSort-13.5.1

Used Spigot version paper-1.19.3-373

Other plugin used ItemJoin https://www.spigotmc.org/resources/itemjoin.12661/

Describe the bug Spam in console

[20:25:50 ERROR]: Could not pass event ChestSortEvent to ItemJoin v5.2.5-RELEASE-b850 java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) ~[?:?] at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) ~[?:?] at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) ~[?:?] at java.util.Objects.checkIndex(Objects.java:359) ~[?:?] at java.util.ArrayList.get(ArrayList.java:427) ~[?:?] at me.RockinChaos.itemjoin.listeners.plugins.ChestSortAPI.onChestSortEvent(ChestSortAPI.java:41) ~[ItemJoin.jar:?] at com.destroystokyo.paper.event.executor.MethodHandleEventExecutor.execute(MethodHandleEventExecutor.java:40) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?] at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:git-Paper-373] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:672) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?] at de.jeff_media.chestsort.handlers.ChestSortOrganizer.sortInventory(ChestSortOrganizer.java:522) ~[ChestSort-13.5.1.jar:?] at de.jeff_media.chestsort.handlers.ChestSortOrganizer.sortInventory(ChestSortOrganizer.java:489) ~[ChestSort-13.5.1.jar:?] at de.jeff_media.chestsort.listeners.ChestSortListener.onLeftClickChest(ChestSortListener.java:102) ~[ChestSort-13.5.1.jar:?] at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor1627.execute(Unknown Source) ~[?:?] at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?] at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:git-Paper-373] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:672) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_19_R2.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:546) ~[paper-1.19.3.jar:git-Paper-373] at org.bukkit.craftbukkit.v1_19_R2.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:503) ~[paper-1.19.3.jar:git-Paper-373] at org.bukkit.craftbukkit.v1_19_R2.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:498) ~[paper-1.19.3.jar:git-Paper-373] at org.bukkit.craftbukkit.v1_19_R2.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:493) ~[paper-1.19.3.jar:git-Paper-373] at net.minecraft.server.level.ServerPlayerGameMode.handleBlockBreakAction(ServerPlayerGameMode.java:198) ~[?:?] at net.minecraft.server.network.ServerGamePacketListenerImpl.handlePlayerAction(ServerGamePacketListenerImpl.java:1871) ~[?:?] at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.handle(ServerboundPlayerActionPacket.java:42) ~[?:?] at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.a(ServerboundPlayerActionPacket.java:15) ~[?:?] at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:51) ~[?:?] at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.3.jar:git-Paper-373] at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?] at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1341) ~[paper-1.19.3.jar:git-Paper-373] at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[paper-1.19.3.jar:git-Paper-373] at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?] at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.3.jar:git-Paper-373] at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.3.jar:git-Paper-373] at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?] at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1389) ~[paper-1.19.3.jar:git-Paper-373] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1173) ~[paper-1.19.3.jar:git-Paper-373] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.19.3.jar:git-Paper-373] at java.lang.Thread.run(Thread.java:833) ~[?:?]

To Reproduce use chestsort when having an itemjoin in inventory

iSeitan commented 1 year ago

Note that since this error has happened, my custom item doesnt work anymore and is droppable on the floor.

iSeitan commented 1 year ago

[01:42:15] [Server thread/WARN]: [ItemJoin] Loaded class de.jeff_media.chestsort.api.ChestSortEvent from BestTools v2.2.0 which is not a depend or softdepend of this plugin. [01:42:15] [Server thread/WARN]: [ItemJoin] Task #81 for ItemJoin v5.2.5-RELEASE-b850 generated an exception java.lang.NullPointerException: Cannot invoke "org.bukkit.event.HandlerList.registerAll(java.util.Collection)" because the return value of "org.bukkit.plugin.SimplePluginManager.getEventListeners(java.lang.Class)" is null at org.bukkit.plugin.SimplePluginManager.registerEvents(SimplePluginManager.java:705) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?] at me.RockinChaos.itemjoin.handlers.ConfigHandler.registerListeners(ConfigHandler.java:666) ~[ItemJoin.jar:?] at me.RockinChaos.itemjoin.item.ItemDesigner.registerItems(ItemDesigner.java:142) ~[ItemJoin.jar:?] at me.RockinChaos.itemjoin.item.ItemDesigner.lambda$new$1(ItemDesigner.java:83) ~[ItemJoin.jar:?] at org.bukkit.craftbukkit.v1_19_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.3.jar:git-Paper-379] at org.bukkit.craftbukkit.v1_19_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.3.jar:git-Paper-379] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1114) ~[paper-1.19.3.jar:git-Paper-379] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.19.3.jar:git-Paper-379] at java.lang.Thread.run(Thread.java:833) ~[?:?]

RockinChaos commented 1 year ago

So this is mad confusing, this is technically not even ChestSort related.

The issue is for some odd reason ChestSort is being compiled into BestTools and is causing this issue. The easiest way to tell is that ItemJoin is loading a class from BestTools which it is not supposed to. When downloading BestTools and looking at the file structure ChestSort is indeed located inside BestTools or at least some malformed version of it.

So the main problem is ChestSort should not be located inside BestTools or--if it is supposed to be the path structure should be different to conform to standards as there is no possible way to identify between two different classes being registered simultaneously.

I have no idea why ChestSort is included in BestTools and I do not have time to comb through all their code to figure it out. The main issue is the file structure in BestTools should be different than the ChestSort plugin.

Seemingly from the first stack trace you provided, it appears the ChestSort plugins are conflicting with BestTools's version of ChestSort inside itself. It's likely ChestSort is a soft dependency of BestTools but they accidentally set their pom.xml to compile ChestSort into itself rather than simply relying on it as a dependency check.

So essentially all that is to say this is not an ItemJoin issue and cannot be resolved by me. Please contact the developer of BestTools and let them know about the ChestSort -> BestTools conflict.

iSeitan commented 1 year ago

@RockinChaos The dev fixed it in the latest besttools Thanks for your help ill close the issue