Class ImportManager

java.lang.Object
com.ranull.graves.manager.ImportManager

public final class ImportManager extends Object
Imports graves from external plugins (currently AngelChest) and converts them to GravesX Grave objects.
  • Field Details

    • plugin

      private final Graves plugin
      Main plugin instance.
    • FILENAME_PATTERN

      private static final Pattern FILENAME_PATTERN
      Filename pattern: player_world_x_y_z.yml (supports negative coords).
  • Constructor Details

    • ImportManager

      public ImportManager(Graves plugin)
      Creates a new importer bound to the given plugin instance.
      Parameters:
      plugin - the GravesX plugin instance
  • Method Details

    • countAngelChestImportableOnly

      public long countAngelChestImportableOnly()
      Counts AngelChest graves that will import successfully
      Returns:
      the number of graves that can be imported from AngelChest
    • importExternalPluginAngelChest

      public List<Grave> importExternalPluginAngelChest()
      Imports all AngelChest graves found on disk.
      Returns:
      a list of converted Grave objects
    • countAngelChestStatusText

      public String countAngelChestStatusText()
      Dry-run scan (text): counts total/importable/missing-world/invalid-YAML AngelChest files. Does NOT create graves or inventories.
      Returns:
      multiline human-readable summary
    • listAngelChestMissingWorldText

      public String listAngelChestMissingWorldText()
      Dry-run scan (text): list files whose world cannot be resolved on this server, including helpful hints (UUIDs/names/coords) to aid manual fixes or world restores.
      Returns:
      multiline human-readable list of missing-world entries
    • nullOr

      private static String nullOr(Object o)
    • importAngelChest

      private List<Grave> importAngelChest()
      Scans the AngelChest data directory and converts each file into a Grave.
      Returns:
      a list of converted Grave objects
    • convertAngelChestToGrave

      public Grave convertAngelChestToGrave(File file)
      Converts a single AngelChest YAML file into a Grave, applying fallbacks for world, coords, and metadata.
      Parameters:
      file - the AngelChest YAML file to convert
      Returns:
      the converted Grave, or null if the file is invalid
    • loadFile

      private org.bukkit.configuration.file.FileConfiguration loadFile(File file)
      Loads a YAML file if it exists and is valid.
      Parameters:
      file - the file to load
      Returns:
      the FileConfiguration, or null if invalid
    • readItemList

      private List<org.bukkit.inventory.ItemStack> readItemList(org.bukkit.configuration.file.FileConfiguration cfg, String path, boolean reverseIfList)
      Reads an item list at the given path, skipping nulls and deserializing map entries.
    • resolveWorldForScan

      private org.bukkit.World resolveWorldForScan(org.bukkit.configuration.file.FileConfiguration ac, String fileName)
      Resolve world for scanning/import decisions (tries UUIDs, filename world, logfile world). Returns null if the world is not present on this server.
    • parseOwnerFromFilename

      private String parseOwnerFromFilename(String name)
      Extracts the player name from an AngelChest filename.
    • parseWorldFromFilename

      private String parseWorldFromFilename(String name)
      Extracts the world name from an AngelChest filename.
    • parseCoordsFromFilename

      private int[] parseCoordsFromFilename(String name)
      Extracts integer coordinates from an AngelChest filename.
      Returns:
      [x,y,z] or null if not matched
    • listAngelChestFiles

      private File[] listAngelChestFiles()
    • resolveTimeAliveMillis

      private long resolveTimeAliveMillis(org.bukkit.configuration.file.FileConfiguration ac, Grave grave)
    • resolveProtectionMillis

      private long resolveProtectionMillis(org.bukkit.configuration.file.FileConfiguration ac, Grave grave)