Class SpawnGroup

java.lang.Object
valorless.rarespawns.datamodels.SpawnGroup

public class SpawnGroup extends Object
Represents a spawn group used by the RareSpawns plugin.

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 Details

    • SpawnGroup

      public SpawnGroup(String groupId, int spawnChance)
      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 identifier
      spawnChance - base chance associated with this group
  • Method Details

    • InvalidSpawnGroup

      public static SpawnGroup InvalidSpawnGroup(String message)
      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

      public String 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

      public Boolean getLogSpawns()
      Whether to log spawns for this group.
      Returns:
      true/false if explicitly set.
    • setLogSpawns

      public void setLogSpawns(Boolean logSpawns)
      Sets whether to log spawns for this group.
      Parameters:
      logSpawns - true/false to override.
    • getLogDeaths

      public Boolean getLogDeaths()
      Whether to log deaths for this group.
      Returns:
      true/false if explicitly set.
    • setLogDeaths

      public void setLogDeaths(Boolean logDeaths)
      Sets whether to log deaths for this group.
      Parameters:
      logDeaths - true/false to override.
    • getAboveGround

      public Boolean getAboveGround()
      Whether spawns teleports above ground.
      Returns:
      true/false if explicitly set.
    • setAboveGround

      public void setAboveGround(Boolean aboveGround)
      Sets whether spawns teleports above ground.
      Parameters:
      aboveGround - true/false to override.
    • getSpawnRangeMax

      public Integer getSpawnRangeMax()
      Maximum horizontal spawn range in blocks.
      Returns:
      max range.
    • setSpawnRangeMax

      public void setSpawnRangeMax(Integer spawnRangeMax)
      Sets the maximum horizontal spawn range in blocks.
      Parameters:
      spawnRangeMax - max range in blocks.
    • getSpawnLimitAmount

      public Integer getSpawnLimitAmount()
      Per-range spawn limit amount.
      Returns:
      limit amount.
    • setSpawnLimitAmount

      public void setSpawnLimitAmount(Integer spawnLimitAmount)
      Sets the per-range spawn limit amount.
      Parameters:
      spawnLimitAmount - amount.
    • getSpawnLimitRange

      public Integer getSpawnLimitRange()
      Range in blocks over which the spawn limit is evaluated.
      Returns:
      limit range in blocks.
    • setSpawnLimitRange

      public void setSpawnLimitRange(Integer spawnLimitRange)
      Sets the range in blocks over which the spawn limit is evaluated.
      Parameters:
      spawnLimitRange - range in blocks.
    • getFireworks

      public Boolean getFireworks()
      Whether to show fireworks on spawn.
      Returns:
      true/false if explicitly set.
    • setFireworks

      public void setFireworks(Boolean fireworks)
      Sets whether to show fireworks on spawn.
      Parameters:
      fireworks - true/false to override.
    • getBlacklist

      public List<String> getBlacklist()
      List of world or biome identifiers that should not spawn entities for this group.
      Returns:
      blacklist, possibly empty.
    • setBlacklist

      public void setBlacklist(List<String> blacklist)
      Sets the blacklist for this group.
      Parameters:
      blacklist - list of identifiers.
    • getSharedDrops

      public List<String> getSharedDrops()
      Names of shared drop tables to apply.
      Returns:
      list of shared drop table names.
    • setSharedDrops

      public void setSharedDrops(List<String> sharedDrops)
      Sets the shared drop tables to apply to entities spawned by this group.
      Parameters:
      sharedDrops - list of table names.
    • toString

      public String 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.

      Overrides:
      toString in class Object
      Returns:
      a string like "SpawnGroup{id='groupId', chance=10, aboveGround=true, spawnRangeMax=64, spawnLimitAmount=5, spawnLimitRange=32, fireworks=false, blacklist=[world_nether], sharedDrops=[DIRT:5, DIAMOND:1:40]}"