Class AlpinePlugin

java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
co.crystaldev.alpinecore.AlpinePlugin
All Implemented Interfaces:
org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter, org.bukkit.command.TabExecutor, org.bukkit.event.Listener, org.bukkit.plugin.Plugin

public abstract class AlpinePlugin extends org.bukkit.plugin.java.JavaPlugin implements org.bukkit.event.Listener
The base class for Alpine plugins. Use this instead of JavaPlugin.
Since:
0.1.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     
    static interface 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected dev.rollczi.litecommands.LiteCommands<org.bukkit.command.CommandSender>
    Manages any AlpineCommands for the plugin
    protected ConfigManager
    Manages any AlpineConfigs for the plugin
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    Registers an Activatable to the plugin.
    final <T extends AlpineConfig>
    T
    getConfiguration(@NotNull Class<T> clazz)
    Retrieves a configuration instance from the manager.
    long
    Retrieves the current server tick.
    final void
    log(@NotNull String message)
    Logs an information message with color formatting.
    final void
    log(@NotNull String message, @NotNull Throwable throwable)
    Logs a severe message and error with color formatting.
    final void
    log(@NotNull Level level, @NotNull String message)
    Logs a message at a given level with color formatting.
    boolean
    onActivatablePreload(@NotNull String activatableClasspath)
    Internally invoked before loading an activatable object.
    final void
     
    final void
     
    void
    Called when the plugin is enabling.
    void
    Called when the plugin is disabling.
    void
    registerSerializers(@NotNull SerializerRegistry serializerRegistry)
    Register custom serializers with the provided SerializerRegistry.
    final void
    Unegisters an Activatable from the plugin.
    void
    setupCommandManager(@NotNull dev.rollczi.litecommands.LiteCommandsBuilder<org.bukkit.command.CommandSender,dev.rollczi.litecommands.bukkit.LiteBukkitSettings,?> builder)
    Configures the command manager for the plugin with custom commands, settings, and message handlers.
    void
    setupDefaultConfiguration(@NotNull co.crystaldev.alpinecore.config.AlpineCoreConfig config)
    Configures the default configuration settings for this AlpineCore plugin.
    void
    Configures default styles for text formatting within the plugin.
    void
    Sets up default variables for use within the plugin.
    @NotNull net.kyori.adventure.text.minimessage.MiniMessage
    setupMiniMessage(net.kyori.adventure.text.minimessage.MiniMessage.Builder builder)
    Configures the MiniMessage parser with custom tag resolvers and other settings.

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

    getClassLoader, getCommand, getConfig, getDatabase, getDatabaseClasses, getDataFolder, getDefaultWorldGenerator, getDescription, getFile, getLogger, getPlugin, getPluginLoader, getProvidingPlugin, getResource, getServer, getTextResource, initialize, installDDL, isEnabled, isInitialized, isNaggable, onCommand, onLoad, onTabComplete, reloadConfig, removeDDL, 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

    • configManager

      protected ConfigManager configManager
      Manages any AlpineConfigs for the plugin
    • commandManager

      protected dev.rollczi.litecommands.LiteCommands<org.bukkit.command.CommandSender> commandManager
      Manages any AlpineCommands for the plugin
  • Constructor Details

    • AlpinePlugin

      public AlpinePlugin()
  • Method Details

    • onStart

      public void onStart()
      Called when the plugin is enabling.
    • onStop

      public void onStop()
      Called when the plugin is disabling.
    • onActivatablePreload

      public boolean onActivatablePreload(@NotNull @NotNull String activatableClasspath)
      Internally invoked before loading an activatable object. Determines whether an activatable object should be initialized. By default, it allows all activatable objects to proceed with initialization.
      Parameters:
      activatableClasspath - The classpath of the activatable object.
      Returns:
      boolean True to initialize the activatable object, false otherwise.
    • registerSerializers

      public void registerSerializers(@NotNull @NotNull SerializerRegistry serializerRegistry)
      Register custom serializers with the provided SerializerRegistry.
      This method allows developers to register custom serializers for specific data types with a central SerializerRegistry instance.
      Parameters:
      serializerRegistry - The SerializerRegistry where custom serializers should be registered.
    • setupCommandManager

      public void setupCommandManager(@NotNull @NotNull dev.rollczi.litecommands.LiteCommandsBuilder<org.bukkit.command.CommandSender,dev.rollczi.litecommands.bukkit.LiteBukkitSettings,?> builder)
      Configures the command manager for the plugin with custom commands, settings, and message handlers. This method sets up the LiteCommandsBuilder with the necessary configurations for command parsing. It allows for further customization by invoking an overridable method that plugins can implement to modify the command manager settings or add additional commands.
      Parameters:
      builder - the pre-configured LiteCommandsBuilder ready for plugin-specific configurations.
      See Also:
      • LiteCommandsBuilder
      • LiteCommandsBukkit.builder(String)
    • setupDefaultStyles

      public void setupDefaultStyles(@NotNull @NotNull AlpinePlugin.StyleConsumer styleConsumer)
      Configures default styles for text formatting within the plugin. This method is used to add custom tags that modify the appearance of text.
      It provides a straightforward way to enrich text presentation by associating custom style tags with their corresponding formatting instructions.
      Parameters:
      styleConsumer - The consumer that accepts style definitions.
    • setupDefaultVariables

      public void setupDefaultVariables(@NotNull @NotNull AlpinePlugin.VariableConsumer variableConsumer)
      Sets up default variables for use within the plugin.
      Unlike styles, variables are placeholders that are not processed for formatting. This method allows for the registration of default variables providing a simple way to incorporate dynamic content.
      Parameters:
      variableConsumer - The consumer that accepts variable definitions.
    • setupDefaultConfiguration

      public void setupDefaultConfiguration(@NotNull @NotNull co.crystaldev.alpinecore.config.AlpineCoreConfig config)
      Configures the default configuration settings for this AlpineCore plugin.
      Implementations can override this method to apply custom configurations or adjust the existing ones.
      Parameters:
      config - the configuration.
      See Also:
      • AlpineCoreConfig
    • setupMiniMessage

      @NotNull public @NotNull net.kyori.adventure.text.minimessage.MiniMessage setupMiniMessage(@NotNull net.kyori.adventure.text.minimessage.MiniMessage.Builder builder)
      Configures the MiniMessage parser with custom tag resolvers and other settings. This method allows for customization of the MiniMessage parser.
      Parameters:
      builder - The MiniMessage MiniMessage.Builder instance to be configured with custom settings.
      Returns:
      The MiniMessage instance.
      See Also:
      • MiniMessage
    • onEnable

      public final void onEnable()
      Specified by:
      onEnable in interface org.bukkit.plugin.Plugin
      Overrides:
      onEnable in class org.bukkit.plugin.java.JavaPlugin
    • onDisable

      public final void onDisable()
      Specified by:
      onDisable in interface org.bukkit.plugin.Plugin
      Overrides:
      onDisable in class org.bukkit.plugin.java.JavaPlugin
    • getConfiguration

      @NotNull public final <T extends AlpineConfig> T getConfiguration(@NotNull @NotNull Class<T> clazz)
      Retrieves a configuration instance from the manager.
      Type Parameters:
      T - The configuration type
      Parameters:
      clazz - The configuration class
      Returns:
      The configuration instance
    • getCurrentTick

      public long getCurrentTick()
      Retrieves the current server tick.
      Returns:
      The current tick.
    • log

      public final void log(@NotNull @NotNull String message)
      Logs an information message with color formatting.
      Parameters:
      message - The message to log
    • log

      public final void log(@NotNull @NotNull String message, @NotNull @NotNull Throwable throwable)
      Logs a severe message and error with color formatting.
      Parameters:
      message - The message to log
      throwable - The error or exception
    • log

      public final void log(@NotNull @NotNull Level level, @NotNull @NotNull String message)
      Logs a message at a given level with color formatting.
      Parameters:
      level - The log level
      message - The message to log
    • addActivatable

      public final void addActivatable(Activatable activatable)
      Registers an Activatable to the plugin.
      Parameters:
      activatable - The activatable
    • removeActivatable

      public final void removeActivatable(Activatable activatable)
      Unegisters an Activatable from the plugin.
      Parameters:
      activatable - The activatable