自定義安裝
自定義安裝為 v0.1.1 版本之後的重大更新之一。
/**
* 我的安裝
*/
public interface MyExampleInstallation {
/**
* 放一些 String 進去
* @param key key
* @param value value
*/
void putSomeValue(String key, String value);
}@ELDBukkit(
lifeCycle = TutorialLifeCycle.class,
registry = TutorialRegistry.class
)
public class TutorialPlugin extends ELDBukkitPlugin {
@Override
public void bindServices(ServiceCollection serviceCollection) {
serviceCollection.bindService(ExampleService.class, ExampleServiceImpl.class);
// 取出模組安裝器 (需要依賴 eldependenci-addon)
AddonInstallation addonManager = serviceCollection.getInstallation(AddonInstallation.class);
MyExampleInstallationImpl installation = new MyExampleInstallationImpl();
// 添加安裝器
addonManager.customInstallation(MyExampleInstallation.class, installation);
// 安裝 guice module
addonManager.installModule(new MyExampleModule(installation));
}
@Override
protected void manageProvider(BukkitManagerProvider bukkitManagerProvider) {
}
}被註冊後的處理
最后更新于