Skip to content

Commit

Permalink
Protects NPCs from being removed at login or /island
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Nov 4, 2017
1 parent 4c9d1e4 commit 0bdc659
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/com/wasteofplastic/askyblock/GridManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1591,16 +1591,11 @@ public void removeMobs(final Location l) {
if (c.isLoaded()) {
for (final Entity e : c.getEntities()) {
//plugin.getLogger().info("DEBUG: " + e.getType());

// Don't remove if the entity is an NPC or has a name tag
if (e.getCustomName() != null || e.hasMetadata("NPC"))
continue;
if (e instanceof Monster && !Settings.mobWhiteList.contains(e.getType())) {
Monster monster = (Monster)e;
//plugin.getLogger().info("DEBUG: monster found. custom name is '" + monster.getCustomName() + "'");
//plugin.getLogger().info("DEBUG: remove when far away = " + monster.getRemoveWhenFarAway());

// Don't remove if the monster has a name tag
if (monster.getCustomName() == null || monster.getRemoveWhenFarAway()) {
e.remove();
}
e.remove();
}
}
}
Expand Down

0 comments on commit 0bdc659

Please sign in to comment.