Package tk.airshipcraft.commonlib
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic CalendarManagerReturns the CalendarManager instance.static CommonLibReturns the single instance of CommonLib.Retrieves the preferences manager instance.Returns a new instance of the teamManager.static WorldClockReturns the WorldClock instance.voidLogs a debug message.voidLogs an error message.voidLogs an exception stack trace at the SEVERE level.voidLogs an informational message.voidLogs a severe message, indicating a critical problem.voidlogWarning(String message) Logs a warning message.voidCleans up resources and disables the plugins that extend this library.voidonEnable()Initializes the CommonLib library.voidonPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event) Handles the player join event.voidonPlayerQuit(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, toStringMethods inherited from class org.bukkit.plugin.PluginBase
equals, getName, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bukkit.plugin.Plugin
getComponentLogger, getLog4JLogger, getSLF4JLogger
-
Constructor Details
-
CommonLib
public CommonLib()
-
-
Method Details
-
getInstance
Returns the single instance of CommonLib.- Returns:
- The singleton instance of CommonLib.
-
getWorldClock
Returns the WorldClock instance.- Returns:
- WorldClock instance
-
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:
onEnablein interfaceorg.bukkit.plugin.Plugin- Overrides:
onEnablein classorg.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
Retrieves the preferences manager instance.- Returns:
- the preferences manager
-
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:
onDisablein interfaceorg.bukkit.plugin.Plugin- Overrides:
onDisablein classorg.bukkit.plugin.java.JavaPlugin
-
logInfo
Logs an informational message.- Parameters:
message- The message to log.
-
logDebug
Logs a debug message. Debug messages are only logged if debug mode is enabled.- Parameters:
message- The debug message to log.
-
logWarning
Logs a warning message.- Parameters:
message- The warning message to log.
-
logError
Logs an error message.- Parameters:
message- The error message to log.
-
logSevere
Logs a severe message, indicating a critical problem.- Parameters:
message- The severe message to log.
-
logException
Logs an exception stack trace at the SEVERE level.- Parameters:
e- The exception to log.
-