Skip to content

Commit

Permalink
Cleanup NPC commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fortifier42 committed Jan 24, 2016
1 parent 143e949 commit aa8ba57
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Expand Up @@ -74,16 +74,14 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
dLocation location = (dLocation) scriptEntry.getObject("location");
Element range = (Element) scriptEntry.getObject("range");
Element id = (Element) scriptEntry.getObject("id");
dNPC npc = ((BukkitScriptEntryData) scriptEntry.entryData).getNPC();

// Report to dB
dB.report(scriptEntry, getName(),
aH.debugObj("NPC", ((BukkitScriptEntryData) scriptEntry.entryData).getNPC().toString())
+ action.name() + id.debug()
npc.debug() + action.name() + id.debug()
+ (location != null ? location.debug() : "")
+ (range != null ? range.debug() : ""));

dNPC npc = ((BukkitScriptEntryData) scriptEntry.entryData).getNPC();

if (!npc.getCitizen().hasTrait(Anchors.class)) {
npc.getCitizen().addTrait(Anchors.class);
}
Expand Down
Expand Up @@ -32,7 +32,7 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {

// Report to dB
dB.report(scriptEntry, getName(),
aH.debugObj("NPC", ((BukkitScriptEntryData) scriptEntry.entryData).getNPC().toString()));
((BukkitScriptEntryData) scriptEntry.entryData).getNPC().debug());

// Set Disengaged
EngageCommand.setEngaged(((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getCitizen(), false);
Expand Down
Expand Up @@ -2,6 +2,7 @@

import net.aufdemrand.denizen.BukkitScriptEntryData;
import net.aufdemrand.denizen.Settings;
import net.aufdemrand.denizen.objects.dNPC;
import net.aufdemrand.denizen.utilities.debugging.dB;
import net.aufdemrand.denizencore.exceptions.CommandExecutionException;
import net.aufdemrand.denizencore.exceptions.InvalidArgumentsException;
Expand Down Expand Up @@ -46,15 +47,16 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {

Duration duration = scriptEntry.getdObject("duration");
dNPC npc = ((BukkitScriptEntryData) scriptEntry.entryData).getNPC();

// Report to dB
dB.report(scriptEntry, getName(), duration.debug());
dB.report(scriptEntry, getName(), npc.debug() + duration.debug());

if (duration.getSecondsAsInt() > 0) {
setEngaged(((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getCitizen(), duration.getSecondsAsInt());
setEngaged(npc.getCitizen(), duration.getSecondsAsInt());
}
else {
setEngaged(((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getCitizen(), true);
setEngaged(npc.getCitizen(), true);
}

}
Expand Down
Expand Up @@ -63,14 +63,14 @@ else if (!scriptEntry.hasObject("percent")
public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {

dLocation location = scriptEntry.getdObject("location");
Element katch = scriptEntry.getElement("catch");
Element catchtype = scriptEntry.getElement("catch");
Element stop = scriptEntry.getElement("stop");
Element percent = scriptEntry.getElement("percent");

dNPC npc = ((BukkitScriptEntryData) scriptEntry.entryData).getNPC();
FishingTrait trait = npc.getFishingTrait();

dB.report(scriptEntry, getName(), location.debug() + katch.debug() + percent.debug() + stop.debug());
dB.report(scriptEntry, getName(), location.debug() + catchtype.debug() + percent.debug() + stop.debug());

if (stop.asBoolean()) {
trait.stopFishing();
Expand All @@ -80,7 +80,7 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
npc.getEquipmentTrait().set(0, new ItemStack(Material.FISHING_ROD));

trait.setCatchPercent(percent.asInt());
trait.setCatchType(FishingTrait.CatchType.valueOf(katch.asString().toUpperCase()));
trait.setCatchType(FishingTrait.CatchType.valueOf(catchtype.asString().toUpperCase()));
trait.startFishing(location);

}
Expand Down

0 comments on commit aa8ba57

Please sign in to comment.