Class CommonLib

java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
tk.airshipcraft.commonlib.CommonLib
All Implemented Interfaces:
org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter, org.bukkit.command.TabExecutor, org.bukkit.event.Listener, org.bukkit.plugin.Plugin
Direct Known Subclasses:
ACRPlugin

public class CommonLib extends org.bukkit.plugin.java.JavaPlugin implements org.bukkit.event.Listener
Main class of the CommonLib library. This class initializes the library and manages the lifecycle of the plugins that extend it. It uses a Singleton pattern to ensure that only one instance of CommonLib exists. It also provides enhanced logging capabilities.
Since:
2023-03-30
Version:
1.0.0
Author:
notzune, Locotusque
  • Field Summary

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

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the CalendarManager instance.
    static CommonLib
    Returns the single instance of CommonLib.
    Retrieves the preferences manager instance.
    Returns a new instance of the teamManager.
    static WorldClock
    Returns the WorldClock instance.
    void
    logDebug(String message)
    Logs a debug message.
    void
    logError(String message)
    Logs an error message.
    void
    Logs an exception stack trace at the SEVERE level.
    void
    logInfo(String message)
    Logs an informational message.
    void
    logSevere(String message)
    Logs a severe message, indicating a critical problem.
    void
    logWarning(String message)
    Logs a warning message.
    void
    Cleans up resources and disables the plugins that extend this library.
    void
    Initializes the CommonLib library.
    void
    onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event)
    Handles the player join event.
    void
    onPlayerQuit(org.bukkit.event.player.PlayerQuitEvent event)
    Handles the PlayerQuitEvent to save their preferences.

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

    getClassLoader, getCommand, getConfig, getDataFolder, getDefaultBiomeProvider, getDefaultWorldGenerator, getDescription, getFile, getLogger, getPlugin, getPluginLoader, getPluginMeta, getProvidingPlugin, getResource, getServer, getTextResource, init, init, isEnabled, isNaggable, onCommand, onLoad, 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

    Methods inherited from interface org.bukkit.plugin.Plugin

    getComponentLogger, getLog4JLogger, getSLF4JLogger
  • Constructor Details

    • CommonLib

      public CommonLib()
  • Method Details

    • getInstance

      public static CommonLib getInstance()
      Returns the single instance of CommonLib.
      Returns:
      The singleton instance of CommonLib.
    • getWorldClock

      public static WorldClock getWorldClock()
      Returns the WorldClock instance.
      Returns:
      WorldClock instance
    • getCalendarManager

      public static CalendarManager getCalendarManager()
      Returns the CalendarManager instance.
      Returns:
      CalendarManager instance
    • onEnable

      public void onEnable()
      Initializes the CommonLib library. This method is called by the Bukkit framework when the plugin is enabled.
      Specified by:
      onEnable in interface org.bukkit.plugin.Plugin
      Overrides:
      onEnable in class org.bukkit.plugin.java.JavaPlugin
    • onPlayerJoin

      public void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event)
      Handles the player join event.
      Parameters:
      event - the player join event
    • onPlayerQuit

      public void onPlayerQuit(org.bukkit.event.player.PlayerQuitEvent event)
      Handles the PlayerQuitEvent to save their preferences.
      Parameters:
      event - the player quit event
    • getPreferencesManager

      public PreferencesManager getPreferencesManager()
      Retrieves the preferences manager instance.
      Returns:
      the preferences manager
    • getTeamManager

      public TeamManager getTeamManager()
      Returns a new instance of the teamManager.
      Returns:
      TeamManager instance
    • onDisable

      public void onDisable()
      Cleans up resources and disables the plugins that extend this library. This method is called by the Bukkit framework when the plugin is disabled.
      Specified by:
      onDisable in interface org.bukkit.plugin.Plugin
      Overrides:
      onDisable in class org.bukkit.plugin.java.JavaPlugin
    • logInfo

      public void logInfo(String message)
      Logs an informational message.
      Parameters:
      message - The message to log.
    • logDebug

      public void logDebug(String message)
      Logs a debug message. Debug messages are only logged if debug mode is enabled.
      Parameters:
      message - The debug message to log.
    • logWarning

      public void logWarning(String message)
      Logs a warning message.
      Parameters:
      message - The warning message to log.
    • logError

      public void logError(String message)
      Logs an error message.
      Parameters:
      message - The error message to log.
    • logSevere

      public void logSevere(String message)
      Logs a severe message, indicating a critical problem.
      Parameters:
      message - The severe message to log.
    • logException

      public void logException(Exception e)
      Logs an exception stack trace at the SEVERE level.
      Parameters:
      e - The exception to log.