Class CustomEnderChestReader

java.lang.Object
com.enhancedechest.migration.CustomEnderChestReader

public final class CustomEnderChestReader extends Object
Reads a CustomEnderChest (maiminhdung) installation's storage.type: yml player files and decodes them into Bukkit ItemStack arrays, ready to be re-encoded into EnhancedEchest's own storage.

Unlike AxVaults/PlayerVaultsX, CustomEnderChest gives each player a single ender chest (sized by their highest-ranked permission), not several numbered vaults — matching EnhancedEchest's own base chest #1. Each player's chest lives in a flat file plugins/CustomEnderChest/playerdata/<uuid>.yml with the shape:

 player-name: Steve
 enderchest-size: 27
 enderchest-inventory:
 - DataVersion: 4671
   id: minecraft:diamond_sword
   count: 1
   schema_version: 1
 - null
 - ...
 
enderchest-inventory has exactly enderchest-size entries, each either null (empty slot) or a plain map in Bukkit's standard modern item-serialization shape (the same id/count/components/DataVersion keys ItemStack.serialize() itself produces since 1.20.5, plus CustomEnderChest's own schema_version marker, which ItemStack.deserialize(Map) simply ignores). Since the list is nested inside enderchest-inventory rather than a direct configuration-section key, Bukkit's YAML loader hands each map back as a plain Map<String, Object> (not wrapped in a ConfigurationSection), so it can be passed to ItemStack.deserialize(Map) as-is.

CustomEnderChest's h2 (default) and mysql backends are not read by this class — an admin must set storage.type: yml in CustomEnderChest/config.yml and restart the source server first (the same one-time switch AxVaults migration already asks for).

Stateless and holds no resources. YAML parsing and item deserialization are read-only against the frozen server registries and safe off the main thread (the migration runs on the shared DB executor).

  • Constructor Details

    • CustomEnderChestReader

      public CustomEnderChestReader(Path customEnderChestFolder, org.slf4j.Logger log)
  • Method Details

    • sourceAvailable

      public boolean sourceAvailable()
      True if CustomEnderChest YAML player data is present (the playerdata folder holds at least one file).
    • listOwners

      public List<UUID> listOwners() throws Exception
      Returns the owner UUIDs of every readable player file in playerdata, skipping bad names.
      Throws:
      Exception
    • read

      @Nullable public @Nullable CustomEnderChestReader.PlayerData read(UUID owner) throws Exception
      Reads and decodes a single player's ender chest, or null if they have no file.
      Throws:
      Exception