Add spawn limits in config.yml

Enables per-world specification of mob spawning.
This commit is contained in:
tastybento 2020-09-27 18:12:22 -07:00
parent 908c2681a4
commit 4ecc4c5203
3 changed files with 254 additions and 84 deletions

View File

@ -38,14 +38,14 @@ public class CaveBlock extends GameModeAddon
// Player Command
this.playerCommand = new DefaultPlayerCommand(this)
{
@Override
public void setup()
{
@Override
public void setup()
{
super.setup();
new IslandAboutCommand(this);
}
};
super.setup();
new IslandAboutCommand(this);
}
};
// Admin command.
this.adminCommand = new DefaultAdminCommand(this) {};
@ -141,7 +141,8 @@ public class CaveBlock extends GameModeAddon
environment(World.Environment.NORMAL).
generator(this.chunkGenerator).
createWorld();
// Set spawn rates
setSpawnRates(islandWorld);
// Make the nether if it does not exist
@ -167,6 +168,7 @@ public class CaveBlock extends GameModeAddon
environment(World.Environment.NETHER).
createWorld();
}
setSpawnRates(netherWorld);
}
// Make the end if it does not exist
@ -191,10 +193,24 @@ public class CaveBlock extends GameModeAddon
environment(World.Environment.THE_END).
createWorld();
}
setSpawnRates(endWorld);
}
}
private void setSpawnRates(World w) {
if (w != null) {
w.setMonsterSpawnLimit(getSettings().getSpawnLimitMonsters());
w.setAmbientSpawnLimit(getSettings().getSpawnLimitAmbient());
w.setAnimalSpawnLimit(getSettings().getSpawnLimitAnimals());
w.setWaterAnimalSpawnLimit(getSettings().getSpawnLimitWaterAnimals());
w.setTicksPerAnimalSpawns(getSettings().getTicksPerAnimalSpawns());
w.setTicksPerMonsterSpawns(getSettings().getTicksPerMonsterSpawns());
}
}
/**
* Defines the world generator for this game mode
*

View File

@ -1906,11 +1906,99 @@ public class Settings implements WorldSettings
this.defaultTheEndBiome = defaultTheEndBiome;
}
/**
* @return the spawnLimitMonsters
*/
public int getSpawnLimitMonsters() {
return spawnLimitMonsters;
}
/**
* @param spawnLimitMonsters the spawnLimitMonsters to set
*/
public void setSpawnLimitMonsters(int spawnLimitMonsters) {
this.spawnLimitMonsters = spawnLimitMonsters;
}
/**
* @return the spawnLimitAnimals
*/
public int getSpawnLimitAnimals() {
return spawnLimitAnimals;
}
/**
* @param spawnLimitAnimals the spawnLimitAnimals to set
*/
public void setSpawnLimitAnimals(int spawnLimitAnimals) {
this.spawnLimitAnimals = spawnLimitAnimals;
}
/**
* @return the spawnLimitWaterAnimals
*/
public int getSpawnLimitWaterAnimals() {
return spawnLimitWaterAnimals;
}
/**
* @param spawnLimitWaterAnimals the spawnLimitWaterAnimals to set
*/
public void setSpawnLimitWaterAnimals(int spawnLimitWaterAnimals) {
this.spawnLimitWaterAnimals = spawnLimitWaterAnimals;
}
/**
* @return the spawnLimitAmbient
*/
public int getSpawnLimitAmbient() {
return spawnLimitAmbient;
}
/**
* @param spawnLimitAmbient the spawnLimitAmbient to set
*/
public void setSpawnLimitAmbient(int spawnLimitAmbient) {
this.spawnLimitAmbient = spawnLimitAmbient;
}
/**
* @return the ticksPerAnimalSpawns
*/
public int getTicksPerAnimalSpawns() {
return ticksPerAnimalSpawns;
}
/**
* @param ticksPerAnimalSpawns the ticksPerAnimalSpawns to set
*/
public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) {
this.ticksPerAnimalSpawns = ticksPerAnimalSpawns;
}
/**
* @return the ticksPerMonsterSpawns
*/
public int getTicksPerMonsterSpawns() {
return ticksPerMonsterSpawns;
}
/**
* @param ticksPerMonsterSpawns the ticksPerMonsterSpawns to set
*/
public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) {
this.ticksPerMonsterSpawns = ticksPerMonsterSpawns;
}
// ---------------------------------------------------------------------
// Section: Variables
// ---------------------------------------------------------------------
/* Commands */
@ConfigComment("Cave Command. What command users will run to access their cave.")
@ConfigComment("To define alias, just separate commands with white space.")
@ -1949,6 +2037,25 @@ public class Settings implements WorldSettings
@ConfigEntry(path = "world.difficulty")
private Difficulty difficulty = Difficulty.HARD;
@ConfigComment("Spawn limits. These override the limits set in bukkit.yml")
@ConfigComment("If set to a negative number, the server defaults will be used")
@ConfigEntry(path = "world.spawn-limits.monsters", since = "1.15.1")
private int spawnLimitMonsters = -1;
@ConfigEntry(path = "world.spawn-limits.animals", since = "1.15.1")
private int spawnLimitAnimals = -1;
@ConfigEntry(path = "world.spawn-limits.water-animals", since = "1.15.1")
private int spawnLimitWaterAnimals = -1;
@ConfigEntry(path = "world.spawn-limits.ambient", since = "1.15.1")
private int spawnLimitAmbient = -1;
@ConfigComment("Setting to 0 will disable animal spawns, but this is not recommended. Minecraft default is 400.")
@ConfigComment("A negative value uses the server default")
@ConfigEntry(path = "world.spawn-limits.ticks-per-animal-spawns", since = "1.15.1")
private int ticksPerAnimalSpawns = -1;
@ConfigComment("Setting to 0 will disable monster spawns, but this is not recommended. Minecraft default is 400.")
@ConfigComment("A negative value uses the server default")
@ConfigEntry(path = "world.spawn-limits.ticks-per-monster-spawns", since = "1.15.1")
private int ticksPerMonsterSpawns = -1;
@ConfigComment("Radius of cave in blocks. (So distance between caves is twice this)")
@ConfigComment("Will be rounded up to the nearest 16 blocks.")
@ConfigComment("It is the same for every dimension : Overworld, Nether and End.")

View File

@ -1,4 +1,4 @@
# CaveBlock Configuration 1.14.0-SNAPSHOT-LOCAL
# CaveBlock Configuration {$version}
caveblock:
command:
# Cave Command. What command users will run to access their cave.
@ -26,6 +26,25 @@ world:
# World difficulty setting - PEACEFUL, EASY, NORMAL, HARD
# Other plugins may override this setting
difficulty: HARD
spawn-limits:
# Spawn limits. These override the limits set in bukkit.yml
# If set to a negative number, the server defaults will be used
# Added since 1.15.1.
monsters: -1
# Added since 1.15.1.
animals: -1
# Added since 1.15.1.
water-animals: -1
# Added since 1.15.1.
ambient: -1
# Setting to 0 will disable animal spawns, but this is not recommended. Minecraft default is 400.
# A negative value uses the server default
# Added since 1.15.1.
ticks-per-animal-spawns: -1
# Setting to 0 will disable monster spawns, but this is not recommended. Minecraft default is 400.
# A negative value uses the server default
# Added since 1.15.1.
ticks-per-monster-spawns: -1
# Radius of cave in blocks. (So distance between caves is twice this)
# Will be rounded up to the nearest 16 blocks.
# It is the same for every dimension : Overworld, Nether and End.
@ -66,7 +85,7 @@ world:
# The permission caveblock.ban.maxlimit.X where X is a number can also be used per player
# -1 = unlimited
ban-limit: -1
#
#
# This is cave.. no height... only depth. Max 256.
# Should not be less then cave height.
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
@ -75,7 +94,7 @@ world:
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
generation-tries: 2
normal:
#
#
# Make over world roof of bedrock, if false, it will be made from stone
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
roof: true
@ -84,7 +103,7 @@ world:
floor: true
# Main block of which world will be generated.
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
main-block: STONE
main-block: GLASS
# Blocks that will occasionally replace main block by random chance.
# Blocks will replace only main-block and will try to create packs that
# are set in their strings. Chance of spawning also is required.
@ -96,20 +115,24 @@ world:
# where max amount in pack are 5 per each subchunk!
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
blocks:
- MATERIAL:DIAMOND_ORE:1:5
- MATERIAL:GOLD_ORE:1:4
- MATERIAL:IRON_ORE:5:4
- MATERIAL:COAL_ORE:10:6
- MATERIAL:EMERALD_ORE:1:1
- MATERIAL:CLAY:10:6
- MATERIAL:DIRT:10:10
- MATERIAL:GRAVEL:20:6
- MATERIAL:GRANITE:20:10
- MATERIAL:ANDESITE:20:10
- MATERIAL:DIORITE:30:8
- ENTITY:ZOMBIE:1:1
- ENTITY:DOLPHIN:0.1:1
- ENTITY:CAVE_SPIDER:1:1
- MATERIAL:DIAMOND_ORE:1:5
- MATERIAL:GOLD_ORE:1:4
- MATERIAL:IRON_ORE:5:4
- MATERIAL:COAL_ORE:10:6
- MATERIAL:EMERALD_ORE:1:1
- MATERIAL:CLAY:10:6
- MATERIAL:DIRT:20:10
- MATERIAL:GRAVEL:40:6
- MATERIAL:GRANITE:40:10
- MATERIAL:ANDESITE:20:10
- MATERIAL:DIORITE:30:8
- ENTITY:ZOMBIE:10:1
- ENTITY:ENDERMAN:10:1
- ENTITY:SKELETON:10:1
- ENTITY:CREEPER:1:1
- ENTITY:DOLPHIN:1:1
- ENTITY:BAT:10:1
- ENTITY:CAVE_SPIDER:10:1
nether:
# Generate Nether - if this is false, the nether world will not be made and access to
# the nether will not occur. Other plugins may still enable portal usage.
@ -148,16 +171,16 @@ world:
# where max amount in pack are 5 per each subchunk!
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
blocks:
- MATERIAL:NETHER_QUARTZ_ORE:30:5
- MATERIAL:SOUL_SAND:40:10
- MATERIAL:MAGMA_BLOCK:10:3
- MATERIAL:GLOWSTONE:20:8
- MATERIAL:NETHER_BRICKS:10:5
- MATERIAL:LAVA:10:1
- ENTITY:MAGMA_CUBE:0.5:1
- ENTITY:GHAST:0.1:1
- ENTITY:WITHER_SKELETON:0.1:1
- MATERIAL:FIRE:10:1
- MATERIAL:NETHER_QUARTZ_ORE:30:5
- MATERIAL:SOUL_SAND:40:10
- MATERIAL:MAGMA_BLOCK:10:3
- MATERIAL:GLOWSTONE:20:8
- MATERIAL:NETHER_BRICKS:10:5
- MATERIAL:LAVA:10:1
- ENTITY:MAGMA_CUBE:0.5:1
- ENTITY:GHAST:0.1:1
- ENTITY:WITHER_SKELETON:0.1:1
- MATERIAL:FIRE:10:1
end:
generate: true
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
@ -187,14 +210,14 @@ world:
# where max amount in pack are 5 per each subchunk!
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
blocks:
- ENTITY:SHULKER:0.2:1
- MATERIAL:OBSIDIAN:1:1
- MATERIAL:CHORUS_PLANT:1:3
- ENTITY:SHULKER:0.2:1
- MATERIAL:OBSIDIAN:1:1
- MATERIAL:CHORUS_PLANT:1:3
# Mob white list - these mobs will NOT be removed when logging in or doing /cave
remove-mobs-whitelist:
- WITHER
- ENDERMAN
- ZOMBIE_VILLAGER
- WITHER
- ENDERMAN
- ZOMBIE_VILLAGER
# World flags. These are boolean settings for various flags for this world
flags:
CREEPER_DAMAGE: true
@ -202,6 +225,7 @@ world:
PISTON_PUSH: false
ISLAND_RESPAWN: true
CREEPER_GRIEFING: false
COARSE_DIRT_TILLING: true
ENDERMAN_GRIEFING: true
CLEAN_SUPER_FLAT: false
CHEST_DAMAGE: false
@ -209,10 +233,14 @@ world:
NATURAL_SPAWNING_OUTSIDE_RANGE: true
ENTER_EXIT_MESSAGES: true
ENDERMAN_DEATH_DROP: true
LIQUIDS_FLOWING_OUT: false
OFFLINE_REDSTONE: true
OFFLINE_GROWTH: true
REMOVE_MOBS: true
ENDER_CHEST: false
ITEM_FRAME_DAMAGE: false
TREES_GROWING_OUTSIDE_RANGE: false
WITHER_DAMAGE: false
# These are the default protection settings for new caves.
# The value is the minimum cave rank required allowed to do the action.
# Ranks are the following:
@ -224,13 +252,16 @@ world:
# OWNER = 1000
default-cave-flags:
HURT_ANIMALS: 500
DRAGON_EGG: 500
REDSTONE: 500
BUCKET: 500
LOCK: 0
ENDER_PEARL: 500
DOOR: 500
BREAK_HOPPERS: 500
FURNACE: 500
ANVIL: 500
MINECART: 500
FISH_SCOOPING: 500
END_PORTAL: 500
BREEDING: 500
@ -238,31 +269,41 @@ world:
TURTLE_EGGS: 500
FROST_WALKER: 500
COLLECT_LAVA: 500
BREAK_SPAWNERS: 500
LEVER: 500
RIDING: 500
ELYTRA: 0
CAKE: 500
HURT_MONSTERS: 0
ARMOR_STAND: 500
RIDING: 500
NAME_TAG: 500
ARMOR_STAND: 500
TRADING: 0
EGGS: 500
ITEM_DROP: 0
NOTE_BLOCK: 0
FLINT_AND_STEEL: 500
NETHER_PORTAL: 500
LECTERN: 500
CROP_TRAMPLE: 500
ITEM_PICKUP: 0
DROPPER: 500
BREWING: 500
DROPPER: 500
TNT_PRIMING: 500
COLLECT_WATER: 500
BUTTON: 500
FIRE_EXTINGUISH: 500
COMMAND_RANKS: 500
BEACON: 500
TRAPDOOR: 500
EXPERIENCE_BOTTLE_THROWING: 500
PRESSURE_PLATE: 0
PLACE_BLOCKS: 500
DYE: 500
ITEM_FRAME: 500
PLACE_BLOCKS: 500
CRAFTING: 0
SHEARING: 500
ENCHANTING: 0
SHEARING: 500
BOAT: 500
BED: 500
SPAWN_EGGS: 500
MILKING: 0
@ -275,40 +316,46 @@ world:
BREAK_BLOCKS: 500
CHORUS_FRUIT: 500
CONTAINER: 500
JUKEBOX: 500
POTION_THROWING: 500
JUKEBOX: 500
# These are the default settings for new caves
default-cave-settings:
PVP_END: false
PVP_NETHER: false
ANIMAL_SPAWN: true
MONSTER_SPAWN: true
LEAF_DECAY: true
MONSTER_SPAWNERS_SPAWN: true
TNT_DAMAGE: true
ANIMAL_NATURAL_SPAWN: true
MONSTER_NATURAL_SPAWN: true
FIRE_IGNITE: true
FIRE_SPREAD: true
ANIMAL_SPAWNERS_SPAWN: true
FIRE_BURNING: true
PVP_OVERWORLD: false
# These settings/flags are hidden from users
# Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings
hidden-flags: []
# Visitor banned commands - Visitors to caves cannot use these commands in this world
visitor-banned-commands:
- spawner
- spawnmob
- spawner
- spawnmob
# Falling banned commands - players cannot use these commands when falling
# if the PREVENT_TELEPORT_WHEN_FALLING world setting flag is active
falling-banned-commands:
- warp
- spawn
- warp
- spawn
cave:
# Default max team size
# Permission size cannot be less than the default below.
# Permission size cannot be less than the default below.
max-team-size: 4
# Default maximum number of coop rank members per cave
# Players can have the caveblock.coop.maxsize.<number> permission to be bigger but
# permission size cannot be less than the default below.
# permission size cannot be less than the default below.
# Added since 1.13.0.
max-coop-size: 4
# Default maximum number of trusted rank members per cave
# Players can have the caveblock.trust.maxsize.<number> permission to be bigger but
# permission size cannot be less than the default below.
# permission size cannot be less than the default below.
# Added since 1.13.0.
max-trusted-size: 4
# Default maximum number of homes a player can have. Min = 1
@ -433,9 +480,9 @@ protection:
# Geo restrict mobs.
# Mobs that exit the cave space where they were spawned will be removed.
geo-limit-settings:
- GHAST
- BAT
- BLAZE
- GHAST
- BAT
- BLAZE
# CaveBlock blocked mobs.
# List of mobs that should not spawn in the CaveBlock.
# Added since 1.13.0.
@ -443,30 +490,30 @@ protection:
# Invincible visitors. List of damages that will not affect visitors.
# Make list blank if visitors should receive all damages
invincible-visitors:
- BLOCK_EXPLOSION
- CONTACT
- CUSTOM
- DROWNING
- ENTITY_ATTACK
- ENTITY_EXPLOSION
- FALL
- FALLING_BLOCK
- FIRE
- FIRE_TICK
- LAVA
- LIGHTNING
- MAGIC
- POISON
- PROJECTILE
- STARVATION
- SUFFOCATION
- THORNS
- WITHER
- DRAGON_BREATH
- FLY_INTO_WALL
- HOT_FLOOR
- CRAMMING
- VOID
- BLOCK_EXPLOSION
- CONTACT
- CUSTOM
- DROWNING
- ENTITY_ATTACK
- ENTITY_EXPLOSION
- FALL
- FALLING_BLOCK
- FIRE
- FIRE_TICK
- LAVA
- LIGHTNING
- MAGIC
- POISON
- PROJECTILE
- STARVATION
- SUFFOCATION
- THORNS
- WITHER
- DRAGON_BREATH
- FLY_INTO_WALL
- HOT_FLOOR
- CRAMMING
- VOID
do-not-edit-these-settings:
# These settings should not be edited
reset-epoch: 0