Class RyseInventory

java.lang.Object
io.github.rysefoxx.inventory.plugin.pagination.RyseInventory

public class RyseInventory extends Object
  • Field Details

    • delayed

      protected final List<org.bukkit.entity.Player> delayed
  • Method Details

    • deserialize

      @Nullable public static @Nullable RyseInventory deserialize(@NotNull @NotNull Map<String,Object> data, @NotNull @NotNull InventoryManager manager)
      Deserializes the inventory from a hashmap.
      Parameters:
      data - The serialized inventory.
      manager - The manager that will be used to create the inventory.
      Returns:
      The deserialized inventory.
    • serialize

      @NotNull public @NotNull Map<String,Object> serialize()
      Serializes the inventory to a map.
      Returns:
      The serialized inventory.
      See Also:
    • builder

      @Contract(" -> new") @NotNull public static @NotNull RyseInventory.Builder builder()
      Builder to create an inventory.
      Returns:
      The Builder object with several methods
    • newInstance

      @NotNull public @NotNull RyseInventory newInstance()
      Clones the current RyseInventory and returns the new RyseInventory instance.
      Returns:
      The new RyseInventory instance.
    • getLoreAnimation

      @NotNull public @NotNull Optional<IntelligentItemLoreAnimator> getLoreAnimation(@NotNull @NotNull Object identifier)
      This method allows you to retrieve the animation using the animation identifier.
      Parameters:
      identifier - The ID to identify
      Returns:
      empty if no animation with the ID could be found.

      Only works if the animation has also been assigned an identifier.

    • getNameAnimation

      @NotNull public @NotNull Optional<IntelligentItemNameAnimator> getNameAnimation(@NotNull @NotNull Object identifier)
      This method allows you to retrieve the animation using the animation identifier.
      Parameters:
      identifier - The ID to identify
      Returns:
      empty if no animation with the ID could be found.

      Only works if the animation has also been assigned an identifier.

    • getTitleAnimation

      @NotNull public @NotNull Optional<IntelligentTitleAnimator> getTitleAnimation(@NotNull @NotNull Object identifier)
      This method allows you to retrieve the animation using the animation identifier.
      Parameters:
      identifier - The ID to identify
      Returns:
      empty if no animation with the ID could be found.

      Only works if the animation has also been assigned an identifier.

    • getMaterialAnimator

      @NotNull public @NotNull Optional<IntelligentMaterialAnimator> getMaterialAnimator(@NotNull @NotNull Object identifier)
      This method allows you to retrieve the animation using the animation identifier.
      Parameters:
      identifier - The ID to identify
      Returns:
      empty if no animation with the ID could be found.

      Only works if the animation has also been assigned an identifier.

    • updatePeriod

      public void updatePeriod(@Nonnegative int time, @NotNull @NotNull TimeSetting setting)
      Adjusts the period of the scheduler.
      Parameters:
      time - Time
      setting - Set your own time type.
    • updateDelay

      public void updateDelay(@Nonnegative int time, @NotNull @NotNull TimeSetting setting)
      Adjusts the delay of the scheduler.
      Parameters:
      time - Time
      setting - Set your own time type.
    • close

      public void close(@NotNull @NotNull org.bukkit.entity.Player player)
      Closes the inventory from the player. InventoryClickEvent is no longer called here.
      Parameters:
      player - The player which inventory should be closed.
    • getOpenedPlayers

      @NotNull public @NotNull List<UUID> getOpenedPlayers()
      Get all players who have a certain inventory open
      Returns:
      The list with all found players.
    • closeAll

      public void closeAll()
      Closes the inventory for all players.
    • openAll

      public void openAll()
      Opens the inventory for all players.
    • openAll

      public void openAll(@Nonnegative int page)
      Opens the inventory for all players.
      Parameters:
      page - The page to open.
    • openAll

      public void openAll(String @NotNull [] keys, Object @NotNull [] values) throws IllegalArgumentException
      Opens the inventory with the first page for all players with defined properties.
      Parameters:
      keys - The keys
      values - The values
      Throws:
      IllegalArgumentException - if the two arrays do not have the same size.
    • openAll

      public void openAll(@NotNull @NotNull Map<String,Object> data)
      Opens the inventory with the first page for all players.
      Parameters:
      data - The predefined data.
    • openAll

      public void openAll(@Nonnegative int page, @NotNull @NotNull Map<String,Object> data)
      Opens the inventory with the first page for all players.
      Parameters:
      data - The predefined data.
      page - The page to open.
    • openAll

      public void openAll(@Nonnegative int page, String @NotNull [] keys, Object @NotNull [] values) throws IllegalArgumentException
      Opens the inventory for all players with defined properties.
      Parameters:
      page - The page to open.
      keys - The keys
      values - The values
      Throws:
      IllegalArgumentException - if the two arrays do not have the same size.
    • open

      public void open(@NotNull @NotNull org.bukkit.entity.Player player)
      Opens the inventory with the first page.
      Parameters:
      player - The player where the inventory should be opened.
    • open

      public void open(org.bukkit.entity.Player @NotNull ... players)
      Opens the inventory with the first page for multiple players.
      Parameters:
      players - The players for whom the inventory should be opened.
    • open

      public void open(String @NotNull [] keys, Object @NotNull [] values, org.bukkit.entity.Player @NotNull ... players) throws IllegalArgumentException
      Opens the inventory with the first page for multiple players with defined properties.
      Parameters:
      players - The players for whom the inventory should be opened.
      keys - The keys
      values - The values
      Throws:
      IllegalArgumentException - if the two arrays do not have the same size.
    • open

      public void open(@NotNull @NotNull Map<String,Object> data, org.bukkit.entity.Player @NotNull ... players)
      Opens the inventory with the first page for multiple players with defined properties.
      Parameters:
      players - The players for whom the inventory should be opened.
      data - The predefined data
    • open

      public void open(@Nonnegative int page, org.bukkit.entity.Player @NotNull ... players)
      Opens the inventory with a specific page for multiple players.
      Parameters:
      players - The players for whom the inventory should be opened.
      page - The page to open.
    • open

      public void open(@NotNull @NotNull org.bukkit.entity.Player player, @Nonnegative int page)
      Opens an inventory with a specific page.
      Parameters:
      player - The player where the inventory should be opened.
      page - Which page should be opened?
    • open

      public void open(@NotNull @NotNull org.bukkit.entity.Player player, @Nonnegative int page, String @NotNull [] keys, Object @NotNull [] values) throws IllegalArgumentException
      Opens an inventory with a specific page and defined properties.
      Parameters:
      player - The player where the inventory should be opened.
      page - Which page should be opened?
      keys - The keys
      values - The values
      Throws:
      IllegalArgumentException - if the two arrays do not have the same size.
    • open

      public void open(@NotNull @NotNull org.bukkit.entity.Player player, @Nonnegative int page, @NotNull @NotNull Map<String,Object> data)
      Opens an inventory with a specific page and defined properties.
      Parameters:
      player - The player where the inventory should be opened.
      page - Which page should be opened?
      data - The predefined data
    • open

      public void open(@NotNull @NotNull org.bukkit.entity.Player player, String @NotNull [] keys, Object @NotNull [] values) throws IllegalArgumentException
      Opens an inventory with a specific page and defined properties.
      Parameters:
      player - The player where the inventory should be opened.
      keys - The keys
      values - The values
      Throws:
      IllegalArgumentException - if the two arrays do not have the same size.
    • open

      public void open(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull Map<String,Object> data)
      Opens an inventory with a specific page and defined properties.
      Parameters:
      player - The player where the inventory should be opened.
      data - The predefined data
    • allowClose

      public void allowClose()
      Allows the inventory to be closed even after it has been opened.
    • preventClose

      public void preventClose()
      Allows the inventory not to be closed even after it has been opened.
    • restoreOriginal

      public void restoreOriginal(@NotNull @NotNull org.bukkit.entity.Player player) throws IllegalStateException
      Opens the original inventory to the player.
      Parameters:
      player - The player to whom the original inventory should be opened.
      Throws:
      IllegalStateException - if the original inventory is not saved.
    • restoreOriginal

      public void restoreOriginal() throws IllegalStateException
      Öffnet das originale Inventar für alle Spieler die aktuell dieses Inventar offen haben
      Throws:
      IllegalStateException - if the original inventory is not saved.
    • getEvent

      @Nullable public @Nullable EventCreator<? extends org.bukkit.event.Event> getEvent(@NotNull @NotNull Class<? extends org.bukkit.event.Event> event)
      Get an EventCreator object based on the Event class.
      Parameters:
      event - The event what you want to get
      Returns:
      null if there is no custom event matching the event class
    • updateTitle

      public void updateTitle(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String newTitle)
      With this method you can update the inventory title.
      Parameters:
      player - The Player
      newTitle - The new title
    • updateTitle

      public void updateTitle(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull net.kyori.adventure.text.Component newTitle)
      With this method you can update the inventory title.
      Parameters:
      player - The Player
      newTitle - The new title
    • size

      @Nonnegative public int size(@NotNull @NotNull InventoryContents contents)
      Parameters:
      contents - The contents
      Returns:
      the size of the inventory.
    • getTitle

      @NotNull public @NotNull String getTitle()
      Returns:
      inventory title
    • title

      @NotNull public @NotNull net.kyori.adventure.text.Component title()
      Returns:
      inventory title
    • getDelay

      @Nonnegative public int getDelay()
      Returns:
      how much later the scheduler starts (in milliseconds)
    • getPeriod

      @Nonnegative public int getPeriod()
      Returns:
      how often the scheduler ticks (in milliseconds)
    • isCloseAble

      public boolean isCloseAble()
      Returns true if the window is closeable, false otherwise.
      Returns:
      The closeAble variable is being returned.
    • isIgnoreManualItems

      public boolean isIgnoreManualItems()
      Returns whether or not the plugin should ignore manual items
      Returns:
      A boolean value.
    • getIgnoreClickEvent

      @NotNull public @NotNull List<DisabledInventoryClick> getIgnoreClickEvent()
      It returns a list of DisabledInventoryClick objects
      Returns:
      A list of DisabledInventoryClick objects.
    • getIgnoredSlots

      @NotNull public @NotNull HashMap<Integer,Consumer<org.bukkit.event.inventory.InventoryClickEvent>> getIgnoredSlots()
      Returns a list of slots that are ignored by the plugin.
      Returns:
      A list of integers.
    • getEnabledActions

      @NotNull public @NotNull List<Action> getEnabledActions()
      Returns a list of enabled actions.
      Returns:
      A list of enabled actions.
    • getDisabledEvents

      @NotNull public @NotNull List<DisabledEvents> getDisabledEvents()
      This function returns a list of disabled events
      Returns:
      A list of DisabledEvents objects.
    • getIdentifier

      @Nullable public @Nullable Object getIdentifier()
      Returns:
      the ID from the inventory

      You have to give the inventory itself an ID with RyseInventory.Builder.identifier(Object)

    • getInventoryOpenerType

      @NotNull public @NotNull InventoryOpenerType getInventoryOpenerType()
      Returns the type of inventory opener that opened this inventory.
      Returns:
      The inventoryOpenerType
    • isClearAndSafe

      public boolean isClearAndSafe()
      Returns:
      true if the RyseInventory.Builder.clearAndSafe() method was called.
    • getOptions

      @NotNull public @NotNull List<InventoryOptions> getOptions()
      Returns a list of all the options that are available for this inventory.
      Returns:
      A list of InventoryOptions
    • getLoadDelay

      public int getLoadDelay()
      This function returns the loadDelay variable
      Returns:
      The loadDelay variable is being returned.
    • getSlideAnimator

      @Internal @Nullable public @Nullable SlideAnimation getSlideAnimator()
      Returns:
      The slideAnimator object.
    • activeSlideAnimatorTasks

      @Nonnegative protected int activeSlideAnimatorTasks()
      If the slideAnimator is not null, then for each task in the slideAnimator, if the task is queued, then increment the counter.
      Returns:
      The number of active slide animator tasks.
    • getCloseReasons

      @NotNull protected @NotNull List<CloseReason> getCloseReasons()
      This function returns a list of close reasons
      Returns:
      A list of CloseReason objects.
    • getManager

      @Internal @NotNull public @NotNull InventoryManager getManager()
      Returns the InventoryManager instance that this Inventory is associated with.
      Returns:
      The InventoryManager object.
    • setFixedPageSize

      @Internal public void setFixedPageSize(@Nonnegative int fixedPageSize)
      Sets the fixed page size for the query
      Parameters:
      fixedPageSize - How many pages the player can open even though no items are set there.
    • inventoryBasedOnOption

      @Internal @NotNull public @NotNull Optional<org.bukkit.inventory.Inventory> inventoryBasedOnOption(@NotNull @NotNull UUID uuid)
      If the privateInventory map contains the UUID, return the inventory associated with it
      Parameters:
      uuid - The UUID of the player you want to get the inventory of.
      Returns:
      An optional of the inventory.
    • equals

      @Contract(value="null -> false", pure=true) public boolean equals(Object o)
      It checks if the object is equal to the object that is being compared to.
      Overrides:
      equals in class Object
      Parameters:
      o - The object to compare to.
      Returns:
      The hashcode of the object.
    • load

      @Internal public void load(@NotNull @NotNull Pagination pagination, @NotNull @NotNull org.bukkit.entity.Player player, @Nonnegative int page)
      Loads the items of the given page into the inventory of the given player.
      Parameters:
      pagination - The Pagination object that you created.
      player - The player who's viewing the inventory
      page - The page number to load
    • setBackward

      protected void setBackward()
      This function sets the backward variable to true.
    • clearData

      protected void clearData(@NotNull @NotNull org.bukkit.entity.Player player)
      It removes the player's inventory from the plugin's memory
      Parameters:
      player - The player who's inventory is being cleared.
    • addItemAnimator

      @Internal public void addItemAnimator(@NotNull @NotNull IntelligentItemNameAnimator animator)
      Adds an item animator to the list of item animators.
      Parameters:
      animator - The animator to add.
    • addMaterialAnimator

      @Internal public void addMaterialAnimator(@NotNull @NotNull IntelligentMaterialAnimator animator)
      Adds an IntelligentMaterialAnimator to the list of IntelligentMaterialAnimators.
      Parameters:
      animator - The IntelligentMaterialAnimator to add.
    • removeMaterialAnimator

      @Internal public void removeMaterialAnimator(@NotNull @NotNull IntelligentMaterialAnimator animator)
      It removes an IntelligentMaterialAnimator from the list of animators, and if the animator is currently running, it cancels the task
      Parameters:
      animator - The IntelligentMaterialAnimator to remove.
    • removeItemAnimator

      @Internal public void removeItemAnimator(@NotNull @NotNull IntelligentItemNameAnimator animator)
      It removes an item animator from the list of item animators
      Parameters:
      animator - The IntelligentItemNameAnimator to remove.
    • addTitleAnimator

      @Internal public void addTitleAnimator(@NotNull @NotNull IntelligentTitleAnimator animator)
      Adds an IntelligentTitleAnimator to the list of IntelligentTitleAnimators.
      Parameters:
      animator - The animator to add.
    • removeTitleAnimator

      @Internal public void removeTitleAnimator(@NotNull @NotNull IntelligentTitleAnimator animator)
      It removes a title animator from the list of title animators
      Parameters:
      animator - The IntelligentTitleAnimator to remove.
    • addLoreAnimator

      @Internal public void addLoreAnimator(@NotNull @NotNull IntelligentItemLoreAnimator animator)
      Adds an IntelligentItemLoreAnimator to the list of lore animators
      Parameters:
      animator - The animator to add.
    • removeLoreAnimator

      @Internal public void removeLoreAnimator(@NotNull @NotNull IntelligentItemLoreAnimator animator)
      It removes the animator from the list of animators, and cancels all of the tasks that the animator has
      Parameters:
      animator - The animator to remove.
    • removeSlideAnimator

      protected void removeSlideAnimator()
      If the slideAnimator is null, return. If the slideAnimator is not null, get all the tasks in the slideAnimator and for each task, if the task is queued, cancel it
    • loadByPage

      @Internal public void loadByPage(@NotNull @NotNull InventoryContents contents)
      It takes a list of items, and places them in a paginated inventory
      Parameters:
      contents - The InventoryContents object that contains all the information about the inventory.