Inventory API
1.0.0Revolutionizing the spigot community with a simple yet efficient inventory api
Inventory API
Ever wanted a simple yet professional way to make your inventories without having to make individual events per item? Well here's your solution, in our custom inventory system we utilize item listeners per item and save your data per item dependent on click type.
Features
- Inventories of any inventory type.
- Customization size from multiples of 9.
- Built in item builder with support for enchantments and lore.
- Click Types for different click types.
Examples of API
package com.asylumdevs.inventoryapi.example;
import java.util.Arrays;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.ItemStack;
import com.asylumdevs.inventoryapi.Inventory;
import com.asylumdevs.inventoryapi.InventoryAPI;
import com.asylumdevs.inventoryapi.ItemListener;
public class Example {
// Opening a blank inventory named "Example" with 1 row.
public void openBlank(Player p) {
Inventory inv = InventoryAPI.createInventory1(ChatColor.translateAlternateColorCodes('&', "Example"), 9);
inv.open(p);
}
// Opening a inventory with a inventort type named "HOPPER" for the item
// hopper.
public void openHopper(Player p) {
Inventory inv = InventoryAPI.createInventory(ChatColor.translateAlternateColorCodes('&', "Example"),
InventoryType.HOPPER);
inv.open(p);
}
// Opening a inventory with a custom item using our item builder.
public void openBuilder(Player p) {
Inventory inv = InventoryAPI.createInventory1(ChatColor.translateAlternateColorCodes('&', "Example"), 9);
inv.setSlot(4, InventoryAPI.createItem("&aClick here!", null, Material.DIRT,
null, 1), new ItemListener() {
public void onItemClick(Player p, ClickType click) {
// Empty doesn't do anything when clicked.
}
});
inv.open(p);
}
// Opening a inventory that replies back with the player's name.
public void openPlayerName(Player p) {
Inventory inv = InventoryAPI.createInventory1(ChatColor.translateAlternateColorCodes('&', "Example"), 9);
inv.setSlot(4, InventoryAPI.createItem("&dClick here!", null, Material.HOPPER,
null, 1), new ItemListener() {
public void onItemClick(Player p, ClickType click) {
p.sendMessage(p.getName());
}
});
inv.open(p);
}
// Opening a custom inventory created
public void openCustom(Player p) {
Inventory inv = InventoryAPI.createInventory1(ChatColor.translateAlternateColorCodes('&', "Example"), 9);
inv.setSlot(4, InventoryAPI.createItem("&dClick here!", Arrays.asList("&fHey!", "&fIf you click here you'll be given one dirt."), Material.HOPPER,
null, 1), new ItemListener() {
public void onItemClick(Player p, ClickType click) {
p.getInventory().addItem(new ItemStack(Material.DIRT));
}
});
inv.open(p);
}
}
Problems/Concerns
If you have problems or issues, you can send me a private message, or add me over on discord at ASD#4102.
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