Skip to content

Commit

Permalink
Probably fix attack cancel errors
Browse files Browse the repository at this point in the history
I can't replicate the error with this code, but I never tested without
it so maybe I just can't replicate. Either way, here's some code that
de-stupids existing code.
  • Loading branch information
mcmonkey4eva committed Jan 14, 2015
1 parent 90898dc commit c1b223a
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -25,7 +25,7 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
if (!scriptEntry.hasObject("cancel")
&& arg.matches("cancel", "stop")) {

scriptEntry.addObject("cancel", "");
scriptEntry.addObject("cancel", "true");
}

else if (!scriptEntry.hasObject("target")
Expand Down Expand Up @@ -68,10 +68,10 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept
// Get objects
List<dEntity> entities = (List<dEntity>) scriptEntry.getObject("entities");
dEntity target = (dEntity) scriptEntry.getObject("target");
Boolean cancel = scriptEntry.hasObject("cancel");
boolean cancel = scriptEntry.hasObject("cancel");

// Report to dB
dB.report(scriptEntry, getName(), (cancel ? aH.debugObj("cancel", cancel) : "") +
dB.report(scriptEntry, getName(), (cancel ? aH.debugObj("cancel", "true") : "") +
aH.debugObj("entities", entities.toString()) +
(target != null ? aH.debugObj("target", target) : ""));

Expand All @@ -82,7 +82,7 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept
if (entity.isNPC()) {
Navigator nav = entity.getDenizenNPC().getCitizen().getNavigator();

if (cancel.equals(false)) {
if (!cancel) {
nav.setTarget(target.getBukkitEntity(), true);
}
else {
Expand All @@ -96,7 +96,7 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept
}
}
else {
if (cancel.equals(false)) {
if (!cancel) {
entity.target(target.getLivingEntity());
}
else {
Expand Down

0 comments on commit c1b223a

Please sign in to comment.