Search in sources :

Example 1 with CustomEventStartEvent

use of com.magmaguy.elitemobs.api.CustomEventStartEvent in project EliteMobs by MagmaGuy.

the class ActionEvent method instantiateEvent.

public void instantiateEvent(Location location, Player player) {
    this.player = player;
    ActionEvent actionEvent = new ActionEvent(customEventsConfigFields);
    actionEvent.setEventStartLocation(location);
    CustomEventStartEvent customEventStartEvent = new CustomEventStartEvent(actionEvent);
    if (customEventStartEvent.isCancelled())
        return;
    if (!actionEvent.startConditions.areValid())
        return;
    for (String filename : primaryCustomBossFilenames) {
        CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity(filename);
        if (customBossEntity == null) {
            new WarningMessage("Failed to generate custom boss " + filename + " ! This has cancelled action event " + customEventsConfigFields.getFilename() + " !");
            return;
        }
        customBossEntity.spawn(actionEvent.getEventStartLocation(), false);
        actionEvent.primaryEliteMobs.add(customBossEntity);
    }
    actionEvent.start();
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity) CustomEventStartEvent(com.magmaguy.elitemobs.api.CustomEventStartEvent)

Example 2 with CustomEventStartEvent

use of com.magmaguy.elitemobs.api.CustomEventStartEvent in project EliteMobs by MagmaGuy.

the class TimedEvent method instantiateEvent.

/**
 * Just because the event is instantiated, does not necessarily mean it started. If the spawn isn't instant, then
 * it needs to be queued for a later date. If the spawn is instant but no valid location can be found, it should retry
 * on a delay.
 */
public void instantiateEvent() {
    new InfoMessage("Event " + getCustomEventsConfigFields().getFilename() + " has been queued!");
    TimedEvent timedEvent = new TimedEvent(customEventsConfigFields);
    CustomEventStartEvent customEventStartEvent = new CustomEventStartEvent(timedEvent);
    if (customEventStartEvent.isCancelled())
        return;
    timedEvent.customSpawn = new CustomSpawn(customEventsConfigFields.getCustomSpawn(), customEventsConfigFields.getBossFilenames(), timedEvent);
    // Failed to initialize event
    if (timedEvent.customSpawn.getCustomSpawnConfigFields() == null)
        return;
    // This handles the elitemobs-events flag
    timedEvent.customSpawn.setEvent(true);
    // Note: this will finish running at an arbitrary time in the future
    timedEvent.customSpawn.queueSpawn();
    // global cooldown - 60 seconds right now
    nextEventTrigger = System.currentTimeMillis() + globalCooldown * 60 * 1000;
    timedEvents.add(timedEvent);
}
Also used : CustomSpawn(com.magmaguy.elitemobs.mobconstructor.CustomSpawn) InfoMessage(com.magmaguy.elitemobs.utils.InfoMessage) CustomEventStartEvent(com.magmaguy.elitemobs.api.CustomEventStartEvent)

Aggregations

CustomEventStartEvent (com.magmaguy.elitemobs.api.CustomEventStartEvent)2 CustomSpawn (com.magmaguy.elitemobs.mobconstructor.CustomSpawn)1 CustomBossEntity (com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity)1 InfoMessage (com.magmaguy.elitemobs.utils.InfoMessage)1 WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)1