Class RegisterGraveProviders

java.lang.Object
dev.cwhead.GravesX.api.provider.RegisterGraveProviders

public class RegisterGraveProviders extends Object
Utility for discovering GraveProvider implementations that have been registered with the Bukkit Services API. Providers are returned in ascending order so lower numbers (higher priority) come first.

This method takes a snapshot of the currently-registered providers each time it is called. It does not track future registrations/unregistrations.

Since:
4.9.9.1
  • Method Details

    • bootstrapFromServices

      public static void bootstrapFromServices()
      One-time (or occasional) rebuild from Bukkit Services. Call after modules/providers have registered their services. This performs the loop ONCE here, so removeGrave() never has to.
    • index

      public static void index(GraveProvider provider)
      If you control registration code, call this right after you register the provider. (Avoids needing to call bootstrapFromServices again.)
    • unindex

      public static void unindex(GraveProvider provider)
      If you control unregistration/disable, call this to keep the index clean.
    • clear

      public static void clear()
      Clear all cached/indexed providers (call on plugin disable, or before a rebuild if you want).
    • getById

      public static GraveProvider getById(String providerId)
      O(1) lookup by provider id. Intended for hot paths (like removeGrave).
    • getHighestPriorityAll

      public static List<GraveProvider> getHighestPriorityAll()
      Returns every provider at the highest priority tier (the minimal order value). If none are registered, returns an empty list.
    • getAll

      public static List<GraveProvider> getAll()
      Retrieves all registered GraveProvider instances from the Bukkit Services registry, sorted by ascending order. The returned list is immutable. NOTE: This remains a snapshot (loops). That's fine outside hot removal paths. As a bonus, this also refreshes the id index.
    • getHighestPriorityOne

      public static Optional<GraveProvider> getHighestPriorityOne()
      Returns a single highest-priority provider (arbitrary among ties).