Skip to content

Commit

Permalink
Fix Remove command.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcernat committed Jul 12, 2013
1 parent 251a8fb commit 0abab8a
Showing 1 changed file with 28 additions and 15 deletions.
Expand Up @@ -84,24 +84,33 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept
dB.report(getName(), aH.debugObj("entities", entities.toString()) +
(region != null ? aH.debugObj("region", region) : ""));

boolean conditionsMet;

// Go through all of our entities and remove them

for (dEntity entity : entities) {

conditionsMet = true;

// If this is a specific spawned entity, and all
// other applicable conditions are met, remove it

if (entity.isGeneric() == false
&& region == null ? true :
WorldGuardUtilities.inRegion
(entity.getBukkitEntity().getLocation(),
region.asString())) {
if (entity.isGeneric() == false) {

if (entity.isNPC()) {
entity.getNPC().destroy();
if (region != null) {
conditionsMet = WorldGuardUtilities.inRegion
(entity.getBukkitEntity().getLocation(),
region.asString());
}
else {
entity.remove();

if (conditionsMet == true) {

if (entity.isNPC()) {
entity.getNPC().destroy();
}
else {
entity.remove();
}
}
}

Expand All @@ -120,13 +129,17 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept
// as our current dEntity, and all other applicable
// conditions are met, remove it

if (entity.getEntityType().equals(worldEntity.getType())
&& region == null ? true :
WorldGuardUtilities.inRegion
(entity.getBukkitEntity().getLocation(),
region.asString())) {
if (entity.getEntityType().equals(worldEntity.getType())) {

if (region != null) {
conditionsMet = WorldGuardUtilities.inRegion
(worldEntity.getLocation(),
region.asString());
}

worldEntity.remove();
if (conditionsMet == true) {
worldEntity.remove();
}
}
}
}
Expand Down

0 comments on commit 0abab8a

Please sign in to comment.