Skip to content

AddonManager

Provides access to the server’s Add-on Manager to manage installed files, and online discovery. The addon global exposes the existing ServerObject.addon manager.

Installed and remotely available add-ons are represented by AddonFileObject and AddonWebObject, respectively.

View the source: AddonManager

Returns a list of AddonWebObject matching the query, ordered by provider search relevance

ParametersTypeDescription
query*strPartial search term or full add-on name

Downloads an add-on from a string of the add-on name, ID, or an AddonWebObject provided by addon.search_addons(). The file is saved in addon.addon_path

ParametersTypeDescription
target*str / AddonWebObjectTarget add-on name or object to download

Imports a .jar file to addon.addon_path

ParametersTypeDescription
path*str / AddonFileObjectFull system path to the .jar file, or an existing add-on file object

addon.addon_state(target, enabled=True, all=False)

Section titled “addon.addon_state(target, enabled=True, all=False)”

Enables/disables an installed AddonFileObject, or all add-ons if specified. Requires target or all, and not both

ParametersTypeDescription
target*AddonFileObjectAn add-on object from addon.get_addon()
enabledboolEnable or disable the add-on. Defaults to True
all*boolOperate on every installed add-on. Defaults to False

Permanently deletes an installed AddonFileObject

ParametersTypeDescription
target*AddonFileObjectAn add-on object from addon.get_addon()

Retrieves an AddonFileObject from the installed server add-ons, or an AddonWebObject from the online repository if online=True

ParametersTypeDescription
query*strAdd-on name
onlineboolDefaults to False

Returns a flattened list of all AddonFileObject from addon.installed_addons

Returns a list of locally installed AddonFileObject entries ranked by a search term matched against titles, filenames, authors, and descriptions

ParametersTypeDescription
query*strSearch term to match against installed add-ons

Checks the AddonFileObject.addon_version for installed add-ons against online releases. Returns True if one or more add-ons require an update, otherwise False. Check addon.get_update_list() for the matching objects

Checks installed add-on IDs for Geyser support on supported distributions. Returns True if Geyser is detected

Returns installed AddonFileObject values for which update URLs have already been discovered

Downloads an available update for the target add-on, and replaces the .jar when successful. Returns the updated AddonFileObject or None. This method preserves the enabled or disabled state

ParametersTypeDescription
target*AddonFileObjectAn add-on object from addon.get_addon()

Updates all installed add-ons with discovered update URLs. Returns a list of successfully updated AddonFileObject values.

Looks up a web add-on by name or file object through the configured add-on providers. Returns a matching AddonWebObject when available.

ParametersTypeDescription
addon*str / AddonFileObjectAdd-on name or installed add-on object

Internal method for determining if the add-on configuration has been modified since the last server restart. Returns bool

AttributeTypeDescription
addon.installed_addonsdictContains lists of AddonFileObject; see the structure in examples
addon.addon_pathstrFull filesystem path to the server’s add-ons directory
addon.disabled_addon_pathstrFull filesystem path to the server’s disabled add-ons directory
addon.active_updatesliststr, Identifiers of add-ons whose update operations are in progress
addon.geyser_supportboolTrue If Geyser is detected on a supported distribution
def reload():
if server.type in ('paper', 'purpur', 'spigot', 'craftbukkit'):
server.execute('reload')
else: server.restart()
@server.on_loop(interval=5, unit='second'):
if addon._hash_changed(): reload()
target = addon.find_addon('worldedit')
if target:
installed = addon.download_addon(target)
server.log(f'Installed {installed} successfully!')
for file in addon.return_single_list():
log_type = 'success' if file.enabled else 'warning'
server.log(f'{file.name} - {file.author} ({file.addon_version})', log_type)
addon.installed_addons = {
'enabled': [AddonFileObject, AddonFileObject, ...],
'disabled': [AddonFileObject, AddonFileObject, ...]
}