KaiKikuchi / QuickShop

A shop plugin for Bukkit
47 stars 41 forks source link

Handle NBT tags (aka 1.9 Potions) #37

Closed ORelio closed 8 years ago

ORelio commented 8 years ago

Hello,

Good news, QuickShop seems to work fine on Minecraft 1.9 using Spigot's snapshots. No errors, it loads and seems to perform as usual. Our test server is running v0.9.8 but that should not matter according to the commits since then.

The issue existed before 1.9 eg with named items but it had minor consequences. However since Minecraft 1.9, potion types are no longer set in the damage field of the Water Bottle item but are set as a Potion NBT tag. Quoted from the wiki:

Numeric IDs are no longer used. Instead an NBT "Potion" tag is used, e.g. /give <player> minecraft:potion 1 0 {Potion:"minecraft:swiftness"}. See here for the old numeric IDs.

Unfortunately as QuickShop does not handle NBT tags, shops will sell and buy only according to the item type and damage value, completely ignoring NBT tags such as item name, lore, or... potion type!

As a consequence old potion shops doesn't work anymore (but could eventually be re-created manually by the owner) since they are expecting a damage value no longer present on the potion items. Some shops created on Minecraft 1.8 will look like this, with broken floating item and zero stock (since the items into the chest are no longer recognized as they have no damage value):

31907320160303124732

Shops created under Minecraft 1.9 will be considered as Water Bottle shops:

2016-03-03_16 10 08

They accept any potion type when selling from and back to the shop, including water.

To resolve this issue I think QuickShop would have to handle the Potion NBT tag, and by the way I'd also suggest to handle item name and lore.

Thanks in advance for any help you can provide and keep up the good work :smile:

KaiKikuchi commented 8 years ago

Hello! Thank you for your report! I hope I can work on this soon.

ORelio commented 8 years ago

Not sure if that would help, but for another plugin I'm working on, I wrote an utility class for accessing NBT tags on an ItemStack. It's pretty basic and only handle String tags, but that should be enough for accessing the Potion tag. Here it is: https://gist.github.com/ORelio/f4e5ca567fed2d5ff963

TNTUP commented 8 years ago

Hey, 1.9's potions are sold as "Water Bottles", I'm waiting for an update when you have time :)

KaiKikuchi commented 8 years ago

Added custom items and potions name settings on config.yml in version 0.9.17.

Currently I didn't specify all the potions and effects name yet because I am too busy. I hope someone will contribute with a list!

ORelio commented 8 years ago

Thanks!