### Configure Gradle Repositories and Dependencies
Source: https://wiki.ryseinventory.de/how-to-use/installation-guide/dependency
Repository and dependency setup for Groovy and Kotlin Gradle build files.
```groovy
repositories {
mavenCentral()
maven { url "https://s01.oss.sonatype.org/content/groups/public/" }
}
dependencies {
implementation 'io.github.rysefoxx.inventory:RyseInventory-Plugin:1.5.7'
}
```
```kotlin
repositories {
mavenCentral()
maven { url = uri("https://s01.oss.sonatype.org/content/groups/public/") }
}
dependencies {
implementation("io.github.rysefoxx.inventory:RyseInventory-Plugin:1.5.7")
}
```
--------------------------------
### RyseInventory Type Preview
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Demonstrates how to create an inventory with a specific opener type, such as a dropper. Requires RyseInventory builder setup.
```java
RyseInventory.builder()
.title("type preview")
.rows(3)
.type(InventoryOpenerType.DROPPER)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### Close Inventory Example
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
This snippet demonstrates how to build and open an inventory that automatically closes after a specified delay.
```java
RyseInventory.builder()
.title("close preview")
.rows(3)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
Bukkit.getScheduler().runTaskLater(RyseInventoryPlugin.this, () ->
contents.pagination().inventory().close(player), 20 * 3);
}
})
.build(this)
.openAll();
```
--------------------------------
### Slide Animation Example
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Demonstrates creating and applying a horizontal slide animation to inventory items. The init method must contain the SlideAnimation.
```java
RyseInventory.builder()
.title("animation preview")
.rows(3)
.animation(SlideAnimation.builder(this)
.direction(AnimatorDirection.HORIZONTAL_LEFT_RIGHT)
.from(Arrays.asList(9, 9))
.to(Arrays.asList(14, 12))
.item(IntelligentItem.empty(new ItemStack(Material.DIAMOND)),
IntelligentItem.empty(new ItemStack(Material.EMERALD)))
.period(5, TimeSetting.MILLISECONDS)
.delay(0, TimeSetting.SECONDS)
.build())
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents, SlideAnimation animation) {
animation.animate(contents);
}
})
.build(this)
.openAll();
```
--------------------------------
### Get Pagination Object
Source: https://wiki.ryseinventory.de/classes/class-methods/pagination
Call `InventoryContents#pagination()` to retrieve the pagination object. This is the starting point for all pagination configurations.
```java
Pagination pagination = contents.pagination();
```
--------------------------------
### Delayed Inventory Opening Example
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Use .openDelay() to set a delay before the inventory is opened. The init method of InventoryProvider is called when the inventory opens.
```java
RyseInventory.builder()
.title("OpenDelay Preview")
.rows(3)
.openDelay(3, TimeSettings.SECONDS)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### Anvil GUI Full Example
Source: https://wiki.ryseinventory.de/classes/anvilgui/full-example
This snippet shows how to create an Anvil GUI with a custom title, set an initial item in the left slot, and handle the completion event to broadcast the input text and replace it with 'a'.
```java
RyseInventory.builder()
.title("Anvil test")
.type(InventoryOpenerType.ANVIL)
.provider(new InventoryProvider() {
@Override
public void anvil(Player player, RyseAnvil anvil) {
anvil.itemLeft(IntelligentItem.empty(new ItemStack(Material.PAPER)));
anvil.onComplete(completion -> {
Bukkit.broadcastMessage(completion.getText());
return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("a"));
});
}
})
.build(this)
.openAll();
```
--------------------------------
### Delay Inventory Update Example
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Use .delay() to specify a delay before the update method is called. Ensure the InventoryProvider is correctly implemented.
```java
RyseInventory.builder()
.title("Delay Preview")
.rows(3)
.delay(3, TimeSetting.SECONDS)
.provider(new InventoryProvider() {
@Override
public void update(Player player, InventoryContents contents) {
Material material = Material.values()[new Random().nextInt(Material.values().length)];
contents.update(0, new ItemStack(material));
}
@Override
public void init(Player player, InventoryContents contents) {
contents.set(0, new ItemStack(Material.DIAMOND_SWORD));
}
})
.build(this)
.openAll();
```
--------------------------------
### Item Retrieval Methods
Source: https://wiki.ryseinventory.de/classes/class-methods/inventorycontents
Methods for getting item data, positions, or coordinates within the inventory.
```APIDOC
## Item Retrieval Methods
### Description
Methods to retrieve item data, positions, or specific items from slots.
### Methods
- **getPositionOfItem**: Returns the position of a passed item.
- **getCoordinationOfItem**: Returns the coordinates (Row, Column) of a passed item.
- **getDataFromCurrentPage**: Returns a read-only list of item data on the current page.
- **getDataFromPage**: Returns a read-only list of item data on a defined page.
- **getAllData**: Returns a read-only list of all item data.
- **getWithinPage**: Returns the item in a specific slot on a page.
- **getOrAdd**: Gets an item in a slot, or adds it if not available.
- **getOrSet**: Gets an item in a slot, or sets it if not available.
- **get**: Returns the item in a specific slot.
```
--------------------------------
### Periodic Inventory Update Example
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Use .period() to schedule the update method of InventoryProvider to be called at regular intervals. Ensure TimeSettings is imported.
```java
RyseInventory.builder()
.title("Period Preview")
.rows(3)
.period(3, TimeSetting.SECONDS)
.provider(new InventoryProvider() {
@Override
public void update(Player player, InventoryContents contents) {
Material material = Material.values()[new Random().nextInt(Material.values().length)];
contents.update(0, new ItemStack(material));
}
@Override
public void init(Player player, InventoryContents contents) {
contents.set(0, new ItemStack(Material.DIAMOND_SWORD));
}
})
.build(this)
.openAll();
```
--------------------------------
### Create Basic SlotIterator
Source: https://wiki.ryseinventory.de/classes/class-methods/slotiterator
Use this to create a SlotIterator with specified start and end positions, blacklisted slots, and orientation. The `override()` method ensures items are placed even if a slot is occupied.
```java
pagination.iterator(SlotIterator.builder()
.startPosition(0)
.blackList(2)
.override()
.endPosition(5)
.type(SlotIterator.SlotIteratorType.HORIZONTAL)
.build());
```
--------------------------------
### RyseInventory Close
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Closes the inventory after a specified delay from when it was opened. This example implies a closing action after 3 seconds.
```java
RyseInventory.builder()
.title("close preview")
.closeDelay(3, TimeSetting.SECONDS)
.rows(3)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### Close Inventory After Delay Example
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Use .closeAfter() to automatically close the inventory after a specified duration. Ensure TimeSettings is imported.
```java
RyseInventory.builder()
.title("closeAfter Preview")
.rows(3)
.closeAfter(3, TimeSetting.SECONDS)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### Ignore Specific Events Example
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Use .ignoreEvents() with DisabledEvents to prevent RyseInventory from blocking specific events, such as InventoryDragEvent.
```java
RyseInventory.builder()
.title("ignoreEvents preview")
.rows(3)
.ignoreEvents(DisabledEvents.INVENTORY_DRAG)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### RyseInventory Load Delay
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Introduces a delay before the InventoryProvider's init method is executed, allowing content to load after a specified time. The example shows a diamond item appearing after a delay.
```java
RyseInventory.builder()
.title("loadDelay preview")
.loadDelay(3, TimeSetting.SECONDS)
.rows(3)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
contents.set(0, new ItemStack(Material.DIAMOND));
}
})
.build(this)
.openAll();
```
--------------------------------
### Disable Update Task Example
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Disables the inventory update task scheduler when the update method in InventoryProvider is not needed. A scheduler is created by default.
```java
RyseInventory.builder()
.title("enableAction preview")
.rows(3)
.disableUpdateTask()
.provider(new InventoryProvider() {
@Override
public void update(Player player, InventoryContents contents) {
player.sendMessage("The player will NEVER get this message, because I disabled the task.");
}
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### Configure Slot Iterator
Source: https://wiki.ryseinventory.de/classes/class-methods/pagination
Define a `SlotIterator` using `pagination.iterator()` to control item placement, including start position, iteration type (horizontal/vertical), overriding existing items, and blacklisting slots.
```java
pagination.iterator(SlotIterator.builder()
.startPosition(10)
.type(SlotIterator.SlotIteratorType.HORIZONTAL)
.blackList(10)
.override()
.build());
```
--------------------------------
### Implement Basic Pagination with Navigation
Source: https://wiki.ryseinventory.de/classes/class-methods/pagination/full-examples
Configures a pagination system with 7 items per page, including custom navigation items for moving between pages.
```java
RyseInventory.builder()
.title("Example 1")
.rows(1)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
Pagination pagination = contents.pagination();
pagination.setItemsPerPage(7);
pagination.iterator(SlotIterator.builder()
.startPosition(1)
.type(SlotIterator.SlotIteratorType.HORIZONTAL)
.build());
contents.set(0, 0, IntelligentItem.of(new ItemBuilder(Material.ARROW).
amount(pagination.isFirst()
? 1
: pagination.page() - 1)
.displayName(pagination.isFirst()
? "§c§oThis is the first page"
: "§ePage §8⇒ §9" + pagination.newInstance(pagination).previous().page()).build(), event -> {
if (pagination.isFirst()) {
player.sendMessage("§c§oYou are already on the first page.");
return;
}
RyseInventory currentInventory = pagination.inventory();
currentInventory.open(player, pagination.previous().page());
}));
for (int i = 0; i < 13; i++) {
pagination.addItem(IntelligentItem.empty(new ItemStack(Material.MAGMA_CREAM)));
}
int page = pagination.newInstance(pagination).next().page();
contents.set(0, 8, IntelligentItem.of(new ItemBuilder(Material.ARROW)
.amount((pagination.isLast() ? 1 : page))
.displayName(!pagination.isLast()
? "§ePage §8⇒ §9" + page :
"§c§oThis is the last page").build(), event -> {
if (pagination.isLast()) {
player.sendMessage("§c§oYou are already on the last page.");
return;
}
RyseInventory currentInventory = pagination.inventory();
currentInventory.open(player, pagination.next().page());
}));
}
})
.build(this)
.openAll();
```
--------------------------------
### Initialize a Basic RyseInventory
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/example
Uses the builder pattern to configure inventory properties and define the provider. The init method is triggered every time the inventory is opened.
```java
RyseInventory.builder()
.title("Basic Inventory")
.rows(3)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
```
--------------------------------
### Configure Maven Repository and Dependency
Source: https://wiki.ryseinventory.de/how-to-use/installation-guide/dependency
Standard configuration for Maven projects to fetch the library from the Sonatype repository.
```xml
sonatype
"https://s01.oss.sonatype.org/content/groups/public/"
io.github.rysefoxx.inventory
RyseInventory-Plugin
1.5.7
```
--------------------------------
### Mandatory Builder Methods
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/builder
These are the essential methods required to initialize and configure a basic inventory.
```APIDOC
## Mandatory Builder Methods
### Description
These methods are mandatory for the creation and basic functionality of an inventory.
### Methods
- **rows or size** (int) - Determines the size (number of rows) of the inventory.
- **title** (string) - Sets the title of the inventory that will be displayed to the player.
- **provider** (interface) - An interface that must be implemented. Its `init` method is called when the inventory is opened.
```
--------------------------------
### Gradle Kotlin Project Configuration
Source: https://wiki.ryseinventory.de/how-to-use/installation-guide/full-example
This build.gradle.kts file configures a Gradle project using Kotlin. It includes the shadow plugin for shading and specifies the RyseInventory dependency. Ensure your repository URLs and plugin versions are up-to-date.
```kotlin
plugins {
id("java")
id("com.github.johnrengelman.shadow") version "7.1.2"
}
group = "io.github.rysefoxx.example"
version = "1.0-SNAPSHOT"
description = "This build.gradle.kts shows a possible structure for RyseInventory. Yours will differ for sure!"
repositories {
mavenCentral()
maven { url = uri("https://s01.oss.sonatype.org/content/groups/public/") }
}
dependencies {
implementation("io.github.rysefoxx.inventory:RyseInventory-Plugin:1.5.7")
}
tasks {
shadowJar {
mergeServiceFiles()
}
}
```
--------------------------------
### Configure Provided Dependency
Source: https://wiki.ryseinventory.de/how-to-use/installation-guide/dependency
Use these snippets to include the library without shading it into your final JAR file.
```xml
io.github.rysefoxx.inventory
RyseInventory-Plugin
1.5.7
provided
```
```groovy
dependencies {
compileOnly("io.github.rysefoxx.inventory:RyseInventory-Plugin:1.5.7")
}
```
--------------------------------
### Optional Builder Methods
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/builder
A comprehensive list of optional methods to customize inventory behavior and appearance.
```APIDOC
## Optional Builder Methods
### Description
These methods provide advanced customization options for the inventory's behavior, timing, and event handling.
### Methods
- **delay** (long, TimeUnit) - Sets a delay before the scheduler starts.
- **openDelay** (long, TimeUnit) - Sets a delay before the inventory is opened.
- **period** (long, TimeUnit) - Defines the interval for the scheduler to execute.
- **closeAfter** (long, TimeUnit) - Specifies the duration after which the inventory will automatically close.
- **ignoreClickEvent** (boolean) - Disables the `InventoryClickEvent` for specific inventory interactions.
- **ignoreEvents** (boolean) - Enables specific events that are disabled by default.
- **ignoredSlots** (int[]) - Defines slots where `InventoryClickEvent` will not take effect, allowing item manipulation.
- **clearAndSafe** (boolean) - Caches and empties the player's inventory upon opening, restoring it upon closing.
- **identifier** (string) - Assigns a unique identifier to the inventory, useful for managing multiple inventories.
- **listener** (InventoryListener) - Allows adding custom event listeners that affect the entire inventory.
- **options** (InventoryOptions) - Configures additional options, such as preventing player damage while the inventory is open.
- **preventClose** (boolean) - Prevents the player from closing the inventory manually; only the `#close` method can close it.
- **preventTransferData** (boolean) - Prevents internal inventory data from being transferred to other inventories.
- **type** (InventoryType) - Sets the type of the inventory (defaults to chest).
- **fixedPageSize** (int) - Sets a static number of pages for the inventory.
- **titleHolder** (string) - A placeholder title used when the `#loadTitle` method is employed.
- **loadDelay** (long, TimeUnit) - Delays the loading of inventory contents.
- **loadTitle** (boolean) - Delays the loading of the inventory title, using the `#titleHolder` in the interim.
- **close** (Consumer) - Defines conditions for automatic inventory closure.
- **animation** (SlideAnimation) - Applies a slide animation for item appearance (e.g., left-to-right).
- **enableAction** (InventoryAction) - Enables advanced control over inventory actions, such as `DOUBLE_CLICK`.
- **disableUpdateTask** (boolean) - Disables the scheduler task if the `update` method from `InventoryProvider` is not implemented.
- **permanentCache** (boolean) - Ensures the inventory is permanently cached and retrievable via the `InventoryManager`.
```
--------------------------------
### Add Library to plugin.yml
Source: https://wiki.ryseinventory.de/how-to-use/installation-guide/dependency
Required configuration for the plugin.yml file when using the library.
```yaml
libraries:
- io.github.rysefoxx.inventory:RyseInventory-Plugin:1.5.7
```
--------------------------------
### Create SlotIterator with Pattern
Source: https://wiki.ryseinventory.de/classes/class-methods/slotiterator
This snippet demonstrates creating a SlotIterator using a pattern for item placement. The pattern defines which slots are valid, and the `attach` character specifies where items should be placed within those valid slots. This is useful for creating specific inventory designs.
```java
RyseInventory.builder()
.title("Example")
.rows(6)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
Pagination pagination = contents.pagination();
pagination.setItemsPerPage(30);
pagination.iterator(SlotIterator.builder().withPattern(SlotIteratorPattern.builder()
.define("OOXXXXXXX", 6)
.attach('O')
.buildPattern())
.build());
for (int i = 0; i < 12; i++) {
pagination.addItem(IntelligentItem.empty(new ItemStack(Material.MAGMA_CREAM)));
}
}
})
.build(this)
.openAll();
```
--------------------------------
### Gradle Groovy Project Configuration
Source: https://wiki.ryseinventory.de/how-to-use/installation-guide/full-example
This build.gradle file configures a Gradle project using Groovy. It includes the shadow plugin for shading and specifies the RyseInventory dependency. Verify that your repository URLs and plugin versions are current.
```groovy
plugins {
id 'java'
id "com.github.johnrengelman.shadow" version "7.1.2"
}
group 'io.github.rysefoxx.example'
version '1.0-SNAPSHOT'
description 'This build.gradle shows a possible structure for RyseInventory. Yours will differ for sure!'
repositories {
mavenCentral()
maven { url "https://s01.oss.sonatype.org/content/groups/public/" }
}
dependencies {
implementation 'io.github.rysefoxx.inventory:RyseInventory-Plugin:1.5.7'
}
shadowJar {
mergeServiceFiles()
}
```
--------------------------------
### Implement Pagination with SlotIterator Blacklist
Source: https://wiki.ryseinventory.de/classes/class-methods/pagination/full-examples
Demonstrates how to exclude specific slots from the pagination flow using a blacklist in the SlotIterator.
```java
RyseInventory.builder()
.title("Example 2")
.rows(2)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
Pagination pagination = contents.pagination();
pagination.setItemsPerPage(16);
pagination.iterator(SlotIterator.builder()
.startPosition(0)
.blackList(2)
.type(SlotIterator.SlotIteratorType.HORIZONTAL)
.build());
for (int i = 0; i < 13; i++) {
pagination.addItem(IntelligentItem.empty(new ItemStack(Material.MAGMA_CREAM)));
}
}
})
.build(this)
.openAll();
```
--------------------------------
### RyseInventory Methods
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory
A comprehensive list of methods available for the RyseInventory object to manage inventory state, animations, and player interactions.
```APIDOC
## RyseInventory Methods
### Description
Methods for managing RyseInventory instances, including serialization, animation retrieval, and player inventory control.
### Methods
- **deserialize(Map)**: Used to get a RyseInventory from a Map.
- **serialize()**: Serializes the RyseInventory to a Map.
- **newInstance()**: Creates a new RyseInventory object where all data will be transferred.
- **getLoreAnimation(String id)**: Determines a Lore animation based on the ID.
- **getNameAnimation(String id)**: Determines a Name animation based on the ID.
- **getTitleAnimation(String id)**: Determines a Title animation based on the ID.
- **getMaterialAnimator(String id)**: Determines a Material animation based on the ID.
- **updatePeriod(long period)**: Adjusts the interval of the scheduler.
- **updateDelay(long delay)**: Adjusts the delay of the scheduler.
- **close(Player player)**: Closes the inventory for the player.
- **getOpenedPlayers()**: Returns a List of UUIDs of players who have the inventory open.
- **closeAll()**: Closes the inventory for everyone who has the inventory open.
- **openAll()**: Opens the inventory for all players on the server.
- **open(Player player)**: Opens the inventory for a selected player.
- **getEvent()**: Returns the event defined via .listener.
- **updateTitle(String title)**: Updates the title of the inventory.
- **size()**: Calculates the current size of the inventory.
```
--------------------------------
### Set Items Using a List
Source: https://wiki.ryseinventory.de/classes/class-methods/pagination
Populate the pagination with items by providing a `List` to the `Pagination#setItems()` method. Ensure items are of the `IntelligentItem` type.
```java
Pagination pagination = contents.pagination();
pagination.setItemsPerPage(21);
pagination.setItems(Arrays.asList(
IntelligentItem.empty(new ItemStack(Material.MAGMA_CREAM)),
IntelligentItem.empty(new ItemStack(Material.TNT)),
IntelligentItem.empty(new ItemStack(Material.DIAMOND_PICKAXE)),
IntelligentItem.empty(new ItemStack(Material.CHAINMAIL_BOOTS)),
IntelligentItem.empty(new ItemStack(Material.FIREWORK_CHARGE)),
IntelligentItem.empty(new ItemStack(Material.FLINT)),
IntelligentItem.empty(new ItemStack(Material.FLINT_AND_STEEL))));
```
--------------------------------
### Set Items Using an Array
Source: https://wiki.ryseinventory.de/classes/class-methods/pagination
Alternatively, you can set items for the pagination by providing an array of `IntelligentItem` to the `Pagination#setItems()` method.
```java
Pagination pagination = contents.pagination();
pagination.setItemsPerPage(21);
IntelligentItem[] items = new IntelligentItem[6];
items[0] = IntelligentItem.empty(new ItemStack(Material.MAGMA_CREAM));
items[1] = IntelligentItem.empty(new ItemStack(Material.TNT));
items[2] = IntelligentItem.empty(new ItemStack(Material.DIAMOND_PICKAXE));
items[3] = IntelligentItem.empty(new ItemStack(Material.CHAINMAIL_BOOTS));
items[4] = IntelligentItem.empty(new ItemStack(Material.FIREWORK_CHARGE));
items[5] = IntelligentItem.empty(new ItemStack(Material.FLINT));
pagination.setItems(items);
```
--------------------------------
### IntelligentItem Methods
Source: https://wiki.ryseinventory.de/classes/class-methods/intelligentitem
Overview of the methods available for the IntelligentItem class, detailing their functionality for item event management.
```APIDOC
## IntelligentItem Methods
### Description
This section details the various methods available for the `IntelligentItem` class, which is used to assign events directly to items, simplifying inventory management and interaction handling.
### Methods
- **`of(ItemStack, Consumer, IntelligentItemError)`**: Creates a new `IntelligentItem` with an `ItemStack`. It allows direct handling of `InventoryClickEvent` through a consumer. An optional `IntelligentItemError` can be provided for cases where the player lacks click or view rights.
- **`empty(ItemStack, IntelligentItemError)`**: Creates an `ItemStack` that does not trigger any `InventoryClickEvent`. Clicking on this item will have no effect. An optional `IntelligentItemError` can be provided for permission-related issues.
- **`ignored(ItemStack, IntelligentItemError)`**: Creates an item stack that is intended to be ignored or replaced by the player. Players can still take this item from the inventory. An optional `IntelligentItemError` can be provided for permission-related issues.
- **`clearConsumer()`**: Removes the consumer from the `ItemStack`. After this operation, the item's behavior will be similar to the `empty` method.
- **`identifier()`**: Assigns a unique ID to the item.
- **`canClick(BooleanSupplier)`**: Determines if the item can be clicked based on a provided `BooleanSupplier`. This allows for dynamic click permissions.
- **`canSee(BooleanSupplier)`**: Determines if the item can be seen based on a provided `BooleanSupplier`. This allows for dynamic visibility.
- **`update(ItemStack)`**: Updates the item with a new `ItemStack`. The existing consumer will be retained.
- **`serialize()`**: Serializes the `ItemStack` and returns its properties as a `Map`.
```
--------------------------------
### InventoryManager Methods
Source: https://wiki.ryseinventory.de/classes/class-methods/inventorymanager
Overview of the methods available in the InventoryManager API.
```APIDOC
## InventoryManager API Methods
### Description
This section details the various methods provided by the InventoryManager API for managing and retrieving inventory data.
### Methods
- **register**
- **Description**: Offers the possibility to cache items in a list. It is important that the item has an ID.
- **Endpoint**: Not specified
- **Method**: Not specified
- **getItemById**
- **Description**: You can get the item by this method. You only need the ID.
- **Endpoint**: Not specified
- **Method**: Not specified
- **getAllItemsById**
- **Description**: If multiple items have the same ID, they will be returned as a list.
- **Endpoint**: Not specified
- **Method**: Not specified
- **getInventory**
- **Description**: You can get an inventory by ID or by player UUID.
- **Endpoint**: Not specified
- **Method**: Not specified
- **getOpenedPlayers**
- **Description**: Gives you all the UUID's of the players who currently have the inventory open.
- **Endpoint**: Not specified
- **Method**: Not specified
- **getLastInventory**
- **Description**: Returns the last inventory the player had open.
- **Endpoint**: Not specified
- **Method**: Not specified
- **getContents**
- **Description**: You get the InventoryContents by the UUID.
- **Endpoint**: Not specified
- **Method**: Not specified
- **invoke**
- **Description**: Needed only in the onEnable to make important functions of the RyseInventory API go.
- **Endpoint**: Not specified
- **Method**: Not specified
```
--------------------------------
### listener
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Assigns a direct event listener to the inventory.
```APIDOC
## listener
### Description
With this method you can assign a direct event to the inventory. Like for example an InventoryClickEvent. If slot 1 is clicked, a diamond is placed at slot 5.
### Request Example
RyseInventory.builder()
.title("listener preview")
.rows(3)
.listener(new EventCreator<>(InventoryClickEvent.class, event -> {
if(event.getClickedInventory() == null) return;
if(event.getSlot() == 1)
event.getClickedInventory().setItem(5, new ItemStack(Material.DIAMOND));
}))
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### Maven Project Configuration
Source: https://wiki.ryseinventory.de/how-to-use/installation-guide/full-example
This XML configuration is for a Maven project. It includes dependencies for RyseInventory and configures the maven-shade-plugin. Ensure your Java version and repository URLs are correct.
```xml
4.0.0
io.github.rysefoxx.example
RyseInventoryExample
1.0-SNAPSHOT
RyseInventoryExample
This pom.xml shows a possible structure for RyseInventory. Yours will differ for sure!
16
16
16
UTF-8
org.apache.maven.plugins
maven-shade-plugin
3.2.4
package
shade
false
sonatype
"https://s01.oss.sonatype.org/content/groups/public/"
io.github.rysefoxx.inventory
RyseInventory-Plugin
1.5.7
```
--------------------------------
### Inventory Filling Methods
Source: https://wiki.ryseinventory.de/classes/class-methods/inventorycontents
Methods for populating inventory slots, pages, or specific areas with items.
```APIDOC
## Inventory Filling Methods
### Description
Methods to fill inventory slots, pages, or defined areas with items.
### Methods
- **fillColumn**: Fills a column based on the slot and optional page.
- **fillEmptyPage**: Fills all empty slots on a specified page.
- **fillPage**: Fills the entire page with an item, overwriting existing items.
- **fillArea**: Fills an item in a user-defined area.
- **fillEmpty**: Fills all empty slots on the current page.
- **fill**: Fills the current page completely with the provided item.
```
--------------------------------
### RyseInventory Fixed Page Size
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Configures an inventory to always have a fixed number of pages, regardless of the item count. Includes navigation arrows and a placeholder item.
```java
RyseInventory.builder()
.title("fixedPageSize preview")
.rows(3)
.fixedPageSize(5)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
Pagination pagination = contents.pagination();
contents.set(0, IntelligentItem.of(new ItemStack(Material.ARROW), event -> {
if (pagination.isFirst()) {
player.sendMessage("You are on the first page");
return;
}
RyseInventory currentInventory = pagination.inventory();
currentInventory.open(player, pagination.previous().page());
}));
contents.set(4, new ItemBuilder(getRandomMaterial()).displayName("TEST - " + getRandomNumber(1, Integer.MAX_VALUE - 1)).build());
contents.set(8, IntelligentItem.of(new ItemStack(Material.ARROW), event -> {
if (pagination.isLast()) {
player.sendMessage("You are on the last page");
return;
}
RyseInventory currentInventory = pagination.inventory();
currentInventory.open(player, pagination.next().page());
}));
}
})
.build(this)
.openAll();
```
--------------------------------
### InventoryContents Management Methods
Source: https://wiki.ryseinventory.de/classes/class-methods/inventorycontents
A collection of methods for managing items, slots, and properties within an inventory.
```APIDOC
## InventoryContents Methods
### Description
Methods to interact with inventory contents, including item manipulation, slot management, and property handling.
### Methods
- **firstEqual**: Searches for the first item matching the parameter. Returns slot + IntelligentItem.
- **replaceAll**: Overwrites all old items with new items. Optional page parameter.
- **replace**: Overwrites an old item with a new item. Optional page parameter.
- **addAdvancedSlot**: Defines a slot with custom logic via consumer.
- **removeAdvancedSlot**: Removes an advanced slot.
- **updateFixedPageSize**: Modifies the number of pages while inventory is open.
- **update**: Updates the item within a specific slot or multiple slots.
- **updateOrSet**: Updates an item in a slot, or sets it if empty.
- **isIgnoredSlot**: Checks if a slot is ignored.
- **removeIgnoredSlot**: Removes an ignored slot.
- **addIgnoredSlot**: Adds a slot to the ignored list.
- **hasSlot**: Checks if the inventory contains a specific slot.
- **removeItemWithConsumer**: Removes an item and its associated consumer.
- **removeFirst**: Removes the first item matching the input or the first item found.
- **subtractFirst**: Subtracts a specific amount from the first matching item.
- **removeAll**: Removes all items matching the input, optionally specifying a count.
- **slots**: Returns all inventory slots.
- **updateTitle**: Updates the inventory title.
- **fillAligned**: Fills inventory based on orientation (left, right, top, bottom).
- **fillBorders**: Fills the borders of the inventory.
- **hasPropertyKey**: Checks for a specific property key.
- **hasPropertyValue**: Checks for a specific property value.
- **setProperty**: Sets a key:value property.
- **getProperty**: Gets a value by key, with optional default.
- **clearProperties**: Clears all inventory properties.
- **removeProperty**: Removes a specific property.
- **findRightBorder**: Finds the right border relative to a slot.
- **findLeftBorder**: Finds the left border relative to a slot.
- **isMiddle/isCorner/isTop/isBottom/isRightBorder/isLeftBorder**: Boolean checks for slot positioning.
- **firstEmpty/lastEmpty**: Returns the first or last empty slot.
- **randomSlot**: Returns a random slot, optionally within a range.
- **add**: Adds an item to the first empty slot.
- **reload**: Reloads the inventory.
- **setWithinPage**: Sets an item visible only on a specific page.
- **fillRow**: Fills a row based on a slot and side.
```
--------------------------------
### clearAndSafe
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Empties and caches player inventory content, restoring it upon closing the custom inventory.
```APIDOC
## clearAndSafe
### Description
If you call this method, the content of the player inventory is emptied and cached. When the inventory is closed, its contents are restored.
### Request Example
RyseInventory.builder()
.title("clearAndSafe preview")
.rows(3)
.clearAndSafe()
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### Add Single Item
Source: https://wiki.ryseinventory.de/classes/class-methods/pagination
Use `Pagination#addItem()` within a loop or individually to add single `IntelligentItem` instances to the pagination.
```java
Pagination pagination = contents.pagination();
pagination.setItemsPerPage(21);
for (int i = 0; i < 5; i++) {
pagination.addItem(IntelligentItem.empty(new ItemStack(Material.MAGMA_CREAM)));
}
```
--------------------------------
### Enable Move to Other Inventory Action
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Allows items to be moved to other inventories, with specific slots ignored to restrict movement. The default behavior disables this action.
```java
RyseInventory.builder()
.title("enableAction preview")
.rows(3)
.ignoredSlots(0)
.enableAction(Action.MOVE_TO_OTHER_INVENTORY)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### Set Items Per Page
Source: https://wiki.ryseinventory.de/classes/class-methods/pagination
Use `Pagination#setItemsPerPage(value)` to define the number of items displayed on each page. The default value is 1 if not specified.
```java
Pagination pagination = contents.pagination();
pagination.setItemsPerPage(21);
//In this example we allow 21 elements per page.
```
--------------------------------
### Assign Inventory Listener
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Attaches a direct event listener, such as InventoryClickEvent, to the inventory instance.
```java
RyseInventory.builder()
.title("listener preview")
.rows(3)
.listener(new EventCreator<>(InventoryClickEvent.class, event -> {
if(event.getClickedInventory() == null) return;
if(event.getSlot() == 1)
event.getClickedInventory().setItem(5, new ItemStack(Material.DIAMOND));
}))
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### Clear and Restore Inventory
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Empties and caches player inventory contents, restoring them upon closing the custom inventory.
```java
RyseInventory.builder()
.title("clearAndSafe preview")
.rows(3)
.clearAndSafe()
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### Item Update Methods
Source: https://wiki.ryseinventory.de/classes/class-methods/inventorycontents
Methods for modifying item properties such as lore, material, and display names.
```APIDOC
## Item Update Methods
### Description
Methods to update item attributes, including support for global updates across shared inventories.
### Methods
- **updateLore**: Updates a specific line of an item's lore.
- **updateLoreAll**: Updates lore for all players with the same inventory open.
- **updateMaterial**: Updates the material of an item.
- **updateForAll**: Updates an item for all players with the same inventory open.
- **updateDisplayName**: Updates the display name of an item.
- **updateDisplayNameForAll**: Updates the display name for all players with the same inventory open.
```
--------------------------------
### preventClose
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Prevents the player from closing the inventory manually.
```APIDOC
## preventClose
### Description
The player who has the inventory open can no longer close the inventory. The inventory can only be closed using the #close method.
### Request Example
RyseInventory.builder()
.title("preventClose preview")
.rows(3)
.preventClose()
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### ignoredSlots
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Configures specific slots to ignore InventoryClickEvents.
```APIDOC
## ignoredSlots
### Description
With #ignoredSlots you can ignore certain slots. There no InventoryClickEvent will take effect from the API's point of view.
### Request Example
RyseInventory.builder()
.title("ignoredSlots preview")
.rows(3)
.ignoredSlots(0,1,2,3)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### Set Inventory Identifier
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Assigns a unique ID to the inventory, allowing it to be retrieved later via the inventory manager.
```java
RyseInventory.builder()
.title("identifier preview")
.rows(3)
.identifier("TEST")
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
Bukkit.getScheduler().runTaskLater(RyseInventoryPlugin.this, () -> {
Optional optional = inventoryManager.getInventory("TEST");
optional.ifPresent(inventory -> inventory.updateTitle(player, "identifier successful"));
}, 20*2L);
}
})
.build(this)
.openAll();
```
--------------------------------
### identifier
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Assigns a unique identifier to the inventory for later retrieval.
```APIDOC
## identifier
### Description
Gives the inventory a unique identification.
### Request Example
RyseInventory.builder()
.title("identifier preview")
.rows(3)
.identifier("TEST")
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
Bukkit.getScheduler().runTaskLater(RyseInventoryPlugin.this, () -> {
Optional optional = inventoryManager.getInventory("TEST");
optional.ifPresent(inventory -> inventory.updateTitle(player, "identifier successful"));
}, 20*2L);
}
})
.build(this)
.openAll();
```
--------------------------------
### RyseInventory Title Holder
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Sets a temporary title for the inventory that is displayed for a specified duration before reverting to the main title. Uses #loadTitle and #titleHolder.
```java
RyseInventory.builder()
.title("titleHolder preview")
.titleHolder("§cThis is a temporary Title")
.loadTitle(3, TimeSetting.SECONDS)
.rows(3)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### Prevent Inventory Closing
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Disables the ability for players to close the inventory manually; it must be closed programmatically.
```java
RyseInventory.builder()
.title("preventClose preview")
.rows(3)
.preventClose()
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
--------------------------------
### Ignore Inventory Slots
Source: https://wiki.ryseinventory.de/classes/class-methods/ryseinventory/full-examples
Prevents InventoryClickEvent from triggering on specified slots.
```java
RyseInventory.builder()
.title("ignoredSlots preview")
.rows(3)
.ignoredSlots(0,1,2,3)
.provider(new InventoryProvider() {
@Override
public void init(Player player, InventoryContents contents) {
}
})
.build(this)
.openAll();
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.