Removed code smells.

This commit is contained in:
tastybento 2020-07-26 14:35:05 -07:00
parent 088f853f0a
commit 989143d218
1 changed files with 15 additions and 19 deletions

View File

@ -113,7 +113,6 @@ public class EntityLimitListener implements Listener {
// Other natural reasons
break;
}
// BentoBox.getInstance().logDebug("Bypass check took " + getTime(timer));
// Tag the entity with the island spawn location
checkLimit(e, bypass);
}
@ -160,12 +159,11 @@ public class EntityLimitListener implements Listener {
}
private void checkLimit(CreatureSpawnEvent e, boolean bypass) {
Bukkit.getScheduler().runTaskAsynchronously(BentoBox.getInstance(), () -> {
Bukkit.getScheduler().runTaskAsynchronously(BentoBox.getInstance(), () ->
addon.getIslands().getIslandAt(e.getLocation()).ifPresent(island -> {
// Check if creature is allowed to spawn or not
AtLimitResult res;
if (!bypass && !island.isSpawn() && (res = atLimit(island, e.getEntity())).hit()) {
//// BentoBox.getInstance().logDebug("Entity limit hit");
// Not allowed
Bukkit.getScheduler().runTask(BentoBox.getInstance(), () -> {
e.getEntity().remove();
@ -176,9 +174,7 @@ public class EntityLimitListener implements Listener {
});
}
});
});
}));
}
private void replaceEntity(CreatureSpawnEvent e) {