Class PluginRegistry

java.lang.Object
com.github.pinont.singularitylib.api.registry.PluginRegistry

public final class PluginRegistry extends Object
Runtime registry of every loaded Singularity plugin and its components.

Each CorePlugin registers itself (and, when available, its component lists) during onEnable. This is the discovery surface consumed by Singularity-DevTool's plugin auto-discovery: enumerate plugins, then inspect a plugin's commands, listeners and custom items.

  • Method Details

    • register

      public static void register(CorePlugin plugin)
      Called by CorePlugin lifecycle. Internal use.
    • registerComponents

      public static void registerComponents(CorePlugin plugin, Collection<? extends SimpleCommand> commands, Collection<? extends org.bukkit.event.Listener> listeners, Collection<? extends CustomItem> items)
      Records a plugin's classified components (from its Register).
    • unregister

      public static void unregister(CorePlugin plugin)
      Called by CorePlugin lifecycle. Internal use.
    • plugins

      @NotNull public static @NotNull Collection<CorePlugin> plugins()
      Returns:
      all registered Singularity plugins (name -> instance), insertion-ordered
    • get

      @Nullable public static @Nullable CorePlugin get(String name)
      Looks up a registered plugin by its plugin name.
    • find

      @NotNull public static @NotNull Optional<CorePlugin> find(String name)
      Looks up a registered plugin by its plugin name (optional-friendly).
    • componentsOf

      @NotNull public static @NotNull PluginRegistry.RegisteredComponents componentsOf(@Nullable @Nullable CorePlugin plugin)
      Returns a plugin's registered components (empty record if none recorded).
    • count

      public static int count()
      Returns:
      the number of loaded Singularity plugins
    • clear

      public static void clear()
      Clears the registry (used between MockBukkit test runs).