πŸ“šFull Examples

Here you can find examples for each method for the RyseInventory.Builder and RyseInventory.

There are several methods here. If you are looking for a specific method press CTRL+F on your keyboard and type the method name.

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

  • We have implemented the method init by the InventoryProvider.

  • By .openDelay(3, TimeSettings.SECONDS), the inventory will be opened only after 3 seconds.

Code

Preview

Description

  • We have implemented the methods init and update by the InventoryProvider.

  • With .period(3, TimeSettings.SECONDS) the update method is called every 3 seconds.

Code

Preview

Description

  • With .closeAfter(3, TimeSettings.SECONDS) the inventory is closed after 3 seconds.

Code

Preview

Description

  • With #ignoreEvents you can ignore certain events that are blocked by RyseInventory by default. Like for example the InventoryDragEvent

Code

Preview

Description

  • With #ignoredSlots you can ignore certain slots. There no InventoryClickEvent will take effect from the API's point of view.

Code

Preview

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.

Code

Preview

Description

  • Gives the inventory a unique identification.

Code

Preview

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.

Code

Preview

Description

  • The player who has the inventory open can no longer close the inventory. The inventory can only be closed using the #close method.

Code

Preview

Description

  • ErmΓΆglicht es ein Inventar mit einem anderen Typen zu erstellen.

Code

Preview

Description

  • With #fixedPageSize(5) we say that we always want to have 5 pages. There it doesn't matter how many items are in the pagination.

Code

Preview

Description

  • The #titleHolder method is used in conjunction with the #loadTitle method. If we say #loadTitle(3, TimeSetting.SECONDS) the title we define in the #titleHolder method will be displayed for 3 seconds. After that the title we define with #title will be displayed.

Code

Preview

Description

  • Delays the InventoryProvider. That means the content you have under your implemented method "init" will be loaded after 3 seconds in this case.

Code

Preview

Description

  • Closes the inventory. In this case the inventory will be closed 3 seconds after opening.

Code

Description

  • Creates a "SlideAnimation". Items can slide in from left->right or from right->left or from top->bottom or from bottom->top or diagonally.

  • Attention! In this case you must implement the Init method that contains SlideAnimation. Then you can say "animation.animate(contents);".

Code

Preview

Description

  • You can enable different actions that are disabled by the API by default. In this case I allow you to move items between inventories. Moving the items is restricted. I can move the item in slot 0, because I told there with #ignoredSlots that this slot is ignored.

Code

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