Package ovh.mythmc.gestalt.loader
Class GestaltLoader
java.lang.Object
ovh.mythmc.gestalt.loader.GestaltLoader
- Direct Known Subclasses:
BukkitGestaltLoader,PaperGestaltLoader
Abstract base class responsible for downloading, verifying, and loading the Gestalt JAR
on the target platform.
Subclasses must implement the platform-specific methods:
getDataDirectory()- the directory in which thelibs/folder is createdgetLogger()- the logger wrapper for status messagesisAvailable()- whether Gestalt is already loaded on this platformload()- the platform-specific routine to load the downloaded JAR
The full initialization flow is driven by initialize(), which handles directory
setup, version checking, downloading, and finally delegating to load().
Download URLs and checksum endpoints are read from a gestalt.properties resource
bundled in the plugin JAR.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract PathReturns the root data directory of the plugin.protected StringDeprecated.protected PathReturns the path where the Gestalt JAR is stored on disk.protected abstract GestaltLoggerWrapperReturns the logger wrapper used to emit status messages during loading.Runs the full Gestalt initialization flow: Checks if Gestalt is already available and returns early if so. Ensures thelibs/directory exists. Compares the local JAR checksum against the remote checksum and deletes an outdated JAR if found. Downloads the JAR if it is not present on disk. Callsload()to load the JAR into the server.protected abstract booleanReturns whether Gestalt is already available and loaded on this platform.protected abstract voidload()Performs the platform-specific routine to load the Gestalt JAR into the server.voidCalled when the loader should shut down.
-
Constructor Details
-
GestaltLoader
public GestaltLoader()
-
-
Method Details
-
getDataDirectory
Returns the root data directory of the plugin. The Gestalt JAR will be placed at<dataDirectory>/libs/gestalt.jar.- Returns:
- the plugin data directory
-
getLogger
Returns the logger wrapper used to emit status messages during loading.- Returns:
- the logger wrapper
-
isAvailable
protected abstract boolean isAvailable()Returns whether Gestalt is already available and loaded on this platform.If
true,initialize()will return early without downloading or loading.- Returns:
trueif Gestalt is already loaded
-
load
protected abstract void load()Performs the platform-specific routine to load the Gestalt JAR into the server. Called byinitialize()after the JAR has been verified to exist on disk. -
initialize
Runs the full Gestalt initialization flow:- Checks if Gestalt is already available and returns early if so.
- Ensures the
libs/directory exists. - Compares the local JAR checksum against the remote checksum and deletes an outdated JAR if found.
- Downloads the JAR if it is not present on disk.
- Calls
load()to load the JAR into the server.
- Returns:
- a
GestaltLoaderInitializationResponsedescribing the outcome of the initialization
-
terminate
public void terminate()Called when the loader should shut down. -
getJarPath
Returns the path where the Gestalt JAR is stored on disk. Defaults to<dataDirectory>/libs/gestalt.jar.- Returns:
- the path to the Gestalt JAR
-
getGestaltPath
Deprecated.UsegetJarPath()instead.Returns the string representation of the Gestalt JAR path.- Returns:
- the Gestalt JAR path as a string
-
getJarPath()instead.