Package com.ranull.graves.manager
Class ImportManager
java.lang.Object
com.ranull.graves.manager.ImportManager
Imports graves from external plugins (currently AngelChest) and converts them to GravesX
Grave objects.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionImportManager(Graves plugin) Creates a new importer bound to the given plugin instance. -
Method Summary
Modifier and TypeMethodDescriptionconvertAngelChestToGrave(File file) Converts a single AngelChest YAML file into aGrave, applying fallbacks for world, coords, and metadata.longCounts AngelChest graves that will import successfullyDry-run scan (text): counts total/importable/missing-world/invalid-YAML AngelChest files.Scans the AngelChest data directory and converts each file into aGrave.Imports all AngelChest graves found on disk.private File[]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.private org.bukkit.configuration.file.FileConfigurationLoads a YAML file if it exists and is valid.private static Stringprivate int[]Extracts integer coordinates from an AngelChest filename.private StringparseOwnerFromFilename(String name) Extracts the player name from an AngelChest filename.private StringparseWorldFromFilename(String name) Extracts the world name from an AngelChest filename.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.private longresolveProtectionMillis(org.bukkit.configuration.file.FileConfiguration ac, Grave grave) private longresolveTimeAliveMillis(org.bukkit.configuration.file.FileConfiguration ac, Grave grave) private org.bukkit.WorldresolveWorldForScan(org.bukkit.configuration.file.FileConfiguration ac, String fileName) Resolve world for scanning/import decisions (tries UUIDs, filename world, logfile world).
-
Field Details
-
plugin
Main plugin instance. -
FILENAME_PATTERN
Filename pattern: player_world_x_y_z.yml (supports negative coords).
-
-
Constructor Details
-
ImportManager
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
Imports all AngelChest graves found on disk.- Returns:
- a list of converted
Graveobjects
-
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
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
-
importAngelChest
Scans the AngelChest data directory and converts each file into aGrave.- Returns:
- a list of converted
Graveobjects
-
convertAngelChestToGrave
Converts a single AngelChest YAML file into aGrave, applying fallbacks for world, coords, and metadata.- Parameters:
file- the AngelChest YAML file to convert- Returns:
- the converted
Grave, ornullif the file is invalid
-
loadFile
Loads a YAML file if it exists and is valid.- Parameters:
file- the file to load- Returns:
- the
FileConfiguration, ornullif 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
Extracts the player name from an AngelChest filename. -
parseWorldFromFilename
Extracts the world name from an AngelChest filename. -
parseCoordsFromFilename
Extracts integer coordinates from an AngelChest filename.- Returns:
- [x,y,z] or null if not matched
-
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)
-