(Feature Request) ExecutableItems support -> Add API to allow third-party plugins to more easily update items
Reddishye opened this issue ยท 7 comments
Preliminaries:
- Shopkeepers version:
2.22.1
- Spigot version:
1.21
- I have checked that my issue/question does not get answered by:
- The documentation.
- The FAQ.
- The Known Issues.
- I have checked all open and closed issues, but none seems to fit my issue/question.
I was wondering if it would be able to add EI and maybe EB support. The way to do this is by making it just check the EI id.
I know this might require modify vanilla behaviors, and that might be something too hard to implement/impossible to implement.
Duplicate of: #852
However, also not a high priority for me currently. Ideally, I would want any item plugin compatibility features implemented as separate addon-plugins, maybe even maintained by someone who uses the plugin in question.
Duplicate of: #852
However, also not a high priority for me currently. Ideally, I would want any item plugin compatibility features implemented as separate addon-plugins, maybe even maintained by someone who uses the plugin in question.
Is it possible to do it by using only the API? Because if it is, i'll code it
Duplicate of: #852
However, also not a high priority for me currently. Ideally, I would want any item plugin compatibility features implemented as separate addon-plugins, maybe even maintained by someone who uses the plugin in question.Is it possible to do it by using only the API? Because if it is, i'll code it
The way to do this is by making it just check the EI id.
It is not possible to change the item comparison logic (results in client-side glitches if the server and MC client use different logic to decide whether a trade can be used or not).
However, my guess is that you would only need some way to update the shopkeeper trade items to match the latest revision defined by the ExecutableItems plugin whenever the ExecutableItems plugin, the Shopkeepers plugin, or your addon plugin are reloaded.
I.e. maybe some Shopkeeper#updateItems()
method that can be invoked on individual shopkeepers, which calls a new ShopkeeperUpdateItemEvent
for each trade item, as well as for any other stored item (e.g. the hire cost item of player shops, or equipment items stored by mobs (upcoming feature)). And there could be some top-level ShopkeepersAPI#updateItems()
to invoke this for all shopkeepers, as well as for any other items stored by the plugin (e.g. currency items inside the config, etc.).
And your and other add-on plugins could then hook into the event, check if the item matches the item-plugin your addon is dealing with, and then replace the item with an updated version.
And the plugin would detect these changes, update the internal items / trades, and trigger a save of all changed data.
The same probably applies for these integrations as well:
I would be willing to add such an API to the plugin (no ETA) if you are willing to implement, make available, and maintain an open source add-on plugin available for Spigot that makes use of.
Duplicate of: #852
However, also not a high priority for me currently. Ideally, I would want any item plugin compatibility features implemented as separate addon-plugins, maybe even maintained by someone who uses the plugin in question.Is it possible to do it by using only the API? Because if it is, i'll code it
The way to do this is by making it just check the EI id.
It is not possible to change the item comparison logic (results in client-side glitches if the server and MC client use different logic to decide whether a trade can be used or not).
However, my guess is that you would only need some way to update the shopkeeper trade items to match the latest revision defined by the ExecutableItems plugin whenever the ExecutableItems plugin, the Shopkeepers plugin, or your addon plugin are reloaded.
I.e. maybe some
Shopkeeper#updateItems()
method that can be invoked on individual shopkeepers, which calls a newShopkeeperUpdateItemEvent
for each trade item, as well as for any other stored item (e.g. the hire cost item of player shops, or equipment items stored by mobs (upcoming feature)). And there could be some top-levelShopkeepersAPI#updateItems()
to invoke this for all shopkeepers, as well as for any other items stored by the plugin (e.g. currency items inside the config, etc.). And your and other add-on plugins could then hook into the event, check if the item matches the item-plugin your addon is dealing with, and then replace the item with an updated version. And the plugin would detect these changes, update the internal items / trades, and trigger a save of all changed data.The same probably applies for these integrations as well:
I would be willing to add such an API to the plugin (no ETA) if you are willing to implement, make available, and maintain an open source add-on plugin available for Spigot that makes use of.
Yeah, I would maintain it
In fact it would be only using the getExecutableItem method and then using the method you said
@Reddishye The discussed feature has been added in the latest snapshot version of the plugin: 20f67c9
An example of how to use it can be found here: https://github.com/Shopkeepers/Shopkeepers-APISamples/tree/master/src/main/java/de/blablubbabc/shopkeepersAPISamples/itemUpdates
Let me know once you have an integration for ExecutableItems available on Spigot and Github. I will then link to it from the plugin page. If you have any questions let me know.