Dasfaust / GlobalMarket

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

2.0.0 broken in 1.11+ | Add support for 1.11 | Fix ItemStack #121

Closed k-jiang closed 8 years ago

k-jiang commented 8 years ago

Version 2.0.0 is not able to be loaded in 1.11 during server startup:

[16:02:30] [Server thread/ERROR]: Error occurred while enabling GlobalMarket v2.0.0.33 (Is it up to date?) java.lang.NoSuchMethodError: com.comphenix.protocol.utility.MinecraftReflection.getBukkitItemStack(Lorg/bukkit/inventory/ItemStack;)Lorg/bukkit/inventory/ItemStack; at me.dasfaust.gm.trade.WrappedStack.(WrappedStack.java:31) ~[?:?] at me.dasfaust.gm.config.Config.load(Config.java:227) ~[?:?] at me.dasfaust.gm.Core.onEnable(Core.java:43) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:271) ~[spigot-1.11.jar:git-Spigot-0f17cfb-c1462a2] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:337) [spigot-1.11.jar:git-Spigot-0f17cfb-c1462a2] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot-1.11.jar:git-Spigot-0f17cfb-c1462a2] at org.bukkit.craftbukkit.v1_11_R1.CraftServer.enablePlugin(CraftServer.java:375) [spigot-1.11.jar:git-Spigot-0f17cfb-c1462a2] at org.bukkit.craftbukkit.v1_11_R1.CraftServer.enablePlugins(CraftServer.java:325) [spigot-1.11.jar:git-Spigot-0f17cfb-c1462a2] at net.minecraft.server.v1_11_R1.MinecraftServer.t(MinecraftServer.java:419) [spigot-1.11.jar:git-Spigot-0f17cfb-c1462a2] at net.minecraft.server.v1_11_R1.MinecraftServer.l(MinecraftServer.java:380) [spigot-1.11.jar:git-Spigot-0f17cfb-c1462a2] at net.minecraft.server.v1_11_R1.MinecraftServer.a(MinecraftServer.java:335) [spigot-1.11.jar:git-Spigot-0f17cfb-c1462a2] at net.minecraft.server.v1_11_R1.DedicatedServer.init(DedicatedServer.java:272) [spigot-1.11.jar:git-Spigot-0f17cfb-c1462a2] at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:542) [spigot-1.11.jar:git-Spigot-0f17cfb-c1462a2] at java.lang.Thread.run(Unknown Source) [?:1.8.0_111]

It might because of the change of behaviors in Bukkit API, which they now handle ItemStack differently. quote from md-5 as follow: https://www.spigotmc.org/threads/bukkit-1-11-api-draft.193437/

... 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.

This situation is also described by the developer of ProtocolLib: https://github.com/dmulloy2/ProtocolLib/commit/684b687e42f639d7efff397f3851ea0a17efb7a5

Note to developers: You should never supply a null ItemStack to any method. ProtocolLib will never return a null ItemStack. Update your plugins accordingly.

Since I only know little about Java programming and I have no idea of how to fixing it (e.g ItemStack could not be null but throwing "method not found" ?? The method is there for sure!), please consider fix the issue in priority or the 2.0.0 will never work in 1.11+ version.

Sorry for my bad English. But if you want to have some assistance on fixing the situation, or if you want somebody to test it out, please let me know.

freakyy85 commented 8 years ago

yes please make it compatible with 1.11 :) im using the latest ProtocolLib for 1.11 (latest dev) and it still doesn't work. It also seems to be loaded and used by other plugins like MyPet, HolographicDisplays etc..

Dasfaust commented 8 years ago

Thanks for the info! I did a quick fix, build 35 is working on my test server, 1.11 with the latest ProtocolLib. This build probably won't work on older MC versions, will try to fix that later. Nothing else has changed.

k-jiang commented 8 years ago

Tested build 37 and it is working fine on 1.11. Thank you soo much for your great help!!!!! :+1:

freakyy85 commented 8 years ago

works. thank you very much! :)