Class RareSpawnsAPI
Provides helpers to check/query rare entities and items, list available
identifiers, and spawn rares via the public API. Spawns triggered from
this API are considered EXTERNAL per SpawnCause.
Threading: Call these methods on the main server thread unless otherwise noted.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AbilityInfoAbilityInfo(String id) Retrieves the metadata for an ability by ID.Retrieves a list of all available ability IDs.static org.bukkit.plugin.java.JavaPluginGets the current plugin instance of RareSpawns.static org.bukkit.inventory.ItemStackRetrieves an item defined by its ID.static ItemDatagetItemData(String id) Fetches the immutable configuration/data model for a RareSpawns item.Retrieves a list of all available item IDs.Retrieves a list of all available soul power IDs.static EntityDataRetrieves the data model for a rare entity by ID.static StringgetRareID(org.bukkit.entity.Entity entity) Retrieves the unique rare ID associated with a given entity.static StringgetRareID(org.bukkit.inventory.ItemStack item) Retrieves the unique rare ID associated with a given item.Retrieves a list of all available rare entity IDs.static SoulPowerInfoRetrieves the metadata for a soul power by ID.static booleanisRare(org.bukkit.entity.Entity entity) Checks whether the given entity is registered as a rare by RareSpawns.static booleanisRare(org.bukkit.inventory.ItemStack item) Checks whether the given item is registered as a rare item by RareSpawns.static org.bukkit.entity.LivingEntitySpawns the rare defined by the provided ID at the given location.
-
Constructor Details
-
RareSpawnsAPI
public RareSpawnsAPI()
-
-
Method Details
-
getInstance
public static org.bukkit.plugin.java.JavaPlugin getInstance()Gets the current plugin instance of RareSpawns.- Returns:
- the active
JavaPlugininstance
-
isRare
public static boolean isRare(org.bukkit.entity.Entity entity) Checks whether the given entity is registered as a rare by RareSpawns.- Parameters:
entity- the entity to check- Returns:
trueif the entity is rare,falseotherwise
-
isRare
public static boolean isRare(org.bukkit.inventory.ItemStack item) Checks whether the given item is registered as a rare item by RareSpawns.- Parameters:
item- the item to check- Returns:
trueif the item is rare,falseotherwise
-
getRareID
Retrieves the unique rare ID associated with a given entity.- Parameters:
entity- the entity to query- Returns:
- the rare ID string, or
nullif the entity is not rare
-
getRareID
Retrieves the unique rare ID associated with a given item.- Parameters:
item- the item to query- Returns:
- the rare ID string, or
nullif the item is not a RareSpawns item
-
getItem
Retrieves an item defined by its ID.If
randomizeis true, a randomized variant is built usingItemBuilder; otherwise the fixed definition is returned viaItemCache.- Parameters:
id- the item IDrandomize- whether the item should be randomized, if applicable- Returns:
- the constructed
ItemStack, ornullif not found
-
getItemData
Fetches the immutable configuration/data model for a RareSpawns item.Use this to inspect definition-time properties (lore template, flags, rarity, update toggle, etc.) without constructing a live
ItemStack. For an actual in-game item instance usegetItem(String, boolean).- Parameters:
id- the item identifier (file name without extension)- Returns:
- the
ItemDatamodel, ornullif no item with that id exists
-
getItemIds
Retrieves a list of all available item IDs.- Returns:
- a list of item ID strings (never null)
-
getRare
Retrieves the data model for a rare entity by ID.- Parameters:
id- the rare entity ID- Returns:
- the
EntityDatarepresenting the entity, ornullif not found
-
getRareIds
Retrieves a list of all available rare entity IDs.- Returns:
- a list of rare entity ID strings (never null)
-
getAbilityIds
Retrieves a list of all available ability IDs.- Returns:
- a list of ability ID strings (never null)
-
AbilityInfo
Retrieves the metadata for an ability by ID.- Parameters:
id- the ability ID- Returns:
- the
AbilityInforepresenting the ability, ornullif not found
-
getPowerIds
Retrieves a list of all available soul power IDs.- Returns:
- a list of soul power ID strings (never null)
-
getSoulPowerInfo
Retrieves the metadata for a soul power by ID.- Parameters:
id- the soul power ID- Returns:
- the
SoulPowerInforepresenting the soul power, ornullif not found
-
spawnRare
Spawns the rare defined by the provided ID at the given location.This is considered an
EXTERNALspawn (spawned through the public API). Implementations may fireRareSpawnEventwithcause = EXTERNAL.Requirements: call on the main thread;
idmust exist;locationand its world must be non-null.- Parameters:
id- the rare entity ID to spawnlocation- the world location where the rare should spawn
-