Shopkeepers

Shopkeepers

2M Downloads

When using a head without a name or real UUID

blablubbabcDEV opened this issue · 15 comments

commented

Migrated from: https://dev.bukkit.org/projects/shopkeepers/issues/311

Originally posted by Ashley912 (Apr 28, 2015):

[15:06:54 ERROR]: Could not pass event InventoryClickEvent to Shopkeepers v1.52
org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:305) ~[spigot.jar:git-Spigot-2ec6f06-7722428]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-2ec6f06-7722428]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-2ec6f06-7722428]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot.jar:git-Spigot-2ec6f06-7722428]
        at net.minecraft.server.v1_8_R2.PlayerConnection.a(PlayerConnection.java:1620) [spigot.jar:git-Spigot-2ec6f06-7722428]
        at net.minecraft.server.v1_8_R2.PacketPlayInWindowClick.a(SourceFile:31) [spigot.jar:git-Spigot-2ec6f06-7722428]
        at net.minecraft.server.v1_8_R2.PacketPlayInWindowClick.a(SourceFile:9) [spigot.jar:git-Spigot-2ec6f06-7722428]
        at net.minecraft.server.v1_8_R2.PlayerConnectionUtils$1.run(SourceFile:13) [spigot.jar:git-Spigot-2ec6f06-7722428]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_11]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_11]
        at net.minecraft.server.v1_8_R2.SystemUtils.a(SourceFile:60) [spigot.jar:git-Spigot-2ec6f06-7722428]
        at net.minecraft.server.v1_8_R2.MinecraftServer.A(MinecraftServer.java:712) [spigot.jar:git-Spigot-2ec6f06-7722428]
        at net.minecraft.server.v1_8_R2.DedicatedServer.A(DedicatedServer.java:368) [spigot.jar:git-Spigot-2ec6f06-7722428]
        at net.minecraft.server.v1_8_R2.MinecraftServer.z(MinecraftServer.java:651) [spigot.jar:git-Spigot-2ec6f06-7722428]
        at net.minecraft.server.v1_8_R2.MinecraftServer.run(MinecraftServer.java:554) [spigot.jar:git-Spigot-2ec6f06-7722428]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_11]
Caused by: java.lang.NullPointerException
        at com.nisovin.shopkeepers.Utils.areSimilarReasoned(Utils.java:335) ~[?:?]
        at com.nisovin.shopkeepers.Utils.areSimilar(Utils.java:176) ~[?:?]
        at com.nisovin.shopkeepers.ui.defaults.TradingHandler.itemEqualsAtLeast(TradingHandler.java:200) ~[?:?]
        at com.nisovin.shopkeepers.ui.defaults.TradingHandler.onInventoryClick(TradingHandler.java:111) ~[?:?]
        at com.nisovin.shopkeepers.ui.UIListener.onInventoryClick(UIListener.java:60) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_11]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_11]
        at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_11]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301) ~[spigot.jar:git-Spigot-2ec6f06-7722428]

commented

Originally commented by Ashley912 (May 1, 2015):

[at]blablubbabc:
/give blablubbabc skull 1 3 {display:{Name:"Hamburger"},SkullOwner:{Id:"f597e06f-e01a-492d-b63f-c23b9809ce01",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzVlMjc5ODhhNjUzODAxMGVmYzBlMjQ3NTZiYzNlM2VlYTI0ZDc1MzZiMjA5MzJjMTdlMDQwNGU1Y2M1NWYifX19"}]}}}
Try to buy it from a shopkeeper. Nothing seems to break, only pesky console spam. :)

        Edited May 1, 2015
commented

Originally commented by blablubbabc (May 1, 2015):

[at]Ashley912:
Maybe related to this ticket: http://dev.bukkit.org/bukkit-plugins/shopkeepers/tickets/298-shopkeeper-save-file-corrution/
And the related spigot ticket: https://hub.spigotmc.org/jira/browse/SPIGOT-583
Spigot seems to be not able currently to save skull items with custom textures.

        Edited May 1, 2015
commented

Originally commented by Ashley912 (May 1, 2015):

[at]blablubbabc:
There are no errors/warnings without shopkeepers. Textures display just fine.

        Edited May 1, 2015
commented

Originally commented by blablubbabc (May 1, 2015):

[at]Ashley912:
Shopkeepers uses a function of the bukkit api for saving the items to a config file. This function doesn't properly work currently for skulls with custom textures.

commented

Originally commented by blablubbabc (Apr 30, 2015):

Do you currently have an example how you create those heads?

I just tried it with the normal player heads from creative inventory, which work, but I guess that's not what you mean with "head without a name or real UUID".
I also tried to manually modify the heads nbt data (via PowerNBT plugin) and set the uuid to one which hasn't a matching player and I removed the owner name tag completely: it would cause errors already when trying to save the head item (because bukkit expects the name field to be existing).

So I could add an additonal check which checks that the name is not null, preventing this error from popping up, but it wouldn't solve any of the other problems related to skull items without name field..

Also I am already checking if the skull has an owner (via bukkit api) before comparing the owners of the skull items: so depending on how you create your conflicting skull items this might maybe be something to be better changed in bukkit/spigot..
So next I tried to set the name to an empty string: no errors here, but trading would be messed up nevertheless sometimes, because (current guess) spigot seems to sometimes update the head items in your inventory (to update head textures I guess) and if the name field is empty it replaces the head item with an item which has no skull owner at all (similar to the head item you can get from creative inventory).

        Edited Apr 30, 2015
commented

Originally commented by Ar7ific1al (May 6, 2015):

I also am having this problem. I really had my heart set on using Shopkeepers in my tavern with a nifty plugin called Head Items to sell custom food items. My shopkeeper disappears after server restarts if I put custom textured skulls in the shopkeeper's inventory.
I do hope there is some sort of a fix. I've not been able to find any alternate solutions. I love Shopkeepers and I would love to use it for my tavern selling custom textured skulls as food items.

commented

Originally commented by Faowkon (May 20, 2015):

there is a small work around for this bug, which is caused when u use this to give the head
give skull 1 3 {display:{Name:"Skull"},SkullOwner:{Id:"c659cdd4-e436-4977-a6a7-d5518ebecfbb",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWFlMzg1NWY5NTJjZDRhMDNjMTQ4YTk0NmUzZjgxMmE1OTU1YWQzNWNiY2I1MjYyN2VhNGFjZDQ3ZDMwODEifX19"}]}}}

will corrupt the whole save file because the head owner's name is missing and throwing a nullpoint error
this however
give skull 1 3 {display:{Name:"Ramen"]},SkullOwner:{Name:"BowlofNoodles",Id:"f15ab073-412e-4fe2-8668-1be12066e2ac",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjY4MzRiNWIyNTQyNmRlNjM1MzhlYzgyY2E4ZmJlY2ZjYmIzZTY4MmQ4MDYzNjQzZDJlNjdhNzYyMWJkIn19fQ=="}]}}}

will save, but you will lose the texture on reload or restart, which sucks
i assume because the plugin doesnt save the texture anywhere, instead on reload it checks to see if its a real head and update the skin, which it cant. so it defaults back to a normal steve or alex head

commented

Originally commented by blablubbabc (Jun 12, 2015):

Is this still an issue in the latest spigot build?
There was some change regarding player heads, however I wasn't able to look into it or verify it yet.

        Edited Jun 12, 2015
commented

Originally commented by Ashley912 (May 1, 2015):

[at]blablubbabc:
If it's not too much trouble- could you please update GitHub Shopkeepers to the latest version?

        Edited May 1, 2015
commented

Originally commented by blablubbabc (May 1, 2015):

[at]Ashley912:
It's up-to-date.

I just see that I haven't released the latest minor changes here on dbo yet.

        Edited May 1, 2015
commented

Originally commented by blablubbabc (Aug 25, 2015):

[at]joshep92:
[at]Ashley912:
I will close this ticket as of now. This is clearly an issue of spigot/bukkit with their item serialization: it doesn't support player heads with custom textures (no skull owner) currently. See my ticket about this issue here: https:hub.spigotmc.org/jira/browse/SPIGOT-1066

commented

Originally commented by joshep92 (Aug 25, 2015):

[at]blablubbabc:
Thanks you so much for your attention and quickly response :)

commented

Originally commented by blablubbabc (Aug 25, 2015):

[at]joshep92:
Sadly it hasn't happend much on spigot's end about this since quite some time already. :(

commented

Originally commented by joshep92 (Aug 25, 2015):

[at]blablubbabc:
Yes, with V, 1.6.3 still clear saves when restart server with a Shopkeeper with a tarde that contain a head.


[Craft Scheduler Thread - 4/WARN]: org.apache.commons.lang.UnhandledException: Plugin Shopkeepers v1.63 generated an exception while executing task 43571
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException: null value in entry: skull-owner=null
at com.google.common.collect.CollectPreconditions.checkEntryNotNull(CollectPreconditions.java:33)
at com.google.common.collect.ImmutableMap.entryOf(ImmutableMap.java:135)
at com.google.common.collect.ImmutableMap$Builder.put(ImmutableMap.java:206)
at org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaSkull.serialize(CraftMetaSkull.java:173)
at org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaItem.serialize(CraftMetaItem.java:850)
at org.bukkit.configuration.file.YamlRepresenter$RepresentConfigurationSerializable.representData(YamlRepresenter.java:33)
at org.yaml.snakeyaml.representer.BaseRepresenter.representData(BaseRepresenter.java:94)
at org.yaml.snakeyaml.representer.BaseRepresenter.representMapping(BaseRepresenter.java:156)
at org.yaml.snakeyaml.representer.SafeRepresenter$RepresentMap.representData(SafeRepresenter.java:304)
at org.bukkit.configuration.file.YamlRepresenter$RepresentConfigurationSerializable.representData(YamlRepresenter.java:35)
at org.yaml.snakeyaml.representer.BaseRepresenter.representData(BaseRepresenter.java:94)
at org.yaml.snakeyaml.representer.BaseRepresenter.representMapping(BaseRepresenter.java:156)
at org.yaml.snakeyaml.representer.SafeRepresenter$RepresentMap.representData(SafeRepresenter.java:304)
at org.bukkit.configuration.file.YamlRepresenter$RepresentConfigurationSection.representData(YamlRepresenter.java:23)
at org.yaml.snakeyaml.representer.BaseRepresenter.representData(BaseRepresenter.java:94)
at org.yaml.snakeyaml.representer.BaseRepresenter.representMapping(BaseRepresenter.java:156)
at org.yaml.snakeyaml.representer.SafeRepresenter$RepresentMap.representData(SafeRepresenter.java:304)
at org.bukkit.configuration.file.YamlRepresenter$RepresentConfigurationSection.representData(YamlRepresenter.java:23)
at org.yaml.snakeyaml.representer.BaseRepresenter.representData(BaseRepresenter.java:94)
at org.yaml.snakeyaml.representer.BaseRepresenter.representMapping(BaseRepresenter.java:156)
at org.yaml.snakeyaml.representer.SafeRepresenter$RepresentMap.representData(SafeRepresenter.java:304)
at org.bukkit.configuration.file.YamlRepresenter$RepresentConfigurationSection.representData(YamlRepresenter.java:23)
at org.yaml.snakeyaml.representer.BaseRepresenter.representData(BaseRepresenter.java:94)
at org.yaml.snakeyaml.representer.BaseRepresenter.representMapping(BaseRepresenter.java:156)
at org.yaml.snakeyaml.representer.SafeRepresenter$RepresentMap.representData(SafeRepresenter.java:304)
at org.yaml.snakeyaml.representer.BaseRepresenter.representData(BaseRepresenter.java:94)
at org.yaml.snakeyaml.representer.BaseRepresenter.represent(BaseRepresenter.java:64)
at org.yaml.snakeyaml.Yaml.dumpAll(Yaml.java:242)
at org.yaml.snakeyaml.Yaml.dumpAll(Yaml.java:206)
at org.yaml.snakeyaml.Yaml.dump(Yaml.java:181)
at org.bukkit.configuration.file.YamlConfiguration.saveToString(YamlConfiguration.java:40)
at com.nisovin.shopkeepers.ShopkeepersPlugin.saveDataToFile(ShopkeepersPlugin.java:1390)
at com.nisovin.shopkeepers.ShopkeepersPlugin.access$1200(ShopkeepersPlugin.java:62)
at com.nisovin.shopkeepers.ShopkeepersPlugin$11.run(ShopkeepersPlugin.java:1300)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
... 3

commented

Originally closed by blablubbabc (Aug 25, 2015)