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.

Exits early when usercache.json is missing, which usually indicates a pre-1.7.6 server that does not need UUID conversion.

  • 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, or exits if the file is absent.
      Specified by:
      setTargets in interface MOOCPlugin
      Parameters:
      ctx - the shared conversion context
      Returns:
      a single-element list containing the usercache path
    • 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