Class ModuleApiLevels
/upm installs from a catalogue.
A module declares the UltiTools API level it is built for as the integer api-version
of its plugin.yml. /upm installs, installs by version and stages updates only of
modules at MIN_INSTALLABLE_API_LEVEL up to this framework's own level, and sends both
numbers to the catalogue on every request so that the catalogue offers nothing else.
Why the floor exists. UltiTools-API 6.3.0 made UltiToolsPlugin.unregisterSelf()
final, and every module built before 6.3.0 overrides it, so such a module fails to link
(IncompatibleClassChangeError) at the next start. A catalogue that serves a pre-6.3.0
build -- one that does not filter by level, or a version recorded wrongly -- would otherwise be
downloaded, reported installed and then refused at restart.
The module loader's admission rule is separate and unchanged: a JAR an operator places
in the modules folder by hand is still judged by PluginManager's own rule. This class is an
install policy of /upm, which only fetches from a catalogue.
The upper bound reuses PluginManager.requiresNewerFramework(int, int), the single
definition of "the module needs a newer framework", so that comparison still exists once.
- Since:
- 6.3.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Loggerstatic final intThe lowest moduleapi-version/upminstalls: the first level built against the 6.3.0 module contract. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intThis framework's own API level, asUltiTools.getPluginVersion()reads it from the bundledenv.yml(630 for 6.3.0 and its snapshots).static booleanisInstallable(int moduleLevel, int floor, int frameworkLevel) Whether/upminstalls a module declaringmoduleLevel.static IntegerAplugin.ymlapi-versionas an integer level.
-
Field Details
-
MIN_INSTALLABLE_API_LEVEL
public static final int MIN_INSTALLABLE_API_LEVELThe lowest moduleapi-version/upminstalls: the first level built against the 6.3.0 module contract. Sent to the catalogue asminApiLevel, and used by the check of every downloaded JAR, so the catalogue never holds a second copy of this policy.- See Also:
-
LOGGER
-
-
Constructor Details
-
ModuleApiLevels
private ModuleApiLevels()
-
-
Method Details
-
frameworkLevel
public static int frameworkLevel()This framework's own API level, asUltiTools.getPluginVersion()reads it from the bundledenv.yml(630 for 6.3.0 and its snapshots).When that cannot be read, or reads below
MIN_INSTALLABLE_API_LEVEL-- impossible for a build that contains this class, so a misreading -- the floor is used instead and a warning is logged. The floor is a lower bound of the true level, so the fallback can only refuse a module this framework could load; it never admits one it cannot.- Returns:
- the level to send as
apiLeveland to check downloads against
-
isInstallable
public static boolean isInstallable(int moduleLevel, int floor, int frameworkLevel) Whether/upminstalls a module declaringmoduleLevel.- Parameters:
moduleLevel- the module's declaredapi-versionfloor- the lowest level installed,MIN_INSTALLABLE_API_LEVELframeworkLevel- this framework's level,frameworkLevel()- Returns:
truewhenfloor <= moduleLevel <= frameworkLevel
-
parse
Aplugin.ymlapi-versionas an integer level.- Parameters:
declared- the value as read, ornullwhen the key is absent- Returns:
- the level, or
nullwhen absent or not an integer (for example Bukkit's'1.19')
-