kellerkindt / ShowCaseStandalone

GNU General Public License v3.0
2 stars 9 forks source link

NPE in SimpleShopHandler#onShowCaseItemSpawnEvent #2

Closed RoboMWM closed 7 years ago

RoboMWM commented 7 years ago

So, this is spamming onEnable (and on /scs reload), presumably for each shop that exists. Shops do not contain an item above them, but they do seem to function.


[23:42:33] [Server thread/ERROR]: Could not pass event ShowCaseItemSpawnEvent to ShowCaseStandalone v2016-11-24 04:38:06-custom 21:52:02-custom 21:47:51-custom 20:02:56-custom 19:18:41-custom 20:05:14-custom 20:05:32-custom 20:05:20-custom 20:05:32-custom 01:26:10-custom 20:05:53-custom 20:02:52-custom 20:06:08-custom 20:05:52-custom 20:03:08-custom 17:19:18-custom 20:06:41-custom 20:05:26-custom 20:03:41-custom 20:05:08-custom 20:05:00-custom 20:05:12-custom 20:07:25-custom 20:05:19-custom 19:42:38-custom 19:05:15-custom 19:23:24-custom 19:05:09-custom 19:11:52-custom 19:05:11-custom 19:05:11-custom 19:05:00-custom 19:04:58-custom 19:03:18-custom 08:55:58-custom 19:03:07-custom 07:42:01-custom 19:03:13-custom 09:59:12-custom 08:27:49-custom 19:03:21-custom 08:07:21-custom 07:24:12-custom 19:05:01-custom 19:04:49-custom 19:04:47-custom 03:49:32-custom 02:16:38-custom 19:10:54-custom 19:05:07-custom 19:04:56-custom 19:04:43-custom 19:04:52-custom 19:05:01-custom 19:05:17-custom 19:03:11-custom 08:08:02-custom 19:04:47-custom 22:11:02-custom 19:05:10-custom 19:06:14-custom 03:14:50-custom 23:55:34-custom 23:40:03-custom 23:22:51-custom 23:13:23-custom 19:06:28-custom 20:01:19-custom
org.bukkit.event.EventException
    at org.bukkit.plugin.EventExecutor$1.execute(EventExecutor.java:46) ~[patched_1.11.jar:git-Paper-932]
    at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[patched_1.11.jar:git-Paper-932]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[patched_1.11.jar:git-Paper-932]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:517) [patched_1.11.jar:git-Paper-932]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:502) [patched_1.11.jar:git-Paper-932]
    at com.kellerkindt.scs.ShowCaseStandalone.callShowCaseEvent(ShowCaseStandalone.java:522) [ShowCaseStandalone-0.0.1-SNAPSHOT.jar:?]
    at com.kellerkindt.scs.internals.SimpleShopHandler.show(SimpleShopHandler.java:719) [ShowCaseStandalone-0.0.1-SNAPSHOT.jar:?]
    at com.kellerkindt.scs.internals.SimpleShopHandler.showAll(SimpleShopHandler.java:486) [ShowCaseStandalone-0.0.1-SNAPSHOT.jar:?]
    at com.kellerkindt.scs.commands.Reload.execute(Reload.java:73) [ShowCaseStandalone-0.0.1-SNAPSHOT.jar:?]
    at com.kellerkindt.scs.listeners.CommandExecutorListener.onCommand(CommandExecutorListener.java:165) [ShowCaseStandalone-0.0.1-SNAPSHOT.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) [patched_1.11.jar:git-Paper-932]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:151) [patched_1.11.jar:git-Paper-932]
    at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchCommand(CraftServer.java:674) [patched_1.11.jar:git-Paper-932]
    at net.minecraft.server.v1_11_R1.PlayerConnection.handleCommand(PlayerConnection.java:1373) [patched_1.11.jar:git-Paper-932]
    at net.minecraft.server.v1_11_R1.PlayerConnection.chat(PlayerConnection.java:1282) [patched_1.11.jar:git-Paper-932]
    at org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer.chat(CraftPlayer.java:331) [patched_1.11.jar:git-Paper-932]
    at it.mri.mycommand.execute.DispatchCommands.ExecuteCommands(DispatchCommands.java:1102) [MyCommand.jar:?]
    at it.mri.mycommand.execute.DispatchCommands.PerformMycmdCommands(DispatchCommands.java:969) [MyCommand.jar:?]
    at it.mri.mycommand.execute.DispatchCommands.ExecuteMyCommandCommands(DispatchCommands.java:335) [MyCommand.jar:?]
    at it.mri.mycommand.listener.PreprocessEvent.onPlayerCommandPreprocess(PreprocessEvent.java:240) [MyCommand.jar:?]
    at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor338.execute(Unknown Source) [?:?]
    at org.bukkit.plugin.EventExecutor$1.execute(EventExecutor.java:44) [patched_1.11.jar:git-Paper-932]
    at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) [patched_1.11.jar:git-Paper-932]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) [patched_1.11.jar:git-Paper-932]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:517) [patched_1.11.jar:git-Paper-932]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:502) [patched_1.11.jar:git-Paper-932]
    at net.minecraft.server.v1_11_R1.PlayerConnection.handleCommand(PlayerConnection.java:1365) [patched_1.11.jar:git-Paper-932]
    at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:1178) [patched_1.11.jar:git-Paper-932]
    at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) [patched_1.11.jar:git-Paper-932]
    at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(PacketPlayInChat.java:5) [patched_1.11.jar:git-Paper-932]
    at net.minecraft.server.v1_11_R1.PlayerConnectionUtils$1.run(SourceFile:13) [patched_1.11.jar:git-Paper-932]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_111]
    at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_111]
    at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:46) [patched_1.11.jar:git-Paper-932]
    at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:817) [patched_1.11.jar:git-Paper-932]
    at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:403) [patched_1.11.jar:git-Paper-932]
    at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:749) [patched_1.11.jar:git-Paper-932]
    at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:648) [patched_1.11.jar:git-Paper-932]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_111]
Caused by: java.lang.NullPointerException
    at com.kellerkindt.scs.internals.SimpleShopHandler.onShowCaseItemSpawnEvent(SimpleShopHandler.java:752) ~[?:?]
    at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor989.execute(Unknown Source) ~[?:?]
    at org.bukkit.plugin.EventExecutor$1.execute(EventExecutor.java:44) ~[patched_1.11.jar:git-Paper-932]
    ... 38 more
RoboMWM commented 7 years ago

Visually, I do see the items for a fraction of a second when I run /scs reload. So I would think it is dropping the item... not sure why it's null.

kellerkindt commented 7 years ago

omg... what has changed this time?

item.getItemStack().getItemMeta().setDisplayName(shop.getId().toString());

Seems like there is no guarantee for an ItemMeta?

RoboMWM commented 7 years ago

Unless those other values are null, idk :(

kellerkindt commented 7 years ago

ItemMeta can be null if the following path is executed: if (!hasItemMeta(item)) return CraftItemFactory.instance().getItemMeta(getType(item)) --> getItemMeta(notNull) --> getItemMeta(notNull, null) which is null on AIR or several other conditions...

Well, that fix will be up in a few minutes then

kellerkindt commented 7 years ago

ahahahahahahaha. nope. While there is no exception anymore. The item just blinks up for a split second, while it works fine on craftbukkit 1.10.2... god damn it, why is there no official API

kellerkindt commented 7 years ago

Fix is up