NOTE: This is only a library, thus it is useless on its own.
This is a library I use for most of my plugins, but you may use it for your own purposes aswell.
TiffitLib contains 2 APIs, InventoryAPI, and AnvilAPI.
InventoryAPI:
InventoryAPI is used to store and retrieve inventories easily.
Store an inventory:
Retrieve and inventory:Code (Text):InventoryAPI.addInventory(Player, ICustomInventory);
Example of an inventory:Code (Text):InventoryAPI.openInventory(Player, Inventory Name);
InventoryAPI also contains 3 useful classes:Code (Text):public class Test implements ICustomInventory {
Player p;
public Test(Player p){
this.p = p;
}
@Override
public Inventory getInv() {
Inventory inv = Bukkit.createInventory(null, 9, getName());
inv.addItem(ItemStackUtil.createStack(Material.DIAMOND, ChatColor.GREEN + "DIAMONDZ"));
return inv;
}
@Override
public String getName() {
return "test";
}
ItemStackUtil - Easily create item stacks
ItemStackBuilder - Build item stacks
InventoryUtil - Rounds any number up to a number divisible by 9. So, 5 would return 9, 0 would return 9, 20 would return 27, etc.
AnvilAPI:
AnvilAPI is useful for creating a fake anvil for a player.
Open up the fake anvil:
Example of ICustomAnvil:Code (Text):AnvilAPI.openAnvil(ICustomAnvil i);
Code (Text):
public class test implements ICustomAnvil {
Player p;
public test(Player p){
this.p = p;
}
public Player getPlayer() {
returnp;
}
public ItemStack anvilItem() {
return ItemStackUtil.createStack(Material.NAME_TAG, "Search");
}
@Override
public void anvilInteract(InventoryClickEvent e, String name) {
Bukkit.getPlayer(name).sendMessage(p.getName() + " said hi!");
}
}

TiffitLib 1.0.2
Library for all of tiffit's plugins