Wdrażanie API gospodarki
Sponge provides interfaces for economy plugins to implement and create an API. In order to build a complete Economy API, you must implement six classes:
Registering Your Economy Service
When it comes to registering any service in Sponge, you can provide your service as an option with Sponge deciding which service to use if requested. This means that if two Economy Service plugins are used on a server, only one of the services will be used.
@Listener
public void registerEconomyService(ProvideServiceEvent.EngineScoped<MyCustomEconomyService> event){
event.suggest(() -> new MyCustomEconomyService());
}
Kwestie do rozważenia podczas implementowania API ekonomii
Czy chcesz uwzględnić wsparcie dla wielu typów walut?
Do I want to my plugin to perform different actions when given different contexts?
Implementing the Economy API is fairly straightforward, and the JavaDocs can be a great tool if you are unsure what a method is supposed to do.