-
Notifications
You must be signed in to change notification settings - Fork 14
Treasury Services API
This page is incomplete and invalid as of Treasury v2.0.0.
Whilst we're working on updating all the documentation to the new API, please contact us if you have any questions.
The way of retrieving any of the other Treasury API's (at the date of writing, the Treasury Economy API) is the Treasury Service API. It needed to be created because we aim the whole Treasury API to be completely platform independent. It is inspired by Bukkit's service api, but there are some QOL (quality-of-life) differences.
NOTE: The Treasury Service API is not limited to only providing Treasury's APIs, you have a green pass on using it for your custom APIs on platforms which don't provide a service API, or on platforms which do if you really wish to.
Treasury's Service API has 2 components which are completely necessary for it to function.
A Service is where from you are going to retrieve instance of a registered class service.
The ServiceRegistry is the way you are going to register/retrieve services.
The ServicePriority is the way of binding a priority to a service. Higher priority means whenever there is a request of the registered service it will be more likely to be provided.
Please see the Events wiki page to understand how Treasury's Events API works.
The ServiceRegisteredEvent is called whenever a Service has been registered.
The ServiceUnregisteredEvent is called whenever a Service has been unregistered.