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 CalendarManager
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
Logs a debug message.void
Logs an error message.void
Logs an exception stack trace at the SEVERE level.void
Logs an informational message.void
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
onEnable()
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
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:
onEnable
in interfaceorg.bukkit.plugin.Plugin
- Overrides:
onEnable
in 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:
onDisable
in interfaceorg.bukkit.plugin.Plugin
- Overrides:
onDisable
in 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.
-