Skip to content

Commit

Permalink
remove long-deprecated regions support
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 19, 2019
1 parent fdd5fe3 commit dda2bfc
Showing 1 changed file with 6 additions and 36 deletions.
Expand Up @@ -7,7 +7,6 @@
import com.denizenscript.denizen.objects.WorldTag;
import com.denizenscript.denizencore.exceptions.InvalidArgumentsException;
import com.denizenscript.denizencore.objects.Argument;
import com.denizenscript.denizencore.objects.core.ElementTag;
import com.denizenscript.denizencore.objects.ArgumentHelper;
import com.denizenscript.denizencore.objects.core.ListTag;
import com.denizenscript.denizencore.scripts.ScriptEntry;
Expand Down Expand Up @@ -58,10 +57,6 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
&& arg.matchesArgumentList(EntityTag.class)) {
scriptEntry.addObject("entities", arg.asType(ListTag.class).filter(EntityTag.class, scriptEntry));
}
else if (!scriptEntry.hasObject("region")
&& arg.matchesPrefix("region", "r")) {
scriptEntry.addObject("region", arg.asElement());
}
else if (!scriptEntry.hasObject("world")
&& arg.matchesArgumentType(WorldTag.class)) {
scriptEntry.addObject("world", arg.asType(WorldTag.class));
Expand Down Expand Up @@ -93,42 +88,26 @@ public void execute(final ScriptEntry scriptEntry) {
// Get objects
List<EntityTag> entities = (List<EntityTag>) scriptEntry.getObject("entities");
WorldTag world = (WorldTag) scriptEntry.getObject("world");
ElementTag region = (ElementTag) scriptEntry.getObject("region");

// Report to dB
if (scriptEntry.dbCallShouldDebug()) {
Debug.report(scriptEntry, getName(), ArgumentHelper.debugList("entities", entities) +
(region != null ? ArgumentHelper.debugObj("region", region) : ""));
Debug.report(scriptEntry, getName(), ArgumentHelper.debugList("entities", entities));
}

boolean conditionsMet;

// Go through all of our entities and remove them

for (EntityTag entity : entities) {

conditionsMet = true;

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

if (!entity.isGeneric()) {

if (region != null) {
Debug.echoError(scriptEntry.getResidingQueue(), "Region support is deprecated!");
/*conditionsMet = WorldGuardUtilities.inRegion
(entity.getBukkitEntity().getLocation(),
region.asString());*/
if (entity.isCitizensNPC()) {
entity.getDenizenNPC().getCitizen().destroy();
}

if (conditionsMet) {

if (entity.isCitizensNPC()) {
entity.getDenizenNPC().getCitizen().destroy();
}
else {
entity.remove();
}
else {
entity.remove();
}
}

Expand All @@ -150,16 +129,7 @@ public void execute(final ScriptEntry scriptEntry) {

if (entity.getEntityType().equals(DenizenEntityType.getByEntity(worldEntity))) {

if (region != null) {
Debug.echoError(scriptEntry.getResidingQueue(), "Region support is deprecated!");
/*conditionsMet = WorldGuardUtilities.inRegion
(worldEntity.getLocation(),
region.asString());*/
}

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

0 comments on commit dda2bfc

Please sign in to comment.