Search in sources :

Example 1 with GuardianStartingEvent

use of com.ichorpowered.guardian.event.GuardianStartingEvent in project guardian by ichorpowered.

the class GamePluginFacet method startup.

public Boolean startup() {
    this.facetState = FacetState.PREPARE;
    PropertyInjector propertyInjector = this.plugin.getPropertyInjector();
    propertyInjector.inject("state", GuardianState.STARTING);
    // STATE: STARTING
    this.logger.info(ConsoleUtil.of(this.facetPrefix + "Preparing environment adaptions."));
    // TODO: Environment adaptions are a future feature.
    this.plugin.getSequenceTask().start();
    this.plugin.getEventBus().post(new GuardianStartingEvent(this.plugin, Origin.source(this.plugin.getPluginContainer()).build()));
    propertyInjector.inject("state", GuardianState.STARTED);
    // STATE: STARTED
    this.logger.info(ConsoleUtil.of(this.facetPrefix + "Startup complete. ({} sec)", String.valueOf((double) (System.currentTimeMillis() - this.plugin.getCoreTime()) / 1000)));
    this.plugin.getEventBus().post(new GuardianStartedEvent(this.plugin, Origin.source(this.plugin.getPluginContainer()).build()));
    this.facetState = FacetState.START;
    return true;
}
Also used : PropertyInjector(com.ichorpowered.guardian.util.property.PropertyInjector) GuardianStartedEvent(com.ichorpowered.guardian.event.GuardianStartedEvent) GuardianStartingEvent(com.ichorpowered.guardian.event.GuardianStartingEvent)

Aggregations

GuardianStartedEvent (com.ichorpowered.guardian.event.GuardianStartedEvent)1 GuardianStartingEvent (com.ichorpowered.guardian.event.GuardianStartingEvent)1 PropertyInjector (com.ichorpowered.guardian.util.property.PropertyInjector)1