Skip to content

Commit

Permalink
Fix errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed Aug 28, 2013
1 parent 6e897e2 commit 970a5fd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 20 deletions.
9 changes: 3 additions & 6 deletions src/main/java/net/aufdemrand/denizen/CommandHandler.java
Expand Up @@ -5,8 +5,7 @@

import net.aufdemrand.denizen.listeners.AbstractListener;
import net.aufdemrand.denizen.npc.traits.*;
import net.aufdemrand.denizen.objects.Element;
import net.aufdemrand.denizen.objects.dPlayer;
import net.aufdemrand.denizen.objects.*;
import net.aufdemrand.denizen.scripts.ScriptHelper;
import net.aufdemrand.denizen.scripts.ScriptRegistry;
import net.aufdemrand.denizen.scripts.containers.ScriptContainer;
Expand All @@ -15,8 +14,6 @@
import net.aufdemrand.denizen.utilities.DenizenAPI;
import net.aufdemrand.denizen.utilities.ScriptRepo;
import net.aufdemrand.denizen.utilities.Utilities;
import net.aufdemrand.denizen.objects.dLocation;
import net.aufdemrand.denizen.objects.aH;
import net.aufdemrand.denizen.utilities.debugging.dB;
import net.citizensnpcs.Citizens;
import net.citizensnpcs.api.command.Command;
Expand Down Expand Up @@ -829,7 +826,7 @@ public void reload(CommandContext args, CommandSender sender, NPC npc) throws Co
Messaging.send(sender, ChatColor.RED + "There was an error loading your scripts, check the console for details!");
}
List<String> events = new ArrayList<String>();
Map<String, Object> context = new HashMap<String, Object>();
Map<String, dObject> context = new HashMap<String, dObject>();
events.add("reload scripts");
context.put("all", Element.TRUE);
context.put("sender", new Element(sender.getName()));
Expand All @@ -855,7 +852,7 @@ public void reload(CommandContext args, CommandSender sender, NPC npc) throws Co
Messaging.send(sender, ChatColor.RED + "There was an error loading your scripts, check the console for details!");
}
List<String> events = new ArrayList<String>();
Map<String, Object> context = new HashMap<String, Object>();
Map<String, dObject> context = new HashMap<String, dObject>();
events.add("reload scripts");
context.put("all", Element.FALSE);
context.put("haderror", new Element(ScriptHelper.getHadAnError()));
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/net/aufdemrand/denizen/flags/FlagManager.java
Expand Up @@ -154,7 +154,7 @@ public Value get(int index) {
public void clear() {
List<String> world_script_events = new ArrayList<String>();

Map<String, Object> context = new HashMap<String, Object>();
Map<String, dObject> context = new HashMap<String, dObject>();
dPlayer player = null;
if (dPlayer.matches(flagOwner))
player = dPlayer.valueOf(flagOwner);
Expand All @@ -180,12 +180,12 @@ else if (npc != null) {
world_script_events.add("server flag " + flagName + " cleared");
}

context.put("owner", flagOwner);
context.put("name", flagName);
context.put("type", type);
context.put("owner", Element.valueOf(flagOwner));
context.put("name", Element.valueOf(flagName));
context.put("type", Element.valueOf(type));
context.put("old_value", value.size() > 1
? new dList(denizen.getSaves().getStringList(flagPath))
: value.size() == 1 ? new Element(value.get(0).asString()): "null");
: value.size() == 1 ? new Element(value.get(0).asString()): Element.valueOf("null"));

world_script_events.add("flag cleared");

Expand Down Expand Up @@ -370,7 +370,7 @@ public void save() {

List<String> world_script_events = new ArrayList<String>();

Map<String, Object> context = new HashMap<String, Object>();
Map<String, dObject> context = new HashMap<String, dObject>();
dPlayer player = null;
if (dPlayer.matches(flagOwner)) player = dPlayer.valueOf(flagOwner);
dNPC npc = null;
Expand All @@ -394,12 +394,12 @@ else if (npc != null) {
world_script_events.add("server flag " + flagName + " changed");
}

context.put("owner", flagOwner);
context.put("name", flagName);
context.put("type", type);
context.put("owner", Element.valueOf(flagOwner));
context.put("name", Element.valueOf(flagName));
context.put("type", Element.valueOf(type));
context.put("old_value", value.size() > 1
? new dList(denizen.getSaves().getStringList(flagPath))
: value.size() == 1 ? new Element(value.get(0).asString()): "null");
: value.size() == 1 ? new Element(value.get(0).asString()): Element.valueOf("null"));

world_script_events.add("flag changed");

Expand Down
Expand Up @@ -2,6 +2,7 @@

import net.aufdemrand.denizen.objects.dEntity;
import net.aufdemrand.denizen.objects.dNPC;
import net.aufdemrand.denizen.objects.dObject;
import net.aufdemrand.denizen.utilities.DenizenAPI;
import net.citizensnpcs.api.event.NPCTraitCommandAttachEvent;
import net.citizensnpcs.api.persistence.Persist;
Expand Down Expand Up @@ -69,7 +70,7 @@ public void run() {
}
}
private void callAction(String act, Entity ent) {
Map<String, Object> context = new HashMap<String, Object>();
Map<String, dObject> context = new HashMap<String, dObject>();
context.put("entity", new dEntity(ent));
dnpc.action("mob " + act + " proximity", null, context);
dnpc.action(ent.getType().name() + " " + act + " proximity", null, context);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/aufdemrand/denizen/objects/dNPC.java
Expand Up @@ -208,7 +208,7 @@ public TriggerTrait getTriggerTrait() {
return getCitizen().getTrait(TriggerTrait.class);
}

public void action(String actionName, dPlayer player, Map<String, Object> context) {
public void action(String actionName, dPlayer player, Map<String, dObject> context) {
if (getCitizen() != null)
{
if (getCitizen().hasTrait(AssignmentTrait.class))
Expand Down
Expand Up @@ -1140,7 +1140,7 @@ public void inventoryClickEvent(InventoryClickEvent event) {
@EventHandler
public void inventoryDragEvent(InventoryDragEvent event) {

Map<String, Object> context = new HashMap<String, Object>();
Map<String, dObject> context = new HashMap<String, dObject>();
dItem item = new dItem(event.getOldCursor());

Player player = (Player) event.getWhoClicked();
Expand Down
Expand Up @@ -71,7 +71,7 @@ public void contextTags(ReplaceableTagEvent event) {
// First, check queue object context.
if (event.getScriptEntry().getResidingQueue().hasContext(type)) {
Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());
event.setReplaced(event.getScriptEntry().getResidingQueue().getContext(type).getAttribute(attriute.fulfill(2)));
event.setReplaced(event.getScriptEntry().getResidingQueue().getContext(type).getAttribute(attribute.fulfill(2)));
}

// Next, try to replace with task-script-defined context
Expand Down

0 comments on commit 970a5fd

Please sign in to comment.