catch441 / Ultimate_Economy

GNU General Public License v3.0
15 stars 3 forks source link

[Bug] Customized Banners do not work correctly in shops. #95

Open CowedOffACliff opened 4 years ago

CowedOffACliff commented 4 years ago

Describe the bug A clear and concise description of what the bug is.

Custom banners (i.e. any type of modified banner) cannot be sold to or purchased from an admin shop (and all shops because the handling methods are all the universal?) after a server restarts. The banners will still appear correctly in the inventory with all of their correct item data and all of the shop interface information in tact. Attempting to purchase/sell a banner in this state will result in the interface doing nothing. It will just refuse to modify any inventories.

I believe this may have something to do with how the banner step information is being saved in the shop yaml file. Banners get saved with a lot of information like this "patterns=[org.bukkit.block.banner.Pattern@1b0f3c14" describing the steps. I'm not a Bukkit coder but looking through the plugin code for a bit I'm guessing the @* information is being appended by a .toString(). After messing with this for a while I took notice that if you add a banner to the shop then get the shop into a state where they are no longer able to be purchased, then add the same banner into the shop again, the new instance of the banner inside the yaml file will have completely different @data in certain places even though it is the exact same minecraft item that was placed in the shop the first time.

To Reproduce Did you changed the savefiles by yourself? - I both did and not modify the save file manually throughout my time spent trying to test the bug. Any error in the server log? (Add server log) - No relevant information in server log. Steps to reproduce.

  1. Create any non default banner. Add a few effects to it like a normal player would.
  2. Add this unique banner into the shop inventory for sale with buy and/or sell price.
  3. Attempt to buy/sell the banner from the shop and observe that you are able to do so and it functions normally.
  4. Stop the Minecraft server entirely and then restart it. Not Bukkit:Reload.
  5. Attempt to purchase the banner from the shop again. You will no longer be able to. The item will just attempt to move and then reset to its chest position. The shop will be incapable or taking or receiving currency for this item and will not be able to place a copy of it in the player inventory.

A Bukkit:Reload will not trigger this problem immediately after adding the item to the shop. It will also not fix the problem after the failure state has occured. Once the failure state is triggered I have not been able to find a way to get it working again without redoing the items. I am fairly certain that completely stopping and restarting the server instance produces the trigger condition which causes the shop to fail to load and interpret the information correctly.

Expected behavior A clear and concise description of what you expected to happen.

Banners of any type should be able to be placed into a shop and sold as normal items. This may end up requiring a specialty function like player heads and mob spawners do. This is perfectly acceptable and sensible if it is required.

Environment Paper: Paper version git-Paper-282 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT) Server version 1.15.2 Plugin version 1.2.5f

catch441 commented 4 years ago

The best bug report I have ever got for this project, thanks. I never had the banners on my scope, only enchanted items, potions etc. Thanks for the hint, I will look into it

CowedOffACliff commented 4 years ago

I taught myself to code by learning to modify the game several years ago. My knowledge is very rusty but I remember a lot about how things work. I spent at least a good few hours trying to diagnose the bug in a live non-development environment before I officially reported it. Cheers. :P