Class AlliancePlugin
java.lang.Object
net.joseplay.allianceutils.api.extensions.AlliancePlugin
- All Implemented Interfaces:
AllianceUtilsExtension
Base abstraction for Alliance extensions.
This class provides common infrastructure such as configuration management, resource access, task scheduling, and lifecycle metadata.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Set<org.bukkit.scheduler.BukkitTask> Tracks active scheduled tasks for proper lifecycle management. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidEnsures that a default config.yml exists in the extension's data folder.org.bukkit.configuration.file.YamlConfigurationRetrieves the configuration, ensuring it is initialized.Provides a namespaced logger for the extension.getResource(String path) Retrieves a resource file from inside the extension JAR.org.bukkit.scheduler.BukkitTaskSchedules a synchronous task.org.bukkit.scheduler.BukkitTaskrunTaskAsync(Runnable runnable) Schedules an asynchronous task.org.bukkit.scheduler.BukkitTaskrunTaskAsyncTimer(Runnable runnable, long delay, long period) Schedules a repeating asynchronous task and tracks it.org.bukkit.scheduler.BukkitTaskrunTaskLater(Runnable runnable, long delay) Schedules a delayed synchronous task.org.bukkit.scheduler.BukkitTaskrunTaskTimer(Runnable runnable, long delay, long period) Schedules a repeating synchronous task and tracks it.voidsetDataFolder(File dataFolder) voidsetExtensionAuthors(List<String> extensionAuthors) voidsetExtensionDescription(String extensionDescription) voidsetExtensionName(String extensionName) voidsetExtensionVersion(String extensionVersion) voidsetStartTime(Instant startTime) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.joseplay.allianceutils.api.extensions.interfaces.AllianceUtilsExtension
onDisable, onEnable
-
Field Details
-
activeTasks
Tracks active scheduled tasks for proper lifecycle management.
-
-
Constructor Details
-
AlliancePlugin
public AlliancePlugin()
-
-
Method Details
-
getDataFolder
-
setDataFolder
-
setExtensionName
-
setExtensionVersion
-
setExtensionDescription
-
setExtensionAuthors
-
createDefaultConfig
public void createDefaultConfig()Ensures that a default config.yml exists in the extension's data folder.If the file does not exist, it is extracted from the extension's JAR.
-
getResource
Retrieves a resource file from inside the extension JAR.Returns a safe copy of the InputStream to avoid issues with closed JAR streams.
- Parameters:
path- resource path inside the JAR- Returns:
- InputStream or null if not found
-
getLogger
Provides a namespaced logger for the extension.- Returns:
- custom logger instance
-
getExtensionName
-
getConfig
public org.bukkit.configuration.file.YamlConfiguration getConfig()Retrieves the configuration, ensuring it is initialized.- Returns:
- configuration instance
-
getExtensionVersion
-
getExtensionDescription
-
getExtensionAuthors
-
runTask
Schedules a synchronous task. -
runTaskLater
Schedules a delayed synchronous task. -
runTaskTimer
Schedules a repeating synchronous task and tracks it. -
runTaskAsync
Schedules an asynchronous task. -
runTaskAsyncTimer
public org.bukkit.scheduler.BukkitTask runTaskAsyncTimer(Runnable runnable, long delay, long period) Schedules a repeating asynchronous task and tracks it. -
getStartTime
-
setStartTime
-