Class ModuleApiLevels

java.lang.Object
com.ultikits.ultitools.manager.ModuleApiLevels

@Internal public final class ModuleApiLevels extends Object
The shared minimum module API level for loading and catalogue installation.

A module declares its UltiTools API level as the integer api-version in plugin.yml. UltiTools-API 7.0 is a new baseline: a declared integer below MIN_INSTALLABLE_API_LEVEL is refused before the module's main class loads. Missing or non-integer declarations are refused too, including on manual loading.

/upm requires an integer declaration and installs or stages updates only from this floor through the framework's own level. Its catalogue version requests send both bounds. Rebuilding against 7.0 is required; changing an old module's declaration alone does not repair bytecode that references removed APIs.

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

    Fields
    Modifier and Type
    Field
    Description
    private static final Logger
     
    static final int
    The lowest declared module api-version loaded or installed on the 7.0 baseline.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    This framework's own API level, as UltiTools.getPluginVersion() reads it from the bundled env.yml (700 for 7.0.0 and its snapshots).
    static boolean
    isInstallable(int moduleLevel, int floor, int frameworkLevel)
    Whether /upm installs a module declaring moduleLevel.
    static boolean
    isLoadable(Integer moduleLevel)
    The minimum admission shared by manual loading, installation and staged updates.
    private static boolean
    meetsFloor(Integer moduleLevel, int floor)
     
    static Integer
    parse(String declared)
    A plugin.yml api-version as an integer level.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MIN_INSTALLABLE_API_LEVEL

      public static final int MIN_INSTALLABLE_API_LEVEL
      The lowest declared module api-version loaded or installed on the 7.0 baseline. Sent to the catalogue as minApiLevel and checked before loading a module main class and before accepting a downloaded JAR.
      See Also:
    • LOGGER

      private static final Logger LOGGER
  • Constructor Details

    • ModuleApiLevels

      private ModuleApiLevels()
  • Method Details

    • frameworkLevel

      public static int frameworkLevel()
      This framework's own API level, as UltiTools.getPluginVersion() reads it from the bundled env.yml (700 for 7.0.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 apiLevel and to check downloads against
    • isInstallable

      public static boolean isInstallable(int moduleLevel, int floor, int frameworkLevel)
      Whether /upm installs a module declaring moduleLevel.
      Parameters:
      moduleLevel - the module's declared api-version
      floor - the lowest level installed, MIN_INSTALLABLE_API_LEVEL
      frameworkLevel - this framework's level, frameworkLevel()
      Returns:
      true when floor <= moduleLevel <= frameworkLevel
    • isLoadable

      public static boolean isLoadable(Integer moduleLevel)
      The minimum admission shared by manual loading, installation and staged updates. The loader keeps its existing post-instantiation upper-bound check.
      Parameters:
      moduleLevel - the parsed declaration, or null when invalid or absent
      Returns:
      whether the module declares an integer at or above the minimum
    • meetsFloor

      private static boolean meetsFloor(Integer moduleLevel, int floor)
    • parse

      public static Integer parse(String declared)
      A plugin.yml api-version as an integer level.
      Parameters:
      declared - the value as read, or null when the key is absent
      Returns:
      the level, or null when absent or not an integer (for example Bukkit's '1.19')