Class ServerRoot

java.lang.Object
com.ultikits.ultitools.utils.ServerRoot

@Internal public final class ServerRoot extends Object
Resolves the framework's server root. Without a test boot override, each consumer keeps its original source: either the JVM working-directory property or the plugin data folder's grandparent. They need not match, so neither is a fallback for the other.
  • Field Details

  • Constructor Details

    • ServerRoot

      private ServerRoot()
  • Method Details

    • workingDirectory

      public static File workingDirectory()
      Returns:
      the test root, or the same working-directory file used by the panel on Paper
    • forDataFolder

      @Nullable public static @Nullable File forDataFolder(File dataFolder)
      Uses the same lexical parent lookup as the credential store. Callers which used to make the data folder absolute first (module file transactions) must continue to do so themselves.
      Parameters:
      dataFolder - the plugin's data folder
      Returns:
      the test root or the given folder's grandparent, without normalizing the path
    • overrideForTestBoot

      public static ServerRoot.TestScope overrideForTestBoot(File root)
      Installs a root for the in-process test boot entry only. Acquire the scope before bootstrap prepares module transactions; hold it until the plugin and its background work have shut down. Close it on failed boot as well, after any partial-start cleanup. The override is visible to framework worker threads and is not a server setting or a module API.
      Parameters:
      root - the isolated test server directory (distinct from the plugin's data folder)
      Returns:
      the handle that owns this override
      Throws:
      IllegalArgumentException - if the root is relative
      IllegalStateException - if another test boot already holds the override