diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/PurgeCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/PurgeCommand.java index ece40bfd..c50fe50e 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/PurgeCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/PurgeCommand.java @@ -80,7 +80,14 @@ public class PurgeCommand extends MultiverseCommand { if (deathName.equalsIgnoreCase("all") || deathName.equalsIgnoreCase("animals") || deathName.equalsIgnoreCase("monsters")) { thingsToKill.add(deathName.toUpperCase()); } else { - Collections.addAll(thingsToKill, deathName.toUpperCase().split(",")); + for (String d :deathName.toUpperCase().split(",")) { + if(d.equalsIgnoreCase("dragon")){ //could be replaced with a Map(Hash?) to allow for all mobs to have multiple keywords + thingsToKill.add("ENDERDRAGON");// note UpperCase needed on this literal + } + else{ + thingsToKill.add(d); + } + } } for (MultiverseWorld w : worldsToRemoveEntitiesFrom) { purger.purgeWorld(sender, w, thingsToKill, false, false); diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/PurgeWorlds.java b/src/main/java/com/onarandombox/MultiverseCore/utils/PurgeWorlds.java index 3527a8f9..54230e45 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/PurgeWorlds.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/PurgeWorlds.java @@ -59,7 +59,8 @@ public class PurgeWorlds { return; } int entitiesKilled = 0; - for (Entity e : world.getEntities()) { + for (Entity e : world.getEntities()){ + this.plugin.log(Level.FINEST, "Entity list (aval for purge) from WORLD < " + mvworld.getName() + " >: " + e.toString()); // Check against Monsters if (killMonster(mvworld, e, thingsToKill, negateMonsters)) { @@ -106,8 +107,15 @@ public class PurgeWorlds { * @return */ private boolean killMonster(MultiverseWorld mvworld, Entity e, List creaturesToKill, boolean negate) { - String entityName = e.toString().replaceAll("Craft", "").toUpperCase(); - if (e instanceof Slime || e instanceof Monster || e instanceof Ghast) { + String entityName = ""; + if (e instanceof EnderDragon) { + this.plugin.log(Level.FINEST, "Found an enderdragon: " + e); + entityName = "ENDERDRAGON"; // Assumes that creaturesToKill contains the ENDERDRAGON keyword + } + else{ + entityName = e.toString().replaceAll("Craft", "").toUpperCase(); + } + if (e instanceof Slime || e instanceof Monster || e instanceof Ghast || e instanceof EnderDragon) { this.plugin.log(Level.FINER, "Looking at a monster: " + e); if (creaturesToKill.contains(entityName) || creaturesToKill.contains("ALL") || creaturesToKill.contains("MONSTERS")) { if (!negate) {