Class PrefetchUsercache

java.lang.Object
me.pauleff.converter.plugins.PrefetchUsercache
All Implemented Interfaces:
DefaultPlugin, MOOCPlugin

public class PrefetchUsercache extends Object implements DefaultPlugin
Prefills the context UUID map from usercache.json for an online/offline conversion.

Online conversion requires cached player names. Offline cache entries are resolved via the configured profile API; online cache entries supply the online UUID directly.

  • Constructor Details

    • PrefetchUsercache

      public PrefetchUsercache()
  • Method Details

    • metadata

      public PluginMetadata metadata()
      Returns the metadata that identifies and describes this plugin.
      Specified by:
      metadata in interface MOOCPlugin
      Returns:
      the plugin metadata
    • isEnabled

      public boolean isEnabled(PluginContext ctx)
      Returns true when an online/offline conversion was requested.
      Specified by:
      isEnabled in interface DefaultPlugin
      Specified by:
      isEnabled in interface MOOCPlugin
      Parameters:
      ctx - the shared conversion context
      Returns:
      true if this is a conversion operation; false otherwise
    • setTargets

      public List<Path> setTargets(PluginContext ctx)
      Returns usercache.json under the server folder when available. A full-server run exits with the legacy-version notice when the file is missing. Custom targets continue without prefetched profiles.
      Specified by:
      setTargets in interface MOOCPlugin
      Parameters:
      ctx - the shared conversion context
      Returns:
      the usercache path, or an empty list if it is missing for a custom target
    • run

      public void run(PluginContext ctx, List<Path> resolvedExistingTargets) throws IOException
      Loads known players from each resolved usercache and stores UUID remappings on the context.
      Specified by:
      run in interface MOOCPlugin
      Parameters:
      ctx - the shared conversion context
      resolvedExistingTargets - the existing usercache paths to read
      Throws:
      IOException - if reading a usercache file fails