mirror of
https://github.com/BentoBoxWorld/Limits.git
synced 2024-11-26 04:25:41 +01:00
Removed code smells.
This commit is contained in:
parent
088f853f0a
commit
989143d218
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user