Interface SmartSpawnerAPI
public interface SmartSpawnerAPI
Main API interface for SmartSpawner plugin.
This API allows other plugins to interact with SmartSpawner functionality.
-
Method Summary
Modifier and TypeMethodDescriptionvoidClears the currently active per-spawner layout provider.org.bukkit.inventory.ItemStackcreateItemSpawnerItem(org.bukkit.Material itemMaterial) Creates an item spawner that spawns items instead of entities.org.bukkit.inventory.ItemStackcreateItemSpawnerItem(org.bukkit.Material itemMaterial, int amount) Creates an item spawner that spawns items instead of entities.org.bukkit.inventory.ItemStackcreateSpawnerItem(org.bukkit.entity.EntityType entityType) Creates a SmartSpawner item with the specified entity type.org.bukkit.inventory.ItemStackcreateSpawnerItem(org.bukkit.entity.EntityType entityType, int amount) Creates a SmartSpawner item with the specified entity type and a custom amount.org.bukkit.inventory.ItemStackcreateVanillaSpawnerItem(org.bukkit.entity.EntityType entityType) Creates a vanilla spawner item without SmartSpawner features.org.bukkit.inventory.ItemStackcreateVanillaSpawnerItem(org.bukkit.entity.EntityType entityType, int amount) Creates a vanilla spawner item without SmartSpawner features.Gets all registered spawners in the server.org.bukkit.MaterialgetItemSpawnerMaterial(org.bukkit.inventory.ItemStack item) Gets the item material from an item spawner.Gets theGuiLayoutRegistryfor registering custom GUI layouts.getSpawnerById(String spawnerId) Gets spawner data by unique identifier.getSpawnerByLocation(org.bukkit.Location location) Gets spawner data by location.org.bukkit.entity.EntityTypegetSpawnerEntityType(org.bukkit.inventory.ItemStack item) Gets the entity type from a spawner item.getSpawnerModifier(String spawnerId) Creates a modifier for the specified spawner to change its properties.booleanisItemSpawner(org.bukkit.inventory.ItemStack item) Checks if an ItemStack is an item spawner.booleanisSmartSpawner(org.bukkit.inventory.ItemStack item) Checks if an ItemStack is a SmartSpawner.booleanisVanillaSpawner(org.bukkit.inventory.ItemStack item) Checks if an ItemStack is a vanilla spawner.removeSpawner(String spawnerId) Removes a spawner from the server, including its block and data.removeSpawner(org.bukkit.Location location) Removes a spawner from the server by its location, including its block and data.voidSets a provider to dynamically override GUI layouts on a per-spawner basis.
-
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 spawnamount- 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 spawnamount- 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 spawneramount- 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
Gets spawner data by location. The returned DTO is read-only. To modify spawner properties, usegetSpawnerModifier(String).- Parameters:
location- the location of the spawner block- Returns:
- the spawner data DTO, or null if no spawner exists at that location
-
getSpawnerById
Gets spawner data by unique identifier. The returned DTO is read-only. To modify spawner properties, usegetSpawnerModifier(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, usegetSpawnerModifier(String).- Returns:
- list of all spawner data DTOs
-
getSpawnerModifier
Creates a modifier for the specified spawner to change its properties. Use this to modify spawner values and then callSpawnerDataModifier.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
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
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 theGuiLayoutRegistryfor registering custom GUI layouts.- Returns:
- the layout registry instance
-
setSpawnerLayoutProvider
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.
-