Class UltiToolsBootstrap

java.lang.Object
com.ultikits.ultitools.bootstrap.UltiToolsBootstrap
All Implemented Interfaces:
io.papermc.paper.plugin.bootstrap.PluginBootstrap

@Internal public final class UltiToolsBootstrap extends Object implements io.papermc.paper.plugin.bootstrap.PluginBootstrap
Paper's early-start entry point. Internal; not an API for modules. An overall preparation failure is retained for enable, where the framework reports it and is disabled. It is not a successful start with no modules. Virtual machine failures may propagate.
  • Field Details

    • result

      @Nullable private @Nullable BootstrapResult result
    • bootstrapFailure

      @Nullable private @Nullable Throwable bootstrapFailure
  • Constructor Details

    • UltiToolsBootstrap

      public UltiToolsBootstrap()
  • Method Details

    • bootstrap

      public void bootstrap(io.papermc.paper.plugin.bootstrap.BootstrapContext context)
      Specified by:
      bootstrap in interface io.papermc.paper.plugin.bootstrap.PluginBootstrap
    • prepareWithoutPaperContext

      @Internal public static BootstrapResult prepareWithoutPaperContext(File dataFolder, Logger logger)
      Runs the shared preparation for an in-process test server that has no Paper bootstrap context. Only pass a successful handover to UltiTools(BootstrapResult): treat a non-null BootstrapResult.classPathFailure() as a preparation failure, and report a non-empty BootstrapResult.modulesRequiringRealServer() as needing a real Paper server.

      Test server root integration belongs at this entry: acquire a scope with ServerRoot.overrideForTestBoot(File) before preparation opens module file transactions. Its owner must retain it through plugin disable and release it after cleanup on every failed or aborted start as well. Without that scope, the data folder must have the isolated test server root as its grandparent, as it does on Paper.

      Parameters:
      dataFolder - the same framework data directory that the test server will give the plugin
      logger - where preparation reports go
      Returns:
      this test start's handover or its explicit content-channel block
    • prepareWithoutPaperContext

      @Internal public static BootstrapResult prepareWithoutPaperContext(File dataFolder, Logger logger, List<ModuleSource> classPathModules)
      Runs prepareWithoutPaperContext(File, Logger) with explicit modules already visible to the framework's class loader. Their hooks run after the admitted JARs, without changing the JAR admission snapshot or treating a parent-loaded class as belonging to a JAR. An explicit module whose API level fails the same minimum check as a JAR, or whose hook fails, blocks the test boot through BootstrapResult.classPathFailure(). Such a refusal takes precedence over a request to verify valid content on a real Paper server.
      Parameters:
      dataFolder - the framework data directory of the isolated test server
      logger - where preparation reports go
      classPathModules - module descriptors paired with their compiled classes directories
      Returns:
      this test start's handover or its explicit preparation or content-channel block
      Throws:
      IllegalArgumentException - if an explicit module root is not a directory
    • prepareWithoutPaperContext

      @Internal public static BootstrapResult prepareWithoutPaperContext(File dataFolder, Logger logger, List<ModuleSource> classPathModules, Map<Class<? extends UltiToolsPlugin>, Map<Class<?>,Object>> replacements)
      Prepares an in-process boot with bean replacements for explicitly supplied class-path modules. The replacements are snapshotted before preparation and applied at module registration, after discovering the real bean definitions and before constructing any of their instances. Paper's bootstrap cannot supply this map, and ordinary external-plugin connections do not use it.

      The caller owns each stand-in's initialization and cleanup. The framework binds it as given: it does not autowire or proxy it, invoke @PostConstruct or @PreDestroy, or automatically register it for scheduling, module events, player-cache cleanup, commands or Bukkit events. AOP annotations such as @Transactional and @ExceptionCatch on the original type do not apply to the stand-in.

      Parameters:
      dataFolder - the framework data directory of the isolated test server
      logger - where preparation reports go
      classPathModules - module descriptors paired with their compiled classes directories
      replacements - prebuilt stand-ins keyed by the module main class and then dependency type
      Returns:
      this test start's handover or its explicit preparation or content-channel block
      Throws:
      IllegalArgumentException - if a module was not supplied, its replacement map is null, or a stand-in is null or has the wrong type
    • snapshotReplacements

      private static Map<Class<? extends UltiToolsPlugin>, Map<Class<?>,Object>> snapshotReplacements(List<ModuleSource> sources, Map<Class<? extends UltiToolsPlugin>, Map<Class<?>,Object>> replacements)
      Copies both map levels before the in-process boot starts; Paper does not take this path.
    • snapshotBindings

      private static Map<Class<?>,Object> snapshotBindings(Class<?> module, @Nullable @Nullable Map<Class<?>,Object> bindings)
    • prepare

      private BootstrapResult prepare(@Nullable @Nullable io.papermc.paper.plugin.bootstrap.BootstrapContext context, File dataFolder, Logger logger, List<ModuleSource> classPathModules, Map<Class<? extends UltiToolsPlugin>, Map<Class<?>,Object>> testBeanReplacements)
    • finishTestBoot

      private static BootstrapResult finishTestBoot(ModuleFileTransactions transactions, ModuleJarAdmission admission, ModuleClassLoader loader, @Nullable @Nullable IOException classPathFailure, ModuleBootstraps.Run run, ContributionRegistry contributions, Map<Class<? extends UltiToolsPlugin>, Map<Class<?>,Object>> testBeanReplacements)
      Transfers replacements only for test boots that reach enable; Paper has a separate handover.
    • installPaperContent

      private ContributionLedger installPaperContent(io.papermc.paper.plugin.bootstrap.BootstrapContext context, File dataFolder, ModuleJarAdmission admission, ContributionRegistry contributions, Logger logger)
    • channelInstaller

      void channelInstaller(io.papermc.paper.plugin.bootstrap.BootstrapContext context, ContributionRegistry contributions, Logger logger)
    • classPath

      URL[] classPath(ModuleFileTransactions transactions, File dataFolder, @Nullable @Nullable URL serverJar, ModuleJarAdmission admission) throws IOException
      Throws:
      IOException
    • createPlugin

      public org.bukkit.plugin.java.JavaPlugin createPlugin(io.papermc.paper.plugin.bootstrap.PluginProviderContext context)
      Specified by:
      createPlugin in interface io.papermc.paper.plugin.bootstrap.PluginBootstrap
    • result

      BootstrapResult result()