Class SpawnGroup
A spawn group bundles a unique identifier and a base chance used by the selection logic. In addition to the immutable identifier and chance, the instance exposes a set of optional, mutable properties that control how entities are spawned (e.g., range limits, blacklist, shared drops).
The constructor seeds these properties from the plugin's global configuration so the object starts with sensible defaults that can be overridden per group by calling the provided setters.
-
Constructor Summary
ConstructorsConstructorDescriptionSpawnGroup(String groupId, int spawnChance) Constructs a SpawnGroup with the given identifier and base chance. -
Method Summary
Modifier and TypeMethodDescriptionWhether spawns teleports above ground.List of world or biome identifiers that should not spawn entities for this group.Whether to show fireworks on spawn.Returns the unique identifier for this group.Whether to log deaths for this group.Whether to log spawns for this group.Names of shared drop tables to apply.intReturns the base chance value associated with this group.Per-range spawn limit amount.Range in blocks over which the spawn limit is evaluated.Maximum horizontal spawn range in blocks.static SpawnGroupInvalidSpawnGroup(String message) Creates a fallback SpawnGroup when configuration is invalid.voidsetAboveGround(Boolean aboveGround) Sets whether spawns teleports above ground.voidsetBlacklist(List<String> blacklist) Sets the blacklist for this group.voidsetFireworks(Boolean fireworks) Sets whether to show fireworks on spawn.voidsetLogDeaths(Boolean logDeaths) Sets whether to log deaths for this group.voidsetLogSpawns(Boolean logSpawns) Sets whether to log spawns for this group.voidsetSharedDrops(List<String> sharedDrops) Sets the shared drop tables to apply to entities spawned by this group.voidsetSpawnLimitAmount(Integer spawnLimitAmount) Sets the per-range spawn limit amount.voidsetSpawnLimitRange(Integer spawnLimitRange) Sets the range in blocks over which the spawn limit is evaluated.voidsetSpawnRangeMax(Integer spawnRangeMax) Sets the maximum horizontal spawn range in blocks.toString()Returns a diagnostic string including all group properties for logging/debugging.
-
Constructor Details
-
SpawnGroup
Constructs a SpawnGroup with the given identifier and base chance.All optional fields are initialized from the plugin's global configuration as starting defaults and may later be overridden via setters.
- Parameters:
groupId- non-null unique group identifierspawnChance- base chance associated with this group
-
-
Method Details
-
InvalidSpawnGroup
Creates a fallback SpawnGroup when configuration is invalid.An error is logged and a default group (as provided by
EntityCreator.getSpawnGroup("default")) is returned.- Parameters:
message- message describing why a fallback was required (logged as an error)- Returns:
- a default SpawnGroup instance
-
getGroupId
Returns the unique identifier for this group.- Returns:
- the group identifier (never null)
-
getSpawnChance
public int getSpawnChance()Returns the base chance value associated with this group.- Returns:
- the chance value
-
getLogSpawns
Whether to log spawns for this group.- Returns:
- true/false if explicitly set.
-
setLogSpawns
Sets whether to log spawns for this group.- Parameters:
logSpawns- true/false to override.
-
getLogDeaths
Whether to log deaths for this group.- Returns:
- true/false if explicitly set.
-
setLogDeaths
Sets whether to log deaths for this group.- Parameters:
logDeaths- true/false to override.
-
getAboveGround
Whether spawns teleports above ground.- Returns:
- true/false if explicitly set.
-
setAboveGround
Sets whether spawns teleports above ground.- Parameters:
aboveGround- true/false to override.
-
getSpawnRangeMax
Maximum horizontal spawn range in blocks.- Returns:
- max range.
-
setSpawnRangeMax
Sets the maximum horizontal spawn range in blocks.- Parameters:
spawnRangeMax- max range in blocks.
-
getSpawnLimitAmount
Per-range spawn limit amount.- Returns:
- limit amount.
-
setSpawnLimitAmount
Sets the per-range spawn limit amount.- Parameters:
spawnLimitAmount- amount.
-
getSpawnLimitRange
Range in blocks over which the spawn limit is evaluated.- Returns:
- limit range in blocks.
-
setSpawnLimitRange
Sets the range in blocks over which the spawn limit is evaluated.- Parameters:
spawnLimitRange- range in blocks.
-
getFireworks
Whether to show fireworks on spawn.- Returns:
- true/false if explicitly set.
-
setFireworks
Sets whether to show fireworks on spawn.- Parameters:
fireworks- true/false to override.
-
getBlacklist
List of world or biome identifiers that should not spawn entities for this group.- Returns:
- blacklist, possibly empty.
-
setBlacklist
Sets the blacklist for this group.- Parameters:
blacklist- list of identifiers.
-
toString
Returns a diagnostic string including all group properties for logging/debugging.The representation includes: groupId, spawnChance, aboveGround, spawnRangeMax, spawnLimitAmount, spawnLimitRange, fireworks, blacklist, and sharedDrops.
-