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.
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.
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.
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.
Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta