Class Main

java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
valorless.rarespawns.Main
All Implemented Interfaces:
org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter, org.bukkit.command.TabExecutor, org.bukkit.event.Listener, org.bukkit.plugin.Plugin

public final class Main extends org.bukkit.plugin.java.JavaPlugin implements org.bukkit.event.Listener
Main plugin entry point for RareSpawns.

Manages the Bukkit lifecycle: loads configuration on load, initializes hooks and systems on enable (builders, listeners, AI, commands), and performs cleanup on disable. Also schedules a post-start scan to update existing rare entities in loaded worlds.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static valorless.valorlessutils.config.Config
    Advanced configuration (advanced.yml).
    Registered command aliases for the root command.
    static valorless.valorlessutils.config.Config
    Primary configuration (config.yml).
    static org.bukkit.plugin.java.JavaPlugin
    Static handle to the running plugin instance.
    static valorless.valorlessutils.Server.Version
    Detected server/version helper.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Schedules a repeating task to check when all builders are fully loaded.
    void
    Bukkit disable phase.
    void
    Bukkit enable phase.
    void
    onItemsAdderReady(dev.lone.itemsadder.api.Events.ItemsAdderLoadDataEvent event)
     
    void
    Bukkit load phase.
    void
    onNexoReady(com.nexomc.nexo.api.events.NexoItemsLoadedEvent event)
     
    void
    onOraxenReady(io.th0rgal.oraxen.api.events.OraxenItemsLoadedEvent event)
     
    protected void
    Registers custom AI wrappers/initializers for supported entity types.
    protected void
    Registers command executors and tab completers for all root aliases.
    protected void
    Reloads all builders (items, entities, abilities, soul powers) after ensuring that all external dependencies (Nexo, ItemsAdder, Oraxen) are fully loaded.
    protected boolean
    Ensures the installed ValorlessUtils dependency meets the minimum required build.

    Methods inherited from class org.bukkit.plugin.java.JavaPlugin

    getClassLoader, getCommand, getConfig, getDataFolder, getDefaultBiomeProvider, getDefaultWorldGenerator, getDescription, getFile, getLogger, getPlugin, getPluginLoader, getProvidingPlugin, getResource, getServer, getTextResource, isEnabled, isNaggable, onCommand, onTabComplete, reloadConfig, saveConfig, saveDefaultConfig, saveResource, setEnabled, setNaggable, toString

    Methods inherited from class org.bukkit.plugin.PluginBase

    equals, getName, hashCode

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • plugin

      public static org.bukkit.plugin.java.JavaPlugin plugin
      Static handle to the running plugin instance.
    • config

      public static valorless.valorlessutils.config.Config config
      Primary configuration (config.yml).
    • advanced

      public static valorless.valorlessutils.config.Config advanced
      Advanced configuration (advanced.yml).
    • version

      public static valorless.valorlessutils.Server.Version version
      Detected server/version helper.
    • commands

      public String[] commands
      Registered command aliases for the root command.
  • Constructor Details

    • Main

      public Main()
  • Method Details

    • onLoad

      public void onLoad()
      Bukkit load phase. Initializes static plugin reference and loads configurations. Avoids heavy work; most initialization happens in onEnable.
      Specified by:
      onLoad in interface org.bukkit.plugin.Plugin
      Overrides:
      onLoad in class org.bukkit.plugin.java.JavaPlugin
    • onEnable

      public void onEnable()
      Bukkit enable phase. Verifies dependencies, hooks external integrations, reloads builders, registers listeners/AI/commands, and schedules maintenance tasks.
      Specified by:
      onEnable in interface org.bukkit.plugin.Plugin
      Overrides:
      onEnable in class org.bukkit.plugin.java.JavaPlugin
    • onNexoReady

      public void onNexoReady(com.nexomc.nexo.api.events.NexoItemsLoadedEvent event)
    • onItemsAdderReady

      public void onItemsAdderReady(dev.lone.itemsadder.api.Events.ItemsAdderLoadDataEvent event)
    • onOraxenReady

      public void onOraxenReady(io.th0rgal.oraxen.api.events.OraxenItemsLoadedEvent event)
    • ReloadBuilders

      protected void ReloadBuilders()
      Reloads all builders (items, entities, abilities, soul powers) after ensuring that all external dependencies (Nexo, ItemsAdder, Oraxen) are fully loaded. Schedules a repeating task that checks readiness of each dependency before proceeding with the reload.
    • AllReady

      protected void AllReady()
      Schedules a repeating task to check when all builders are fully loaded. Once all builders report readiness, logs completion and fires the RareSpawnsReadyEvent.
    • RegisterAI

      protected void RegisterAI()
      Registers custom AI wrappers/initializers for supported entity types.
    • onDisable

      public void onDisable()
      Bukkit disable phase. Performs final persistence and cleanup:
      • Persists any pending soulbound item data via SoulboundEvent.shutdown().
      • Scans all worlds and removes transient nameplate entities tagged with RareEntity-Nameplate.
      • Cancels scheduled boss bar update tasks and removes their bars for each tracked rare entity.
      All actions run synchronously on the main server thread and avoid heavy/blocking I/O.
      Specified by:
      onDisable in interface org.bukkit.plugin.Plugin
      Overrides:
      onDisable in class org.bukkit.plugin.java.JavaPlugin
    • RegisterCommands

      protected void RegisterCommands()
      Registers command executors and tab completers for all root aliases.
    • ValorlessUtils

      protected boolean ValorlessUtils()
      Ensures the installed ValorlessUtils dependency meets the minimum required build. If the requirement is not met, logs details and disables this plugin.
      Returns:
      true when requirements are satisfied; false if the plugin was scheduled for disable