Package valorless.rarespawns
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
FieldsModifier and TypeFieldDescriptionstatic valorless.valorlessutils.config.ConfigAdvanced configuration (advanced.yml).String[]Registered command aliases for the root command.static valorless.valorlessutils.config.ConfigPrimary configuration (config.yml).static org.bukkit.plugin.java.JavaPluginStatic handle to the running plugin instance.static valorless.valorlessutils.Server.VersionDetected server/version helper. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAllReady()Schedules a repeating task to check when all builders are fully loaded.voidBukkit disable phase.voidonEnable()Bukkit enable phase.voidonItemsAdderReady(dev.lone.itemsadder.api.Events.ItemsAdderLoadDataEvent event) voidonLoad()Bukkit load phase.voidonNexoReady(com.nexomc.nexo.api.events.NexoItemsLoadedEvent event) voidonOraxenReady(io.th0rgal.oraxen.api.events.OraxenItemsLoadedEvent event) protected voidRegisters custom AI wrappers/initializers for supported entity types.protected voidRegisters command executors and tab completers for all root aliases.protected voidReloads all builders (items, entities, abilities, soul powers) after ensuring that all external dependencies (Nexo, ItemsAdder, Oraxen) are fully loaded.protected booleanEnsures 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, toStringMethods inherited from class org.bukkit.plugin.PluginBase
equals, getName, hashCode
-
Field Details
-
plugin
public static org.bukkit.plugin.java.JavaPlugin pluginStatic handle to the running plugin instance. -
config
public static valorless.valorlessutils.config.Config configPrimary configuration (config.yml). -
advanced
public static valorless.valorlessutils.config.Config advancedAdvanced configuration (advanced.yml). -
version
public static valorless.valorlessutils.Server.Version versionDetected server/version helper. -
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:
onLoadin interfaceorg.bukkit.plugin.Plugin- Overrides:
onLoadin classorg.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:
onEnablein interfaceorg.bukkit.plugin.Plugin- Overrides:
onEnablein classorg.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 theRareSpawnsReadyEvent. -
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.
- Specified by:
onDisablein interfaceorg.bukkit.plugin.Plugin- Overrides:
onDisablein classorg.bukkit.plugin.java.JavaPlugin
- Persists any pending soulbound item data via
-
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
-