Skip to content

Commit

Permalink
Add context.event_header for all actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Apr 15, 2016
1 parent 17aa720 commit df383ff
Showing 1 changed file with 10 additions and 5 deletions.
Expand Up @@ -7,6 +7,7 @@
import net.aufdemrand.denizen.scripts.containers.core.AssignmentScriptContainer;
import net.aufdemrand.denizen.utilities.debugging.dB;
import net.aufdemrand.denizencore.events.OldEventManager;
import net.aufdemrand.denizencore.objects.Element;
import net.aufdemrand.denizencore.objects.aH;
import net.aufdemrand.denizencore.objects.dObject;
import net.aufdemrand.denizencore.scripts.ScriptBuilder;
Expand All @@ -16,6 +17,7 @@
import net.aufdemrand.denizencore.scripts.queues.core.InstantQueue;
import net.aufdemrand.denizencore.utilities.debugging.dB.DebugElement;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand All @@ -34,6 +36,10 @@ public String doAction(String actionName, dNPC npc, dPlayer player, AssignmentSc

public String doAction(String actionName, dNPC npc, dPlayer player, AssignmentScriptContainer assignment, Map<String, dObject> context) {

if (context == null) {
context = new HashMap<String, dObject>();
}

String determination = "none";

if (assignment == null) {
Expand Down Expand Up @@ -69,11 +75,10 @@ public String doAction(String actionName, dNPC npc, dPlayer player, AssignmentSc
// Add entries and context to the queue
ScriptQueue queue = InstantQueue.getQueue(ScriptQueue.getNextId(assignment.getName())).addEntries(script);

if (context != null) {
OldEventManager.OldEventContextSource oecs = new OldEventManager.OldEventContextSource();
oecs.contexts = context;
queue.setContextSource(oecs);
}
OldEventManager.OldEventContextSource oecs = new OldEventManager.OldEventContextSource();
oecs.contexts = context;
oecs.contexts.put("event_header", new Element(actionName));
queue.setContextSource(oecs);

// Start the queue!
queue.start();
Expand Down

0 comments on commit df383ff

Please sign in to comment.