Class RyseInventory
java.lang.Object
io.github.rysefoxx.inventory.plugin.pagination.RyseInventory
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder to create an inventory. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionprotected intIf the slideAnimator is not null, then for each task in the slideAnimator, if the task is queued, then increment the counter.voidaddItemAnimator(@NotNull IntelligentItemNameAnimator animator) Adds an item animator to the list of item animators.voidaddLoreAnimator(@NotNull IntelligentItemLoreAnimator animator) Adds an IntelligentItemLoreAnimator to the list of lore animatorsvoidaddMaterialAnimator(@NotNull IntelligentMaterialAnimator animator) Adds an IntelligentMaterialAnimator to the list of IntelligentMaterialAnimators.voidaddTitleAnimator(@NotNull IntelligentTitleAnimator animator) Adds an IntelligentTitleAnimator to the list of IntelligentTitleAnimators.voidAllows the inventory to be closed even after it has been opened.static @NotNull RyseInventory.Builderbuilder()Builder to create an inventory.protected voidclearData(@NotNull org.bukkit.entity.Player player) It removes the player's inventory from the plugin's memoryvoidclose(@NotNull org.bukkit.entity.Player player) Closes the inventory from the player.voidcloseAll()Closes the inventory for all players.static @Nullable RyseInventorydeserialize(@NotNull Map<String, Object> data, @NotNull InventoryManager manager) Deserializes the inventory from a hashmap.booleanIt checks if the object is equal to the object that is being compared to.protected @NotNull List<CloseReason>This function returns a list of close reasonsintgetDelay()@NotNull List<DisabledEvents>This function returns a list of disabled eventsReturns a list of enabled actions.@Nullable EventCreator<? extends org.bukkit.event.Event>Get an EventCreator object based on the Event class.@Nullable Object@NotNull List<DisabledInventoryClick>It returns a list of DisabledInventoryClick objectsReturns a list of slots that are ignored by the plugin.@NotNull InventoryOpenerTypeReturns the type of inventory opener that opened this inventory.intThis function returns the loadDelay variable@NotNull Optional<IntelligentItemLoreAnimator>getLoreAnimation(@NotNull Object identifier) This method allows you to retrieve the animation using the animation identifier.@NotNull InventoryManagerReturns the InventoryManager instance that this Inventory is associated with.@NotNull Optional<IntelligentMaterialAnimator>getMaterialAnimator(@NotNull Object identifier) This method allows you to retrieve the animation using the animation identifier.@NotNull Optional<IntelligentItemNameAnimator>getNameAnimation(@NotNull Object identifier) This method allows you to retrieve the animation using the animation identifier.Get all players who have a certain inventory open@NotNull List<InventoryOptions>Returns a list of all the options that are available for this inventory.int@Nullable SlideAnimation@NotNull StringgetTitle()@NotNull Optional<IntelligentTitleAnimator>getTitleAnimation(@NotNull Object identifier) This method allows you to retrieve the animation using the animation identifier.@NotNull Optional<org.bukkit.inventory.Inventory>inventoryBasedOnOption(@NotNull UUID uuid) If the privateInventory map contains the UUID, return the inventory associated with itbooleanbooleanReturns true if the window is closeable, false otherwise.booleanReturns whether or not the plugin should ignore manual itemsvoidload(@NotNull Pagination pagination, @NotNull org.bukkit.entity.Player player, int page) Loads the items of the given page into the inventory of the given player.voidloadByPage(@NotNull InventoryContents contents) It takes a list of items, and places them in a paginated inventory@NotNull RyseInventoryClones the current RyseInventory and returns the new RyseInventory instance.voidopen(int page, org.bukkit.entity.Player @NotNull ... players) Opens the inventory with a specific page for multiple players.voidOpens the inventory with the first page for multiple players with defined properties.voidopen(@NotNull org.bukkit.entity.Player player) Opens the inventory with the first page.voidopen(@NotNull org.bukkit.entity.Player player, int page) Opens an inventory with a specific page.voidOpens an inventory with a specific page and defined properties.voidopen(@NotNull org.bukkit.entity.Player player, int page, String @NotNull [] keys, Object @NotNull [] values) Opens an inventory with a specific page and defined properties.voidOpens an inventory with a specific page and defined properties.voidOpens an inventory with a specific page and defined properties.voidopen(String @NotNull [] keys, Object @NotNull [] values, org.bukkit.entity.Player @NotNull ... players) Opens the inventory with the first page for multiple players with defined properties.voidopen(org.bukkit.entity.Player @NotNull ... players) Opens the inventory with the first page for multiple players.voidopenAll()Opens the inventory for all players.voidopenAll(int page) Opens the inventory for all players.voidOpens the inventory with the first page for all players.voidOpens the inventory for all players with defined properties.voidOpens the inventory with the first page for all players.voidOpens the inventory with the first page for all players with defined properties.voidAllows the inventory not to be closed even after it has been opened.voidremoveItemAnimator(@NotNull IntelligentItemNameAnimator animator) It removes an item animator from the list of item animatorsvoidremoveLoreAnimator(@NotNull IntelligentItemLoreAnimator animator) It removes the animator from the list of animators, and cancels all of the tasks that the animator hasvoidremoveMaterialAnimator(@NotNull IntelligentMaterialAnimator animator) It removes an IntelligentMaterialAnimator from the list of animators, and if the animator is currently running, it cancels the taskprotected voidIf the slideAnimator is null, return.voidremoveTitleAnimator(@NotNull IntelligentTitleAnimator animator) It removes a title animator from the list of title animatorsvoidÖffnet das originale Inventar für alle Spieler die aktuell dieses Inventar offen habenvoidrestoreOriginal(@NotNull org.bukkit.entity.Player player) Opens the original inventory to the player.Serializes the inventory to a map.protected voidThis function sets the backward variable to true.voidsetFixedPageSize(int fixedPageSize) Sets the fixed page size for the queryintsize(@NotNull InventoryContents contents) @NotNull net.kyori.adventure.text.Componenttitle()voidupdateDelay(int time, @NotNull TimeSetting setting) Adjusts the delay of the scheduler.voidupdatePeriod(int time, @NotNull TimeSetting setting) Adjusts the period of the scheduler.voidupdateTitle(@NotNull org.bukkit.entity.Player player, @NotNull String newTitle) With this method you can update the inventory title.voidupdateTitle(@NotNull org.bukkit.entity.Player player, @NotNull net.kyori.adventure.text.Component newTitle) With this method you can update the inventory title.
-
Field Details
-
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
Serializes the inventory to a map.- Returns:
- The serialized inventory.
- See Also:
-
builder
Builder to create an inventory.- Returns:
- The Builder object with several methods
-
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
Adjusts the period of the scheduler.- Parameters:
time- Timesetting- Set your own time type.
-
updateDelay
Adjusts the delay of the scheduler.- Parameters:
time- Timesetting- 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
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 keysvalues- The values- Throws:
IllegalArgumentException- if the two arrays do not have the same size.
-
openAll
Opens the inventory with the first page for all players.- Parameters:
data- The predefined data.
-
openAll
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 keysvalues- 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 keysvalues- 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 keysvalues- 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 keysvalues- 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
Ö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 PlayernewTitle- 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 PlayernewTitle- The new title
-
size
- Parameters:
contents- The contents- Returns:
- the size of the inventory.
-
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
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
Returns a list of enabled actions.- Returns:
- A list of enabled actions.
-
getDisabledEvents
This function returns a list of disabled events- Returns:
- A list of DisabledEvents objects.
-
getIdentifier
- Returns:
- the ID from the inventory
You have to give the inventory itself an ID with
RyseInventory.Builder.identifier(Object)
-
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
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
- 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
This function returns a list of close reasons- Returns:
- A list of CloseReason objects.
-
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
It checks if the object is equal to the object that is being compared to. -
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 inventorypage- 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
Adds an item animator to the list of item animators.- Parameters:
animator- The animator to add.
-
addMaterialAnimator
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
It removes an item animator from the list of item animators- Parameters:
animator- The IntelligentItemNameAnimator to remove.
-
addTitleAnimator
Adds an IntelligentTitleAnimator to the list of IntelligentTitleAnimators.- Parameters:
animator- The animator to add.
-
removeTitleAnimator
It removes a title animator from the list of title animators- Parameters:
animator- The IntelligentTitleAnimator to remove.
-
addLoreAnimator
Adds an IntelligentItemLoreAnimator to the list of lore animators- Parameters:
animator- The animator to add.
-
removeLoreAnimator
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
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.
-