use of com.ichorpowered.guardian.launch.message.SimpleFacetMessage in project guardian by ichorpowered.
the class FacetBootstrap method forceShutdown.
private void forceShutdown() {
SortedSet<String> backwards = new TreeSet<>(Collections.reverseOrder());
backwards.addAll(this.facets.keySet());
this.send(FacetRequest.SHUTDOWN, new SimpleFacetMessage(System.currentTimeMillis(), "Critical failure.", this.plugin), backwards);
}
use of com.ichorpowered.guardian.launch.message.SimpleFacetMessage 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;
}
use of com.ichorpowered.guardian.launch.message.SimpleFacetMessage in project guardian by ichorpowered.
the class GuardianPlugin method onGameReload.
// PLUGIN RELOAD
@Listener
public void onGameReload(GameReloadEvent event) {
this.facetBootstrap.send(FacetBootstrap.FacetRequest.RESTART, new SimpleFacetMessage(System.currentTimeMillis(), "Game Reload", this), "game");
this.facetBootstrap.send(FacetBootstrap.FacetRequest.RESTART, new SimpleFacetMessage(System.currentTimeMillis(), "Game Reload", this), "common");
}
use of com.ichorpowered.guardian.launch.message.SimpleFacetMessage in project guardian by ichorpowered.
the class GuardianPlugin method onGameInitialization.
// PLUGIN INITIALIZATION
@Listener
public void onGameInitialization(GameInitializationEvent event) {
this.facetBootstrap.addComponent("core", new CorePluginFacet(this.logger, this));
this.facetBootstrap.addComponent("common", new InternalPluginFacet(this.logger, this));
this.facetBootstrap.addComponent("game", new GamePluginFacet(this.logger, this));
this.facetBootstrap.send(FacetBootstrap.FacetRequest.STARTUP, new SimpleFacetMessage(System.currentTimeMillis(), "Game Initialization", this), "core");
}
use of com.ichorpowered.guardian.launch.message.SimpleFacetMessage in project guardian by ichorpowered.
the class FacetBootstrap method recover.
private void recover() {
this.attemptedRecoveries++;
final SortedSet<String> backwards = new TreeSet<>(Collections.reverseOrder());
backwards.addAll(this.facets.keySet());
this.send(FacetRequest.SHUTDOWN, new SimpleFacetMessage(System.currentTimeMillis(), "Error recovery.", this.plugin), backwards);
this.send(FacetRequest.STARTUP, new SimpleFacetMessage(System.currentTimeMillis(), "Error recovery.", this.plugin), this.facets.keySet());
}
Aggregations