diff --git a/src/main/java/net/aufdemrand/denizen/flags/FlagManager.java b/src/main/java/net/aufdemrand/denizen/flags/FlagManager.java index b4146c93b4..e7402c1320 100644 --- a/src/main/java/net/aufdemrand/denizen/flags/FlagManager.java +++ b/src/main/java/net/aufdemrand/denizen/flags/FlagManager.java @@ -1,11 +1,12 @@ package net.aufdemrand.denizen.flags; +import net.aufdemrand.denizen.BukkitScriptEntryData; import net.aufdemrand.denizen.Denizen; -import net.aufdemrand.denizen.events.EventManager; +import net.aufdemrand.denizencore.events.OldEventManager; import net.aufdemrand.denizen.events.core.FlagSmartEvent; import net.aufdemrand.denizen.objects.*; import net.aufdemrand.denizen.utilities.DenizenAPI; -import net.aufdemrand.denizencore.objects.Duration; +import net.aufdemrand.denizencore.objects.*; import org.bukkit.configuration.ConfigurationSection; import java.util.*; @@ -356,15 +357,15 @@ else if (npc != null) { world_script_events.add(type + " flag cleared"); world_script_events.add(type + " flag " + OldName + " cleared"); - context.put("owner", Element.valueOf(OldOwner)); - context.put("name", Element.valueOf(OldName)); - context.put("type", Element.valueOf(type)); + context.put("owner", new Element(OldOwner)); + context.put("name", new Element(OldName)); + context.put("type", new Element(type)); context.put("old_value", OldValue); world_script_events.add("flag cleared"); - EventManager.doEvents(world_script_events, - npc, player, context); + OldEventManager.doEvents(world_script_events, + new BukkitScriptEntryData(player, npc), context); } } @@ -607,8 +608,8 @@ else if (npc != null) { world_script_events.add("flag changed"); - EventManager.doEvents(world_script_events, - npc, player, context); + OldEventManager.doEvents(world_script_events, + new BukkitScriptEntryData(player, npc), context); } } @@ -699,8 +700,8 @@ else if (npc != null) { world_script_events.add("flag expires"); - EventManager.doEvents(world_script_events, - npc, player, context); + OldEventManager.doEvents(world_script_events, + new BukkitScriptEntryData(player, npc), context); } return true; } diff --git a/src/main/java/net/aufdemrand/denizen/tags/core/NPCTags.java b/src/main/java/net/aufdemrand/denizen/tags/core/NPCTags.java index 6b56086ea8..1459d1437d 100644 --- a/src/main/java/net/aufdemrand/denizen/tags/core/NPCTags.java +++ b/src/main/java/net/aufdemrand/denizen/tags/core/NPCTags.java @@ -1,7 +1,7 @@ package net.aufdemrand.denizen.tags.core; +import net.aufdemrand.denizen.BukkitScriptEntryData; import net.aufdemrand.denizen.Denizen; -import net.aufdemrand.denizencore.events.EventManager; import net.aufdemrand.denizen.tags.BukkitTagContext; import net.aufdemrand.denizencore.events.OldEventManager; import net.aufdemrand.denizencore.objects.Element; @@ -29,6 +29,7 @@ import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Map; public class NPCTags implements Listener { @@ -110,7 +111,7 @@ public void navComplete(NavigationCompleteEvent event) { // Do world script event 'On NPC Completes Navigation' if (NPCNavigationSmartEvent.IsActive()) OldEventManager.doEvents(Arrays.asList - ("npc completes navigation"), npc, null, null); + ("npc completes navigation"), new BukkitScriptEntryData(null, npc), null); // Do the assignment script action if (!event.getNPC().hasTrait(AssignmentTrait.class)) return; @@ -149,7 +150,7 @@ public void navBegin(NavigationBeginEvent event) { // Do world script event 'On NPC Completes Navigation' if (NPCNavigationSmartEvent.IsActive()) OldEventManager.doEvents(Arrays.asList - ("npc begins navigation"), npc, null, null); + ("npc begins navigation"), new BukkitScriptEntryData(null, npc), null); if (!event.getNPC().hasTrait(AssignmentTrait.class)) return; npc.action("begin navigation", null); @@ -205,7 +206,7 @@ public void navCancel(NavigationCancelEvent event) { if (NPCNavigationSmartEvent.IsActive()) OldEventManager.doEvents(Arrays.asList - ("npc cancels navigation"), npc, null, null); + ("npc cancels navigation"), new BukkitScriptEntryData(null, npc), null); if (!event.getNPC().hasTrait(AssignmentTrait.class)) return; npc.action("cancel navigation", null); @@ -251,12 +252,14 @@ public void navStuck(NavigationStuckEvent event) { // Do world script event 'On NPC stuck' if (NPCNavigationSmartEvent.IsActive()) { - String determination = OldEventManager.doEvents(Arrays.asList - ("npc stuck"), npc, null, context); - if (determination.equalsIgnoreCase("none")) - event.setAction(null); - if (determination.equalsIgnoreCase("teleport")) - event.setAction(TeleportStuckAction.INSTANCE); + List determinations = OldEventManager.doEvents(Arrays.asList + ("npc stuck"), new BukkitScriptEntryData(null, npc), context); + for (String determination: determinations) { + if (determination.equalsIgnoreCase("none")) + event.setAction(null); + if (determination.equalsIgnoreCase("teleport")) + event.setAction(TeleportStuckAction.INSTANCE); + } } // Do the assignment script action