HelpChat / DeluxeMenus

DeluxeMenus but open source!?
https://wiki.helpch.at/clips-plugins/deluxemenus
MIT License
61 stars 30 forks source link

Villager Trading GUI #76

Open Appliedtrout opened 3 months ago

Appliedtrout commented 3 months ago

Could you please add the option to use a Villager Trading GUI? This would be extremely helpful for me and other players.

BlitzOffline commented 3 months ago

This is a great idea but will require much work as Merchant inventories are very different from other inventory types. If anyone has the time to look into this, here are some starting points:

  1. A Merchant entity needs to be created: https://helpch.at/docs/1.14.4/org/bukkit/inventory/Merchant.html.
  2. Recipes (aka the trading inventory) need to be created: https://helpch.at/docs/1.14.4/org/bukkit/inventory/MerchantRecipe.html
  3. These recipes need to be given to the Merchant: https://helpch.at/docs/1.14.4/org/bukkit/inventory/Merchant.html#setRecipes-java.util.List-
  4. A trade needs to be open between the player and the Merchant: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/HumanEntity.html#openMerchant(org.bukkit.inventory.Merchant,boolean)

Something to note, DeluxeMenus supports Minecraft 1.14.4 and higher so the changes will have to work on all these versions if possible. If not, they could be disabled on lower versions but the plugin still needs to work on those versions.