Class ContainerSpec

java.lang.Object
com.ultikits.ultitools.ui.ContainerSpec

public final class ContainerSpec extends Object
How to create a container. Immutable.
  • Field Details

    • MAX_SIZE

      public static final int MAX_SIZE
      Maximum number of container indexes.
      See Also:
    • kind

      private final ContainerKind kind
    • size

      private final int size
    • policy

      private final TransferPolicy policy
    • disposition

      @Nullable private final @Nullable Disposition disposition
    • store

      @Nullable private final @Nullable ContainerStore store
    • commitTimeout

      private final Duration commitTimeout
    • undelivered

      @Nullable private final @Nullable UndeliveredHandler undelivered
    • endWhenUnviewed

      private final boolean endWhenUnviewed
    • onChange

      private final Consumer<ContainerChange> onChange
    • contributor

      @Nullable private final @Nullable UUID contributor
    • initial

      private final List<org.bukkit.inventory.ItemStack> initial
    • baseline

      private final List<org.bukkit.inventory.ItemStack> baseline
  • Constructor Details

  • Method Details

    • storage

      public static ContainerSpec.Builder storage(int size)
      Real items. A disposition is required. @throws IllegalArgumentException outside 1..4096
    • template

      public static ContainerSpec.Builder template(int size)
      Copies (editors of definitions): put-in copies, take-out deletes the copy; no disposition, store or handler.
    • kind

      public ContainerKind kind()
      Whether items are real or template copies.
    • size

      public int size()
      The number of indexes.
    • policy

      public TransferPolicy policy()
      The transfer policy.
    • disposition

      public Optional<Disposition> disposition()
      The storage disposition; absent for templates.
    • store

      public Optional<ContainerStore> store()
      The optional store.
    • commitTimeout

      public Duration commitTimeout()
      Maximum time to wait for a store answer.
    • undelivered

      public Optional<UndeliveredHandler> undelivered()
      The storage handler; absent for templates.
    • endWhenUnviewed

      public boolean endWhenUnviewed()
      Whether the last screen's close ends the container.
    • onChange

      public Consumer<ContainerChange> onChange()
      Listener invoked after each applied transfer.
    • contributor

      public Optional<UUID> contributor()
      Contributor of initial(), absent when baseline contents were selected.
    • initial

      public List<org.bukkit.inventory.ItemStack> initial()
      Contributed initial contents; copies, empty stacks when a baseline was selected.
    • baseline

      public List<org.bukkit.inventory.ItemStack> baseline()
      Baseline contents; copies, empty stacks when contributed initial contents were selected.
    • copyItem

      static org.bukkit.inventory.ItemStack copyItem(org.bukkit.inventory.ItemStack item, String name)
    • copyItems

      static List<org.bukkit.inventory.ItemStack> copyItems(List<org.bukkit.inventory.ItemStack> items, String name)