Search in sources :

Example 1 with TimedQueue

use of net.aufdemrand.denizencore.scripts.queues.core.TimedQueue in project Denizen-For-Bukkit by DenizenScript.

the class AbstractTrigger method parse.

public boolean parse(dNPC npc, dPlayer player, InteractScriptContainer script, String id, Map<String, dObject> context) {
    if (npc == null || player == null || script == null) {
        return false;
    }
    List<ScriptEntry> entries = script.getEntriesFor(this.getClass(), player, npc, id, true);
    if (entries.isEmpty()) {
        return false;
    }
    dB.echoDebug(script, DebugElement.Header, "Parsing " + name + " trigger: n@" + npc.getName() + "/p@" + player.getName());
    // Create Queue
    TimedQueue queue = TimedQueue.getQueue(ScriptQueue.getNextId(script.getName()));
    // Add all entries to set it up
    queue.addEntries(entries);
    // Add context
    if (context != null) {
        OldEventManager.OldEventContextSource oecs = new OldEventManager.OldEventContextSource();
        oecs.contexts = context;
        queue.setContextSource(oecs);
    }
    // Start it
    queue.start();
    return true;
}
Also used : OldEventManager(net.aufdemrand.denizencore.events.OldEventManager) ScriptEntry(net.aufdemrand.denizencore.scripts.ScriptEntry) TimedQueue(net.aufdemrand.denizencore.scripts.queues.core.TimedQueue)

Aggregations

OldEventManager (net.aufdemrand.denizencore.events.OldEventManager)1 ScriptEntry (net.aufdemrand.denizencore.scripts.ScriptEntry)1 TimedQueue (net.aufdemrand.denizencore.scripts.queues.core.TimedQueue)1