Interface SmartSpawnerAPI


public interface SmartSpawnerAPI
Main API interface for SmartSpawner plugin. This API allows other plugins to interact with SmartSpawner functionality.
  • Method Details

    • createSpawnerItem

      org.bukkit.inventory.ItemStack createSpawnerItem(org.bukkit.entity.EntityType entityType)
      Creates a SmartSpawner item with the specified entity type.
      Parameters:
      entityType - the type of entity this spawner will spawn
      Returns:
      an ItemStack representing the spawner
    • createSpawnerItem

      org.bukkit.inventory.ItemStack createSpawnerItem(org.bukkit.entity.EntityType entityType, int amount)
      Creates a SmartSpawner item with the specified entity type and a custom amount.
      Parameters:
      entityType - the type of entity this spawner will spawn
      amount - the amount of the item stack
      Returns:
      an ItemStack representing the spawner
    • createVanillaSpawnerItem

      org.bukkit.inventory.ItemStack createVanillaSpawnerItem(org.bukkit.entity.EntityType entityType)
      Creates a vanilla spawner item without SmartSpawner features.
      Parameters:
      entityType - the type of entity this spawner will spawn
      Returns:
      an ItemStack representing the vanilla spawner
    • createVanillaSpawnerItem

      org.bukkit.inventory.ItemStack createVanillaSpawnerItem(org.bukkit.entity.EntityType entityType, int amount)
      Creates a vanilla spawner item without SmartSpawner features.
      Parameters:
      entityType - the type of entity this spawner will spawn
      amount - the amount of the item stack
      Returns:
      an ItemStack representing the vanilla spawner
    • createItemSpawnerItem

      org.bukkit.inventory.ItemStack createItemSpawnerItem(org.bukkit.Material itemMaterial)
      Creates an item spawner that spawns items instead of entities.
      Parameters:
      itemMaterial - the material type for the item spawner
      Returns:
      an ItemStack representing the item spawner
    • createItemSpawnerItem

      org.bukkit.inventory.ItemStack createItemSpawnerItem(org.bukkit.Material itemMaterial, int amount)
      Creates an item spawner that spawns items instead of entities.
      Parameters:
      itemMaterial - the material type for the item spawner
      amount - the amount of the item stack
      Returns:
      an ItemStack representing the item spawner
    • isSmartSpawner

      boolean isSmartSpawner(org.bukkit.inventory.ItemStack item)
      Checks if an ItemStack is a SmartSpawner.
      Parameters:
      item - the ItemStack to check
      Returns:
      true if the item is a SmartSpawner, false otherwise
    • isVanillaSpawner

      boolean isVanillaSpawner(org.bukkit.inventory.ItemStack item)
      Checks if an ItemStack is a vanilla spawner.
      Parameters:
      item - the ItemStack to check
      Returns:
      true if the item is a vanilla spawner, false otherwise
    • isItemSpawner

      boolean isItemSpawner(org.bukkit.inventory.ItemStack item)
      Checks if an ItemStack is an item spawner.
      Parameters:
      item - the ItemStack to check
      Returns:
      true if the item is an item spawner, false otherwise
    • getSpawnerEntityType

      org.bukkit.entity.EntityType getSpawnerEntityType(org.bukkit.inventory.ItemStack item)
      Gets the entity type from a spawner item.
      Parameters:
      item - the spawner ItemStack
      Returns:
      the EntityType of the spawner, or null if not a valid spawner
    • getItemSpawnerMaterial

      org.bukkit.Material getItemSpawnerMaterial(org.bukkit.inventory.ItemStack item)
      Gets the item material from an item spawner.
      Parameters:
      item - the item spawner ItemStack
      Returns:
      the Material that the item spawner spawns, or null if not a valid item spawner
    • getSpawnerByLocation

      SpawnerDataDTO getSpawnerByLocation(org.bukkit.Location location)
      Gets spawner data by location. The returned DTO is read-only. To modify spawner properties, use getSpawnerModifier(String).
      Parameters:
      location - the location of the spawner block
      Returns:
      the spawner data DTO, or null if no spawner exists at that location
    • getSpawnerById

      SpawnerDataDTO getSpawnerById(String spawnerId)
      Gets spawner data by unique identifier. The returned DTO is read-only. To modify spawner properties, use getSpawnerModifier(String).
      Parameters:
      spawnerId - the unique ID of the spawner
      Returns:
      the spawner data DTO, or null if spawner with that ID doesn't exist
    • getAllSpawners

      List<SpawnerDataDTO> getAllSpawners()
      Gets all registered spawners in the server. The returned DTOs are read-only. To modify spawner properties, use getSpawnerModifier(String).
      Returns:
      list of all spawner data DTOs
    • getSpawnerModifier

      SpawnerDataModifier getSpawnerModifier(String spawnerId)
      Creates a modifier for the specified spawner to change its properties. Use this to modify spawner values and then call SpawnerDataModifier.applyChanges() to recalculate and apply the changes.
      Parameters:
      spawnerId - the unique ID of the spawner
      Returns:
      a spawner data modifier, or null if spawner doesn't exist
    • removeSpawner

      CompletableFuture<Boolean> removeSpawner(String spawnerId)
      Removes a spawner from the server, including its block and data. The returned future completes after the block and stored data have been removed. If the spawner chunk is not loaded, it is loaded asynchronously before the block is changed.
      Parameters:
      spawnerId - the unique ID of the spawner to remove
      Returns:
      future containing true when removal completed, false if not found or already being modified
    • removeSpawner

      CompletableFuture<Boolean> removeSpawner(org.bukkit.Location location)
      Removes a spawner from the server by its location, including its block and data. The returned future completes after the block and stored data have been removed. If the spawner chunk is not loaded, it is loaded asynchronously before the block is changed.
      Parameters:
      location - the location of the spawner block to remove
      Returns:
      future containing true when removal completed, false if not found or already being modified
    • getLayoutRegistry

      GuiLayoutRegistry getLayoutRegistry()
      Gets the GuiLayoutRegistry for registering custom GUI layouts.
      Returns:
      the layout registry instance
    • setSpawnerLayoutProvider

      void setSpawnerLayoutProvider(SpawnerGuiLayoutProvider provider)
      Sets a provider to dynamically override GUI layouts on a per-spawner basis. Only one provider can be active at a time; setting a new one replaces the previous.
      Parameters:
      provider - the layout provider, or null to clear
    • clearSpawnerLayoutProvider

      void clearSpawnerLayoutProvider()
      Clears the currently active per-spawner layout provider.