实现一个经济 API

Sponge 提供了一套供经济插件使用的接口。如果你想完整实现一个自己的经济插件,你必须实现下列六个类:

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

在实现经济 API 时要考虑的事情

  • 你有没有想要支持多种货币类型?

  • 有没有想让插件根据不同的上下文执行不同的操作?

当你在实现自己的经济插件的过程中遇到疑惑时,你可以翻阅 JavaDocs