HomeJavaModsItemUtilAPI
ItemUtilAPI
This API has only one goal: To make the creation and the interaction of ItemStacks easy. It has a class called ItemCreator, which lets you build your own ItemStack in just one line, and a special addition, which is an InteractionListener and a InventoryClickListener configured in the ItemCreator as well.

Code (Text):
ItemCreator itemCreator = new ItemCreator(Material.DIAMOND);

itemCreator.handleInteraction((event) -> {
/*Allows you to put the same code you would put in the PlayerInteractEvent Handler*/
});
itemCreator.handleClick((event) -> {
/*Allows you to put the same code you would put in the InventoryClickEvent Handler*/
});
 
All of the methods that the ItemCreator class provides can be found in the image below. Screenshot_6.png

Here is an example, it shows the creation of a simple BlazeRod, that pushes the player in the direction he is looking when the player rightclicks, that sends a message to the player when he clicks it in his inventory.

Code (Text):
 ItemCreator creator = new ItemCreator(Material.BLAZE_ROD);
        creator.setDisplayName("§cFlying Staff")
                .setGlow(true)
                .addLore("Makes you fly! §7(Rightclick)")
                .handleInteraction((event) -> {
                    if(event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
                        event.getPlayer().setVelocity(event.getPlayer().getLocation().getDirection().multiply(5f));
                        event.getPlayer().sendMessage("§aYou have been pushed!");
                    }
                }).handleClick((event) -> event.getWhoClicked().sendMessage("hey there"));
        ItemStack stack = creator.build();

If you have any questions regarding the API, feel free to add me on Discord: OverDodo#1535 or start a conversation here!


IMPORTANT: If you want your Items to work with Actions after a restart, create and build the items in a method that is run when the plugin is getting enabled.
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

ItemUtilAPI is a free Minecraft Java mod. Compatible with Minecraft 1.8, 1.12, 1.13. Downloaded 668 times (via Spigot). Download it and open it directly in the game.

Explore more