Class RyseInventory.Builder

java.lang.Object
io.github.rysefoxx.inventory.plugin.pagination.RyseInventory.Builder
Enclosing class:
RyseInventory

public static class RyseInventory.Builder extends Object
Builder to create an inventory.
  • Method Details

    • newInstance

      @NotNull public @NotNull RyseInventory.Builder newInstance()
    • keepOriginal

      @NotNull public @NotNull RyseInventory.Builder keepOriginal()
    • disableUpdateTask

      @NotNull public @NotNull RyseInventory.Builder disableUpdateTask()
      This function disables the update task.
      Returns:
      A Builder object.
    • permanentCache

      public RyseInventory.Builder permanentCache()
      Save the inventory permanently in a list. As a result, you can always get this inventory through the InventoryManager.getInventory(Object) method. Of course, the inventory must be given an ID by the identifier(Object) method
      Returns:
      A Builder object.
    • ignoredSlot

      @NotNull public @NotNull RyseInventory.Builder ignoredSlot(@Nonnegative int slot, @NotNull @NotNull Consumer<org.bukkit.event.inventory.InventoryClickEvent> event)
      In this slot items can be taken or added by the player. However, you can now add your own logic.
      Parameters:
      slot - The slot
      event - Your event with your own logic when the item is clicked.
      Returns:
      The Inventory Builder to set additional options.
    • ignoredSlot

      @NotNull public @NotNull RyseInventory.Builder ignoredSlot(@NotNull @NotNull BooleanSupplier condition, @Nonnegative int slot, @NotNull @NotNull Consumer<org.bukkit.event.inventory.InventoryClickEvent> event)
      In this slot items can be taken or added by the player. However, you can now add your own logic.
      Parameters:
      condition - The condition must return true for the slots to be ignored.
      slot - The slot
      event - Your event with your own logic when the item is clicked.
      Returns:
      The Inventory Builder to set additional options.
    • ignoredSlots

      @NotNull public @NotNull RyseInventory.Builder ignoredSlots(@NotNull @NotNull List<Integer> slots, @NotNull @NotNull Consumer<org.bukkit.event.inventory.InventoryClickEvent> event)
      In all these slots items can be taken or added by the player. However, you can now add your own logic.
      Parameters:
      slots - The slots
      event - Your event with your own logic when the item is clicked.
      Returns:
      The Inventory Builder to set additional options.
    • ignoredSlots

      @NotNull public @NotNull RyseInventory.Builder ignoredSlots(@NotNull @NotNull BooleanSupplier condition, @NotNull @NotNull List<Integer> slots, @NotNull @NotNull Consumer<org.bukkit.event.inventory.InventoryClickEvent> event)
      In all these slots items can be taken or added by the player. However, you can now add your own logic.
      Parameters:
      condition - The condition must return true for the slots to be ignored.
      slots - The slots
      event - Your event with your own logic when the item is clicked.
      Returns:
      The Inventory Builder to set additional options.
    • ignoredSlots

      @NotNull public @NotNull RyseInventory.Builder ignoredSlots(int @NotNull ... slots)
      In all these slots items can be put in or removed by the user.
      Parameters:
      slots - The slots
      Returns:
      The Inventory Builder to set additional options.
    • ignoredSlots

      @NotNull public @NotNull RyseInventory.Builder ignoredSlots(@NotNull @NotNull BooleanSupplier condition, int... slots)
      In all these slots items can be put in or removed by the user.
      Parameters:
      slots - The slots
      condition - The condition must return true for the slots to be ignored.
      Returns:
      The Inventory Builder to set additional options.
    • options

      @NotNull public @NotNull RyseInventory.Builder options(InventoryOptions @NotNull ... options)
      Settings to help ensure that the player is not disturbed while he has the inventory open.
      Parameters:
      options - All setting options for the inventory
      Returns:
      The Inventory Builder to set additional options.
    • closeAfter

      @NotNull public @NotNull RyseInventory.Builder closeAfter(@Nonnegative int time, @Nullable @Nullable TimeSetting setting)
      With this method you can automatically set when to close the inventory.
      Parameters:
      time - Time
      setting - Set your own time type.
      Returns:
      The Inventory Builder to set additional options.
    • close

      @NotNull public @NotNull RyseInventory.Builder close(CloseReason @NotNull ... reasons)
      Here you can set possible reasons to automatically close the inventory when the reason takes place.
      Parameters:
      reasons - The reason to close the inventory.
      Returns:
      The Inventory Builder to set additional options.
    • loadDelay

      @NotNull public @NotNull RyseInventory.Builder loadDelay(@Nonnegative int time, @Nullable @Nullable TimeSetting setting)
      With this method, the content of the inventory is loaded later.
      Parameters:
      time - Time
      setting - Set your own time type.
      Returns:
      The Inventory Builder to set additional options.
    • loadTitle

      @NotNull public @NotNull RyseInventory.Builder loadTitle(@Nonnegative int time, @Nullable @Nullable TimeSetting setting)
      With this method the title will be loaded later.
      Parameters:
      time - Time
      setting - Set your own time type.
      Returns:
      The Inventory Builder to set additional options.
    • type

      @NotNull public @NotNull RyseInventory.Builder type(@NotNull @NotNull InventoryOpenerType type)
      Modifies the inventory type.
      Parameters:
      type - What type of inventory should it be.
      Returns:
      The Inventory Builder to set additional options.

      By default, the type is CHEST

    • enableAction

      @NotNull public @NotNull RyseInventory.Builder enableAction(@NotNull @NotNull BooleanSupplier condition, Action @NotNull ... actions)
      This allows to get more control over the InventoryAction. E.g. you can say that DOUBLE_CLICK as well as MOVE_TO_OTHER_INVENTORY should be activated and thereby the InventoryClickEvent is not canceled.
      Parameters:
      actions - The actions
      condition - The condition must return true for the action to be activated.
      Returns:
      The Inventory Builder to set additional options.
    • enableAction

      @NotNull public @NotNull RyseInventory.Builder enableAction(Action @NotNull ... actions)
      This allows to get more control over the InventoryAction. E.g. you can say that DOUBLE_CLICK as well as MOVE_TO_OTHER_INVENTORY should be activated and thereby the InventoryClickEvent is not canceled.
      Parameters:
      actions - The actions
      Returns:
      The Inventory Builder to set additional options.
    • clearAndSafe

      @NotNull public @NotNull RyseInventory.Builder clearAndSafe()
      When the inventory is opened, the inventory is emptied and saved. When closing the inventory, the inventory will be reloaded.
      Returns:
      The Inventory Builder to set additional options.

      By default, the inventory is not emptied and saved.

    • size

      @NotNull public @NotNull RyseInventory.Builder size(@Nonnegative int size) throws IllegalArgumentException
      Parameters:
      size - The inventory size
      Returns:
      The Inventory Builder to set additional options.
      Throws:
      IllegalArgumentException - if size is smaller than 9 or larger than 54.
    • identifier

      @NotNull public @NotNull RyseInventory.Builder identifier(@NotNull @NotNull Object identifier)
      Gives the inventory an identification
      Parameters:
      identifier - The ID through which you can get the inventory
      Returns:
      The Inventory Builder to set additional options.
    • provider

      @NotNull public @NotNull RyseInventory.Builder provider(@NotNull @NotNull InventoryProvider provider)
      The provider to fill the inventory with content.
      Parameters:
      provider - Implement with new InventoryProvider()
      Returns:
      The Inventory Builder to set additional options.
    • preventClose

      @NotNull public @NotNull RyseInventory.Builder preventClose()
      This method can be used to prevent the player from closing the inventory.
      Returns:
      The Inventory Builder to set additional options.

      The inventory is always closable by default.

    • preventTransferData

      @NotNull public @NotNull RyseInventory.Builder preventTransferData()
      The method can be used so that data is not transferred to the next page as well.
      Returns:
      The Inventory Builder to set additional options.

      The data is always transferred by default.

    • ignoreManualItems

      @NotNull public @NotNull RyseInventory.Builder ignoreManualItems()
      If this method is called, all items that the player can set himself will not be saved.
      Returns:
      The Inventory Builder to set additional options.
    • delay

      @NotNull public @NotNull RyseInventory.Builder delay(@Nonnegative int time, @Nullable @Nullable TimeSetting setting)
      Adjusts the delay of the scheduler.
      Parameters:
      time - Time
      setting - Set your own time type.
      Returns:
      The Inventory Builder to set additional options.
    • openDelay

      @NotNull public @NotNull RyseInventory.Builder openDelay(@Nonnegative int time, @Nullable @Nullable TimeSetting setting)
      Adjusts the delay before the inventory is opened.
      Parameters:
      time - Time
      setting - Set your own time type.
      Returns:
      The Inventory Builder to set additional options.
    • period

      @NotNull public @NotNull RyseInventory.Builder period(@Nonnegative int time, @Nullable @Nullable TimeSetting setting)
      Adjusts the period of the scheduler.
      Parameters:
      time - Time
      setting - Set your own time type.
      Returns:
      The Inventory Builder to set additional options.
    • rows

      @NotNull public @NotNull RyseInventory.Builder rows(@Nonnegative int rows) throws IllegalArgumentException
      If you do not have a size but a row, you can also create an inventory by doing this. This number of rows is used for each page.
      Parameters:
      rows - The row
      Returns:
      The Inventory Builder to set additional options.
      Throws:
      IllegalArgumentException - if rows greater than 6

      If you had to create an inventory with 1 row, do not pass 0 but 1. Also applies to multiple rows.
      If this method is used, the method rows(Page) is ignored.

    • rows

      @NotNull public @NotNull RyseInventory.Builder rows(@NotNull @NotNull Page page)
      Add to a page the rows you want.
      Parameters:
      page - The page
      Returns:
      The Inventory Builder to set additional options.
    • rows

      @NotNull public @NotNull RyseInventory.Builder rows(Page @NotNull ... pages)
      Add to a page the rows you want.
      Parameters:
      pages - The pages
      Returns:
      The Inventory Builder to set additional options.
    • title

      @NotNull public @NotNull RyseInventory.Builder title(@NotNull @NotNull String title)
      Assigns a fixed title to the inventory
      Parameters:
      title - The title
      Returns:
      The Inventory Builder to set additional options.

      The title can also be changed later when the inventory is open.

    • title

      @NotNull public @NotNull RyseInventory.Builder title(@NotNull @NotNull net.kyori.adventure.text.Component title)
      Assigns a fixed title to the inventory
      Parameters:
      title - The title
      Returns:
      The Inventory Builder to set additional options.

      The title can also be changed later when the inventory is open.

    • animation

      @NotNull public @NotNull RyseInventory.Builder animation(@NotNull @NotNull SlideAnimation animation)
      Based on this animation, the items can appear animated when opening the inventory.
      Parameters:
      animation - SlideAnimation.builder(Plugin)
      Returns:
      The Inventory Builder to set additional options.
    • titleHolder

      @NotNull public @NotNull RyseInventory.Builder titleHolder(@NotNull @NotNull String title)
      Adds a temporary title to the inventory.
      Parameters:
      title - The temp title
      Returns:
      The Inventory Builder to set additional options.

      This title is used when the loadTitle(int, TimeSetting) method is used.

    • titleHolder

      @NotNull public @NotNull RyseInventory.Builder titleHolder(@NotNull @NotNull net.kyori.adventure.text.Component title)
      Adds a temporary title to the inventory.
      Parameters:
      title - The temp title
      Returns:
      The Inventory Builder to set additional options.

      This title is used when the loadTitle(int, TimeSetting) method is used.

    • listener

      @NotNull public @NotNull RyseInventory.Builder listener(@NotNull @NotNull EventCreator<? extends org.bukkit.event.Event> event)
      Adds its own event to the inventory.
      Parameters:
      event - What kind of event
      Returns:
      The Inventory Builder to set additional options.
    • ignoreClickEvent

      @NotNull public @NotNull RyseInventory.Builder ignoreClickEvent(DisabledInventoryClick @NotNull ... clicks)
      Set what should be ignored in the InventoryClickEvent.
      Parameters:
      clicks - What should be ignored
      Returns:
      The Inventory Builder to set additional options.
    • ignoreEvents

      @NotNull public @NotNull RyseInventory.Builder ignoreEvents(DisabledEvents @NotNull ... events)
      Disables events according to wishes.
      Parameters:
      events - The events
      Returns:
      The Inventory Builder to set additional options.
    • fixedPageSize

      public RyseInventory.Builder fixedPageSize(@Nonnegative int page)
      Sets a page number. These pages can be opened at any time independently of the item.
      Parameters:
      page - The page number
      Returns:
      The Inventory Builder to set additional options.
    • build

      @NotNull public @NotNull RyseInventory build(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @Nullable @Nullable InventoryManager defaultManager) throws IllegalStateException
      Builds the RyseInventory
      Parameters:
      plugin - Instance to your main class.
      defaultManager - The default manager if the player does not have a custom manager.
      Returns:
      the RyseInventory
      Throws:
      IllegalStateException - if manager is null or if the provider is null
    • build

      @NotNull public @NotNull RyseInventory build(@NotNull @NotNull org.bukkit.plugin.Plugin plugin) throws IllegalStateException
      Builds the RyseInventory
      Parameters:
      plugin - Instance to your main class.
      Returns:
      the RyseInventory
      Throws:
      IllegalStateException - if manager is null or if the provider is null