use of com.ichorpowered.guardian.event.GuardianPreInitializationEvent in project guardian by ichorpowered.
the class CorePluginFacet method startup.
public Boolean startup(SimpleFacetMessage componentMessage) {
this.facetState = FacetState.PREPARE;
SimpleGuardian.setInstance(this.plugin);
PropertyInjector propertyInjector = this.plugin.getPropertyInjector();
propertyInjector.inject("state", GuardianState.PRE_INITIALIZATION);
// STATE: PRE_INITIALIZATION
if (PluginInfo.EXPERIMENTAL) {
this.logger.warn(ConsoleUtil.of(Ansi.Color.RED, "You are using an experimental build of Guardian."));
this.logger.warn(ConsoleUtil.of(Ansi.Color.RED, "This may not be ready for a production environment. Use at your own risk!"));
}
this.logger.info(ConsoleUtil.of("Guardian v{} for Sponge {} and Minecraft {}", PluginInfo.VERSION, Sponge.getPlatform().getContainer(Platform.Component.API).getVersion().map(version -> version.substring(0, 5)).orElse("?"), Sponge.getPlatform().getContainer(Platform.Component.GAME).getVersion().orElse("?")));
Sponge.getServiceManager().setProvider(this.plugin, AntiCheatService.class, new GuardianBypassService(this.plugin));
ModuleController<GuardianPlugin> moduleController = ShadedModularFramework.registerModuleController(this.plugin, Sponge.getGame());
SimpleEventBus<GuardianEvent, GuardianListener> eventBus = new SimpleEventBus<>(new ASMEventExecutorFactory<GuardianEvent, GuardianListener>());
this.logger.info(ConsoleUtil.of("Loaded pre-facet systems: { me4502/modularframework v1.8.5, kyoripowered/event v1.0.0 }"));
// PROVIDE: PRE_INITIALIZATION
propertyInjector.inject("coreTime", componentMessage.getTime());
propertyInjector.inject("moduleController", moduleController);
propertyInjector.inject("eventBus", eventBus);
this.plugin.getEventBus().post(new GuardianPreInitializationEvent(Origin.source(this.plugin.getPluginContainer()).build()));
propertyInjector.inject("state", GuardianState.INITIALIZATION);
// State: INITIALIZATION
this.logger.info(this.facetPrefix + "Initializing storage.");
Configuration configuration = new Configuration(this.plugin, this.plugin.getConfigDirectory());
configuration.load();
this.logger.info(this.facetPrefix + "Initializing registries.");
InternalBypassService internalBypassService = new InternalBypassService(this.plugin);
GuardianDetectionManager detectionManager = new GuardianDetectionManager(this.plugin);
SequenceRegistry<Event> sequenceRegistry = new SequenceRegistry<>();
this.logger.info(this.facetPrefix + "Initializing systems.");
GuardianSequenceManager sequenceManager = new GuardianSequenceManager(this.plugin, sequenceRegistry);
GuardianSequenceManager.SequenceTask sequenceTask = new GuardianSequenceManager.SequenceTask(this.plugin, sequenceManager);
GuardianSequenceListener sequenceListener = new GuardianSequenceListener(this.plugin);
Common common = new Common(this.plugin);
GuardianContentKeys contentKeys = new GuardianContentKeys();
contentKeys.createKeys();
// PROVIDE: INITIALIZATION
propertyInjector.inject("common", common);
propertyInjector.inject("configuration", configuration);
propertyInjector.inject("internalBypassService", internalBypassService);
propertyInjector.inject("detectionManager", detectionManager);
propertyInjector.inject("sequenceManager", sequenceManager);
propertyInjector.inject("sequenceTask", sequenceTask);
propertyInjector.inject("sequenceRegistry", sequenceRegistry);
propertyInjector.inject("sequenceListener", sequenceListener);
this.plugin.getEventBus().post(new GuardianInitializationEvent(Origin.source(this.plugin.getPluginContainer()).build()));
this.facetState = FacetState.START;
return true;
}
Aggregations