Knokko's Custom Items

Knokko's Custom Items

37.4k Downloads

Implement proper error checking for item replacement

TechWizzart opened this issue ยท 0 comments

commented

When treating the HASITEM condition, a NullPointerException shows up as a method may return NULL but it is not explicitly checked. Should review this in all replacement code snippets. For the original error, see the following console output:

[10:58:01] [Server thread/ERROR]: Could not pass event PlayerInteractEvent to CustomItems v8.0
org.bukkit.event.EventException: null
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:500) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:485) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:235) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:202) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:198) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:991) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at net.minecraft.server.v1_12_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:26) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at net.minecraft.server.v1_12_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:1) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:748) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.lang.NullPointerException
at nl.knokko.customitems.plugin.CustomItemsEventHandler.handleReplacement(CustomItemsEventHandler.java:493) ~[?:?]
at jdk.internal.reflect.GeneratedMethodAccessor121.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
... 18 more