Add option to configure entity cap per chunk (closes #311)

This commit is contained in:
Allink 2022-05-17 08:00:57 +01:00
parent d2ee02ba6e
commit c3a674f8fd
No known key found for this signature in database
GPG key ID: 7F1F1B98F0FAAD13
2 changed files with 7 additions and 1 deletions

View file

@ -90,7 +90,11 @@ public final class EntitySpawn implements Listener {
default:
if (!EntityType.PLAYER.equals(entityType)) {
final int chunkEntityCount = chunk.getEntities().length;
final int chunkEntityCountLimit = 30;
final int chunkEntityCountLimit = PLUGIN.getConfig().getInt("maxEntitiesPerChunk");
if(chunkEntityCount == -1) {
return;
}
if (chunkEntityCount >= chunkEntityCountLimit) {
return true;
}

View file

@ -4,6 +4,8 @@ enableKick: false
enableJoinRestrictions: false
opOnJoin: true
randomizeSpawn: false
# Set to -1 to disable
maxEntitiesPerChunk: 30
playerJoinTitle: "§7Welcome to Kaboom!"
playerJoinSubtitle: "Free OP • Anarchy • Creative"
opTag: "§4§l[§c§lOP§4§l] §c"