Slimefun-Addon-Community / LiteXpansion

GNU General Public License v3.0
11 stars 26 forks source link

[BUG] #93

Closed JiNiTaiMei1145 closed 5 months ago

JiNiTaiMei1145 commented 5 months ago

This error message is reporting a problem with the "NanoBlade" item from LiteXpansion version vBuild 32 (git commit 9b0559a). The error occurred when attempting to handle the "ItemUseHandler" for the NanoBlade.

The specific error is:

Code java.lang.IllegalArgumentException: Enchantment cannot be null Let's break down the stack trace to understand the root cause of the issue:

Error source: The error originates from the NanoBlade class within the litexpansion.weapons package of LiteXpansion.

Error context: The error occurs in the lambda$getItemHandler$0 method, which is likely related to setting up or processing an event handler for the NanoBlade item when it is used by a player.

Stack trace flow:

The error is initially triggered in the CraftMetaItem.removeEnchant method from the Bukkit API. This method is called to remove an enchantment from an item's metadata. The call to this method is made within the NanoBlade.getItemHandler lambda function. The event handling process is managed by Slimefun4's SlimefunItemInteractListener, specifically the rightClickItem method, which calls the callItemHandler method of the SlimefunItem class. The event propagation continues through various event executor classes, event managers, and plugin managers until it reaches the core Minecraft server code responsible for handling player interactions with items. Cause of the error: The IllegalArgumentException is thrown due to a null enchantment being passed to the removeEnchant method. The checkArgument method from Guava's Preconditions class is enforcing that the enchantment must not be null.

Based on this information, the likely reason for the error is that the NanoBlade class is attempting to remove an enchantment from its item metadata but is providing a null value instead of a valid Enchantment object. This could happen due to:

A programming mistake where the intended enchantment object is not correctly initialized or retrieved before calling removeEnchant. An issue with data storage or retrieval, such as reading a null enchantment from a configuration file or database. A logic error where an enchantment removal condition is not properly checked, leading to an attempt to remove a non-existent enchantment.

[15:40:02 ERROR]: [LiteXpansion] Item "NANO_BLADE" from LiteXpansion vBuild 32 (git 9b0559a) has caused an Error! [15:40:02 ERROR]: [LiteXpansion] You can report it here: https://github.com/SlimefunGuguProject/LiteXpansion/issues [15:40:02 ERROR]: [LiteXpansion] Could not pass "ItemUseHandler" for NanoBlade - 'NANO_BLADE' (LiteXpansion vBuild 32 (git 9b0559a)) java.lang.IllegalArgumentException: Enchantment cannot be null at com.google.common.base.Preconditions.checkArgument(Preconditions.java:143) ~[guava-32.1.2-jre.jar:?] at org.bukkit.craftbukkit.v1_20_R3.inventory.CraftMetaItem.removeEnchant(CraftMetaItem.java:980) ~[paper-1.20.4.jar:git-Paper-463] at dev.j3fftw.litexpansion.weapons.NanoBlade.lambda$getItemHandler$0(NanoBlade.java:51) ~[LiteXpansion-Build 32 (git 9b0559a).jar:?] at io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemInteractListener.lambda$rightClickItem$0(SlimefunItemInteractListener.java:106) ~[Slimefun-2024.02.10-release.jar:?] at io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem.callItemHandler(SlimefunItem.java:1003) ~[Slimefun-2024.02.10-release.jar:?] at io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemInteractListener.rightClickItem(SlimefunItemInteractListener.java:106) ~[Slimefun-2024.02.10-release.jar:?] at io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemInteractListener.onRightClick(SlimefunItemInteractListener.java:75) ~[Slimefun-2024.02.10-release.jar:?] at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor8.execute(Unknown Source) ~[?:?] at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:?] at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:81) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:git-Paper-463] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:?] at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.20.4.jar:git-Paper-463] at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[paper-1.20.4.jar:git-Paper-463] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:615) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_20_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:593) ~[paper-1.20.4.jar:git-Paper-463] at org.bukkit.craftbukkit.v1_20_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:549) ~[paper-1.20.4.jar:git-Paper-463] at org.bukkit.craftbukkit.v1_20_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:544) ~[paper-1.20.4.jar:git-Paper-463] at org.bukkit.craftbukkit.v1_20_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:540) ~[paper-1.20.4.jar:git-Paper-463] at net.minecraft.server.network.ServerGamePacketListenerImpl.handleUseItem(ServerGamePacketListenerImpl.java:1993) ~[?:?] at net.minecraft.network.protocol.game.ServerboundUseItemPacket.handle(ServerboundUseItemPacket.java:32) ~[?:?] at net.minecraft.network.protocol.game.ServerboundUseItemPacket.a(ServerboundUseItemPacket.java:8) ~[?:?] at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:54) ~[?:?] at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.20.4.jar:git-Paper-463] 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:1465) ~[paper-1.20.4.jar:git-Paper-463] at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:194) ~[paper-1.20.4.jar:git-Paper-463] at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?] at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1442) ~[paper-1.20.4.jar:git-Paper-463] at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1365) ~[paper-1.20.4.jar:git-Paper-463] at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?] at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1516) ~[paper-1.20.4.jar:git-Paper-463] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1226) ~[paper-1.20.4.jar:git-Paper-463] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[paper-1.20.4.jar:git-Paper-463] at java.lang.Thread.run(Thread.java:1583) ~[?:?]

WalshyDev commented 5 months ago

LX doesn't support 1.20.4 also this is a fork not the actual LX so it should be reported to the fork.