ExtensionLoader
com.jsmacrosce.jsmacros.core.extensions.ExtensionLoader
Discovers and initializes extensions associated with a core; queries other than notLoaded() trigger loading when completion has not been recorded. Returned extension sets are independent live backing sets; mutating one does not reconcile the others or registered libraries.
js
const Client = Java.type("com.jsmacrosce.jsmacros.client.JsMacrosClient");
Chat.log(Client.clientCore.extensions.getAllLanguageExtensions().size());Constructors
new ExtensionLoader
Methods
getAllExtensions
getAllLanguageExtensions
getAllLanguageExtensions(): Set<LanguageExtension>#Loads extensions if needed and returns the live mutable backing set of language extensions.
Returns: the backing set of language extensions
getAllLibraryExtensions
getAllLibraryExtensions(): Set<LibraryExtension>#Loads extensions if needed and returns the live mutable backing set of library extensions.
Returns: the backing set of library extensions
getExtensionForFile
getExtensionForFile(File file): LanguageExtension#Loads extensions if needed and selects a language extension matching the file; when multiple matches include
MATCH_WITH_NAME, only those named matches are considered. Candidates are sorted by negated int priority, normally preferring higher priorities; Integer.MIN_VALUE overflows and sorts first. Equal priorities have no guaranteed selection.Parameters:
file: candidate file passed to language extensions for matching
Returns: the selected matching extension, or
null if none matchgetExtensionForName
getHighestPriorityExtension
getHighestPriorityExtension(): LanguageExtension#Loads extensions if needed, then selects the language extension with the greatest priority while the cache is empty. Equal priorities have no guaranteed selection; a non-null cache is not invalidated by changes to the live language-extension set.
Returns: the cached or selected extension, or
null if there are no language extensionsisExtensionLoaded
isGuestObject
loadExtensions
loadExtensions(): void#Attempts extension discovery, initialization, and library registration unless a class loader has already been assigned; in that case, prints a diagnostic and returns. Creates the
Extensions directory if needed, uses its regular files as the initial class-loader search path, discovers extension providers, and extracts bundled extensions and provider dependencies into Extensions/tmp. Completion is recorded only after provider initialization and registration finish. A failure after class-loader assignment can leave partial state and prevents another attempt; earlier failures do not set that sentinel. After dependency loading, the current thread's context class loader is changed and not restored, even if later initialization fails. Caught I/O, dependency, and initialization exceptions are wrapped in RuntimeException.notLoaded
notLoaded(): boolean#Reports whether extension loading has not yet completed.
Returns:
true until loading completion is recorded, including during a load attempt