fix: restrict spawners, a lot

LOL! Whoops!
This commit is contained in:
amyavi 2024-09-29 18:19:03 -03:00
parent a58ef649cf
commit 70f7134de9
Signed by: amy
SSH key fingerprint: SHA256:CoLIqZWDYPZEhs1j1HQWwV0j1JhC3BFWcaUF7ZLZHJA

View file

@ -131,23 +131,34 @@ public final class EntitySpawn implements Listener {
}
private void limitSpawner(final CreatureSpawner spawner) {
if (EntityType.MINECART_MOB_SPAWNER.equals(spawner.getSpawnedType())) {
spawner.setSpawnedType(EntityType.MINECART);
}
if (spawner.getDelay() > 100) {
spawner.setMaxSpawnDelay(100);
spawner.setDelay(100);
final EntityType spawnedType = spawner.getSpawnedType();
if (!spawnedType.isAlive() || spawnedType.equals(EntityType.ARMOR_STAND)) {
spawner.setSpawnedType(EntityType.PIG);
spawner.update();
}
if (spawner.getSpawnCount() > 200) {
spawner.setSpawnCount(200);
if (spawner.getMinSpawnDelay() <= 5000) {
spawner.setMinSpawnDelay(5000);
spawner.update();
}
if (spawner.getSpawnRange() > 50) {
spawner.setSpawnRange(50);
if (spawner.getMaxSpawnDelay() <= 10000) {
spawner.setMaxSpawnDelay(10000);
spawner.update();
}
if (spawner.getDelay() <= 5000) {
spawner.setDelay(5000);
spawner.update();
}
if (spawner.getSpawnCount() > 10) {
spawner.setSpawnCount(10);
spawner.update();
}
if (spawner.getSpawnRange() > 10) {
spawner.setSpawnRange(10);
spawner.update();
}
}