自定義安裝
自定義安裝為 v0.1.1 版本之後的重大更新之一。
/**
* 我的安裝
*/
public interface MyExampleInstallation {
/**
* 放一些 String 進去
* @param key key
* @param value value
*/
void putSomeValue(String key, String value);
}@ELDPlugin(
lifeCycle = TutorialLifeCycle.class,
registry = TutorialRegistry.class
)
public class TutorialPlugin extends ELDBukkitAddon {
@Override
protected void bindServices(ServiceCollection serviceCollection) {
serviceCollection.bindService(ExampleService.class, ExampleServiceImpl.class);
}
@Override
protected void preAddonInstall(ManagerProvider managerProvider, AddonManager addonManager) {
// 初始化安裝器
MyExampleInstallationImpl installation = new MyExampleInstallationImpl();
// 添加安裝器
addonManager.customInstallation(MyExampleInstallation.class, installation);
// 安裝 guice module
addonManager.installModule(new MyExampleModule(installation));
}
}被註冊後的處理
最后更新于