Class RareSpawnsAPI

java.lang.Object
valorless.rarespawns.api.RareSpawnsAPI

public class RareSpawnsAPI extends Object
Static entry point for external integrations with RareSpawns.

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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves the metadata for an ability by ID.
    static List<String>
    Retrieves a list of all available ability IDs.
    static org.bukkit.plugin.java.JavaPlugin
    Gets the current plugin instance of RareSpawns.
    static org.bukkit.inventory.ItemStack
    getItem(String id, boolean randomize)
    Retrieves an item defined by its ID.
    static ItemData
    Fetches the immutable configuration/data model for a RareSpawns item.
    static List<String>
    Retrieves a list of all available item IDs.
    static List<String>
    Retrieves a list of all available soul power IDs.
    static EntityData
    Retrieves the data model for a rare entity by ID.
    static String
    getRareID(org.bukkit.entity.Entity entity)
    Retrieves the unique rare ID associated with a given entity.
    static String
    getRareID(org.bukkit.inventory.ItemStack item)
    Retrieves the unique rare ID associated with a given item.
    static List<String>
    Retrieves a list of all available rare entity IDs.
    Retrieves the metadata for a soul power by ID.
    static boolean
    isRare(org.bukkit.entity.Entity entity)
    Checks whether the given entity is registered as a rare by RareSpawns.
    static boolean
    isRare(org.bukkit.inventory.ItemStack item)
    Checks whether the given item is registered as a rare item by RareSpawns.
    static org.bukkit.entity.LivingEntity
    spawnRare(String id, org.bukkit.Location location)
    Spawns the rare defined by the provided ID at the given location.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 JavaPlugin instance
    • 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:
      true if the entity is rare, false otherwise
    • 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:
      true if the item is rare, false otherwise
    • getRareID

      public static String getRareID(org.bukkit.entity.Entity entity)
      Retrieves the unique rare ID associated with a given entity.
      Parameters:
      entity - the entity to query
      Returns:
      the rare ID string, or null if the entity is not rare
    • getRareID

      public static String getRareID(org.bukkit.inventory.ItemStack item)
      Retrieves the unique rare ID associated with a given item.
      Parameters:
      item - the item to query
      Returns:
      the rare ID string, or null if the item is not a RareSpawns item
    • getItem

      public static org.bukkit.inventory.ItemStack getItem(String id, boolean randomize)
      Retrieves an item defined by its ID.

      If randomize is true, a randomized variant is built using ItemBuilder; otherwise the fixed definition is returned via ItemCache.

      Parameters:
      id - the item ID
      randomize - whether the item should be randomized, if applicable
      Returns:
      the constructed ItemStack, or null if not found
    • getItemData

      public static ItemData getItemData(String id)
      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 use getItem(String, boolean).

      Parameters:
      id - the item identifier (file name without extension)
      Returns:
      the ItemData model, or null if no item with that id exists
    • getItemIds

      public static List<String> getItemIds()
      Retrieves a list of all available item IDs.
      Returns:
      a list of item ID strings (never null)
    • getRare

      public static EntityData getRare(String id)
      Retrieves the data model for a rare entity by ID.
      Parameters:
      id - the rare entity ID
      Returns:
      the EntityData representing the entity, or null if not found
    • getRareIds

      public static List<String> getRareIds()
      Retrieves a list of all available rare entity IDs.
      Returns:
      a list of rare entity ID strings (never null)
    • getAbilityIds

      public static List<String> getAbilityIds()
      Retrieves a list of all available ability IDs.
      Returns:
      a list of ability ID strings (never null)
    • AbilityInfo

      public static AbilityInfo AbilityInfo(String id)
      Retrieves the metadata for an ability by ID.
      Parameters:
      id - the ability ID
      Returns:
      the AbilityInfo representing the ability, or null if not found
    • getPowerIds

      public static List<String> getPowerIds()
      Retrieves a list of all available soul power IDs.
      Returns:
      a list of soul power ID strings (never null)
    • getSoulPowerInfo

      public static SoulPowerInfo getSoulPowerInfo(String id)
      Retrieves the metadata for a soul power by ID.
      Parameters:
      id - the soul power ID
      Returns:
      the SoulPowerInfo representing the soul power, or null if not found
    • spawnRare

      public static org.bukkit.entity.LivingEntity spawnRare(String id, org.bukkit.Location location)
      Spawns the rare defined by the provided ID at the given location.

      This is considered an EXTERNAL spawn (spawned through the public API). Implementations may fire RareSpawnEvent with cause = EXTERNAL.

      Requirements: call on the main thread; id must exist; location and its world must be non-null.

      Parameters:
      id - the rare entity ID to spawn
      location - the world location where the rare should spawn