경제 API 구현하기

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());
}

Things to consider when implementing the Economy API

  • Do I want to include support for multiple currency types?

  • 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.