Class InventoryDataProvider

java.lang.Object
org.mvplugins.multiverse.inventories.view.InventoryDataProvider

@Experimental @AvailableSince("5.2") @Service public final class InventoryDataProvider extends Object
Provides methods for asynchronously loading player inventory data. This class encapsulates the business logic for fetching inventory, armor, and off-hand contents.
Since:
5.2
  • Method Details

    • loadPlayerInventoryData

      @AvailableSince("5.2") public CompletableFuture<PlayerInventoryData> loadPlayerInventoryData(@NotNull @NotNull org.bukkit.OfflinePlayer targetPlayer, @NotNull @NotNull String worldName)
      Asynchronously loads a player's inventory data. If the player is online AND in the specified world, it attempts to get their live inventory. Otherwise (offline or online in a different world), it loads from Multiverse-Inventories' stored profiles.
      Parameters:
      targetPlayer - The OfflinePlayer whose inventory data to load.
      worldName - The name of the world to load the inventory from (either live or stored).
      Returns:
      A CompletableFuture that will complete with PlayerInventoryData or an exception.
      Since:
      5.2
    • savePlayerInventoryData

      @AvailableSince("5.2") public CompletableFuture<Void> savePlayerInventoryData(@NotNull @NotNull org.bukkit.OfflinePlayer targetPlayer, @NotNull @NotNull String worldName, @NotNull @NotNull ProfileType profileType, @NotNull @NotNull org.bukkit.inventory.ItemStack[] newContents, @NotNull @NotNull org.bukkit.inventory.ItemStack[] newArmor, @Nullable @Nullable org.bukkit.inventory.ItemStack newOffHand)
      Asynchronously saves a player's inventory data to their Multiverse-Inventories profile. If the player is online and in the target world, their live inventory is also updated.
      Parameters:
      targetPlayer - The OfflinePlayer whose inventory data to save.
      worldName - The name of the world the inventory belongs to.
      profileType - The ProfileType (e.g., SURVIVAL) associated with this inventory data.
      newContents - The new main inventory contents (slots 0-35).
      newArmor - The new armor contents (helmet, chestplate, leggings, boots).
      newOffHand - The new off-hand item.
      Returns:
      A CompletableFuture that completes when saving is done, or an exception occurs.
      Since:
      5.2