use of com.google.inject.Stage in project SpongeCommon by SpongePowered.
the class VanillaBootstrap method perform.
public static void perform(final String engineName, final Runnable engineStart) {
final Stage stage = SpongeGuice.getInjectorStage(Launch.instance().injectionStage());
SpongeCommon.logger().debug("Creating injector in stage '{}'", stage);
final Injector bootstrapInjector = Launch.instance().createInjector();
final SpongeLifecycle lifecycle = bootstrapInjector.getInstance(SpongeLifecycle.class);
Launch.instance().setLifecycle(lifecycle);
lifecycle.establishFactories();
lifecycle.establishBuilders();
lifecycle.initTimings();
((VanillaPluginManager) Launch.instance().pluginManager()).loadPlugins((VanillaPluginPlatform) Launch.instance().pluginPlatform());
lifecycle.callConstructEvent();
lifecycle.callRegisterFactoryEvent();
lifecycle.callRegisterBuilderEvent();
lifecycle.callRegisterChannelEvent();
lifecycle.establishGameServices();
lifecycle.establishDataKeyListeners();
SpongePacketHandler.init((SpongeChannelManager) Sponge.channelManager());
Launch.instance().logger().info("Loading Minecraft {}, please wait...", engineName);
engineStart.run();
}
use of com.google.inject.Stage in project guice by google.
the class OverrideModuleTest method testCorrectStage.
public void testCorrectStage() {
final Stage stage = Stage.PRODUCTION;
Module module = Modules.override(new AbstractModule() {
@Override
protected void configure() {
if (currentStage() != Stage.PRODUCTION) {
addError("Wronge stage in overridden module:" + currentStage());
}
}
}).with(new AbstractModule() {
@Override
protected void configure() {
if (currentStage() != Stage.PRODUCTION) {
addError("Wronge stage in overriding module:" + currentStage());
}
}
});
Guice.createInjector(stage, module);
}
Aggregations