Extra Hard Mode

Extra Hard Mode

63.1k Downloads

NPE on PrepareItemCraftEvent on Spigot 1.12

SlimeDog opened this issue ยท 5 comments

commented

Spigot 1.12
EHM 3.11

NPE moving items in inventory

[10:22:04 ERROR]: Could not pass event PrepareItemCraftEvent to ExtraHardMode v3.11
org.bukkit.event.EventException: null
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:499) [spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:484) [spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callPreCraftEvent(CraftEventFactory.java:770) [spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at net.minecraft.server.v1_12_R1.Container.a(Container.java:652) [spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at net.minecraft.server.v1_12_R1.ContainerPlayer.a(ContainerPlayer.java:75) [spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at net.minecraft.server.v1_12_R1.InventoryCrafting.setItem(InventoryCrafting.java:130) [spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at org.bukkit.craftbukkit.v1_12_R1.inventory.CraftInventoryCrafting.setItem(CraftInventoryCrafting.java:83) [spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at co.kepler.fastcraftplus.recipes.CraftingListener$1.run(CraftingListener.java:47) [FastCraftPlus-0.26.4.jar:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:71) [spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:353) [spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:738) [spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:405) [spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:678) [spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:576) [spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
Caused by: java.lang.NullPointerException
at com.extrahardmode.features.MoreTnt.beforeCraft(MoreTnt.java:67) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[spigot-1.12-pre2.jar:git-Spigot-1ffab67-45102fc]
... 16 more

commented

Huh... did crafting change in 1.12?

commented

I'm merely reporting what I observed. However, crafting did change in 1.12, with the addition of limited crafting based on unlocked recipes.

commented

I'm also experiencing this issue. It's spammed in console repeatedly, would be nice if this fix could be put out asap. Thanks so much! :)

commented

Hi, can you guys tell me how to reproduce this (e.g. what actions to take in-game)? Not really sure where to go about resolving this - perhaps the new 1.12 recipe guide thing causes "null" results?

(If it helps, the call it's erroring on is event.getRecipe().getResult().getType() so either the recipe or the result is null.)

commented

Ok nvm, was able to easily reproduce after getting myself in a world where EHM is enabled (and changing the config to something greater than 1).

Basically, recipes now return null instead of AIR if the current recipe has now result.