Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-5093

Allow specifying the xp, level and hiding the xp bar for custom merchants

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • This server is running CraftBukkit version git-Spigot-df0eb25-9e95da1 (MC: 1.14.2) (Implementing API version 1.14.2-R0.1-SNAPSHOT)
    • Yes

      Custom merchants will currently always display an empty xp bar in the trading interface. A useful addition to the merchant API would be to allow:

      • Specifying the displayed xp.
      • Hiding the xp bar (via the 'is regular villager'-flag send to the client when opening the merchant inventory).
      • Specifying the sent villager level: While villagers will have a level of [1,5], sending a level of 0 while using the 'is regular villager' flag allows displaying the xp bar while at the same time hiding the level name suffix ('- Novice', etc.).
      • Specifying the sent 'CanRestock' flag (hides/shows the 'villagers restock twice per day' message when hovering over the out-of-stock icon)

      Open questions:

      • Add Merchant#setExperience? Not all types of merchants (wandering traders) would support this, and for villagers this would be equal to setVillagerExperience. Also: I assume that the xp gets sent only once to the client when opening the trading view. So it would need to be clarified that setting the experience might have no effect (no dynamic updating) for the currently open merchant view.
      • Alternative 1: Allow plugins to specify the xp once when creating the merchant. This would however require plugins to recreate the merchant objects whenever they want to change the xp that gets displayed the next time the merchant view gets opened.
      • Alternative 2: The xp could principally also get specified as part of the openMerchant call. However, this would be ambigous for regular villagers (which have their own experience value) and also wandering traders (which disregard this value).
      • Alternative 3: Have a separate interface for custom merchants (name?), which supports the set/get experience, and also the is/setRegularVillager (or similar.. depending on what else this flag might control on the client, besides hiding the xp bar).

            Unassigned Unassigned
            blablubbabc blablubbabc
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: