Skip to content

Commit

Permalink
Little fix explode command for location arg
Browse files Browse the repository at this point in the history
  • Loading branch information
blankiito committed Jul 15, 2013
1 parent bba6b04 commit a31c8e3
Showing 1 changed file with 31 additions and 31 deletions.
Expand Up @@ -30,36 +30,36 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
// Location arg
scriptEntry.addObject("location", arg.asType(dLocation.class));
}
else if (!scriptEntry.hasObject("power")
else if (!scriptEntry.hasObject("power")
&& arg.matchesPrimitive(aH.PrimitiveType.Float)
&& arg.matchesPrefix("power, p")) {
// Add value
scriptEntry.addObject("power", arg.asElement());
}
else if (!scriptEntry.hasObject("breakblocks")
&& arg.matches("breakblocks")) {
scriptEntry.addObject("breakblocks", "");
}
else if (!scriptEntry.hasObject("fire")
&& arg.matches("fire")) {
scriptEntry.addObject("fire", "");
}
// Use default values if necessary
scriptEntry.defaultObject("power", new Element(1.0));
scriptEntry.defaultObject("location",
scriptEntry.hasNPC() ? scriptEntry.getNPC().getLocation() : null,
scriptEntry.hasPlayer() ? scriptEntry.getPlayer().getLocation() : null);
if (!scriptEntry.hasObject("location")) {
throw new InvalidArgumentsException(Messages.ERROR_MISSING_OTHER, "LOCATION");
}
else if (!scriptEntry.hasObject("breakblocks")
&& arg.matches("breakblocks")) {
scriptEntry.addObject("breakblocks", "");
}
else if (!scriptEntry.hasObject("fire")
&& arg.matches("fire")) {
scriptEntry.addObject("fire", "");
}
}

// Use default values if necessary
scriptEntry.defaultObject("power", new Element(1.0));
scriptEntry.defaultObject("location",
scriptEntry.hasNPC() ? scriptEntry.getNPC().getLocation() : null,
scriptEntry.hasPlayer() ? scriptEntry.getPlayer().getLocation() : null);
if (!scriptEntry.hasObject("location")) {
throw new InvalidArgumentsException(Messages.ERROR_MISSING_OTHER, "LOCATION");
}
}

Expand All @@ -74,13 +74,13 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept

// Report to dB
dB.report(getName(),
(aH.debugObj("location", location.toString()) +
aH.debugObj("power", power) +
aH.debugObj("breakblocks", breakblocks) +
aH.debugObj("fire", fire)));
(aH.debugObj("location", location.toString()) +
aH.debugObj("power", power) +
aH.debugObj("breakblocks", breakblocks) +
aH.debugObj("fire", fire)));

location.getWorld().createExplosion
(location.getX(), location.getY(), location.getZ(),
power.asFloat(), fire, breakblocks);
(location.getX(), location.getY(), location.getZ(),
power.asFloat(), fire, breakblocks);
}
}

0 comments on commit a31c8e3

Please sign in to comment.