πFull Examples
Here you can find examples for each method for the RyseInventory.Builder and RyseInventory.
These are possible implementations. It is not recommended to copy anything randomly.
Description
We have implemented the methods update and init by the InventoryProvider.
By .delay(3, TimeSetting.SECONDS) the method update is called only after 3 seconds.
Code
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();Preview
Description
Often one creates an inventory without the need of the method "update" from the InventoryProvider. Initially a scheduler was created for it anyway. A scheduler will still be created, but it is recommended that if you do not implement an update method, that you use #disableUpdateTask to say that no scheduler should be started at all.
Code
Last updated