Dasfaust / GlobalMarket

Buy and sell items in a global market
Other
28 stars 58 forks source link

Player items get vanished while using the GUI #132

Closed k-jiang closed 5 months ago

k-jiang commented 7 years ago

Player inventories get vanished while using the GUI, tested on Spigot 1.11.2. Please consider to fix it, thank you!

FYI: In 1.11, spigot changed its way of handling ItemStack. I'm not sure if this caused the issue. see https://www.spigotmc.org/threads/bukkit-1-11-api-draft.193437/ .

For NMS Developers: We don’t normally do release notes here, but there is a change that I must stress greatly. net.minecraft.server.ItemStack may no longer be null. Do not under any circumstances pass null into a method with an ItemStack. Always check that ItemStack.isEmpty is false before operating on an ItemStack. Do not attempt to modify an ItemStack where isEmpty is true. Failing to heed these warnings will cause very bad things. When in doubt, use the conversion methods in CraftItemStack.

Error log:

[20:33:16] [Server thread/ERROR]: Could not pass event InventoryCreativeEvent to GlobalMarket v2.0.1.38
org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-survival.jar:git-Spigot-7d78b81-e2a288c]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-survival.jar:git-Spigot-7d78b81-e2a288c]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot-survival.jar:git-Spigot-7d78b81-e2a288c]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot-survival.jar:git-Spigot-7d78b81-e2a288c]
        at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:1988) [spigot-survival.jar:git-Spigot-7d78b81-e2a288c]
        at net.minecraft.server.v1_11_R1.PacketPlayInSetCreativeSlot.a(SourceFile:23) [spigot-survival.jar:git-Spigot-7d78b81-e2a288c]
        at net.minecraft.server.v1_11_R1.PacketPlayInSetCreativeSlot.a(SourceFile:9) [spigot-survival.jar:git-Spigot-7d78b81-e2a288c]
        at net.minecraft.server.v1_11_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-survival.jar:git-Spigot-7d78b81-e2a288c]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_111]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_111]
        at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:46) [spigot-survival.jar:git-Spigot-7d78b81-e2a288c]
        at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:739) [spigot-survival.jar:git-Spigot-7d78b81-e2a288c]
        at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:399) [spigot-survival.jar:git-Spigot-7d78b81-e2a288c]
        at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:675) [spigot-survival.jar:git-Spigot-7d78b81-e2a288c]
        at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:574) [spigot-survival.jar:git-Spigot-7d78b81-e2a288c]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
Caused by: java.lang.NullPointerException
        at me.dasfaust.gm.menus.Menus$1.getTitle(Menus.java:36) ~[?:?]
        at me.dasfaust.gm.MenuHandler.onClick(MenuHandler.java:133) ~[?:?]
        at sun.reflect.GeneratedMethodAccessor196.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_111]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_111]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[spigot-survival.jar:git-Spigot-7d78b81-e2a288c]
        ... 15 more