Home›Java›Mods›KevsInventory
ModsJava

KevsInventory

Java mod listed for Minecraft 1.7–1.9. Download on the author's site.

⬇ Download on Spigot
You want to create an inventory with less code as usual?
Use KevsInventory!

Code Examples:
Code (Java):
// Default using Spigot's API:
public void method ( ) {
  Inventory inv = Bukkit. createInventory ( null, 9, "testinv" ) ;
  inv. setItem ( 0, your_1st_item_stack ) ;
  inv. setItem ( 1, your_2nd_item_stack ) ;
  player. openInventory (inv ) ;
}
// now the creation part is done. going further with click event D:
@EventHandler
public void onClick (InventoryClickEvent event ) {
  if (event. getInventory ( ). getName ( ). equals ( "testinv" ) ) { // not that safe...
    event. setCancelled ( true ) ;
    event. getWhoClicked ( ). sendMessage ( "old inventory creation :(" ) ;
  }
}
// AND YOU HAVE TO REGISTER THE EVENT IN THE PLUGINMANAGER :/
 
Soo now to the KevsInventory version
Code (Java):
KevsInventory new_inv = new KevsInventory (your_plugin, the_player, new KevInvClickEventHandler ( ) {
  //the event handler delivered as integrated tasty edition :D
  @Override
  public void onInventoryClick (KevInvClickEvent event ) {
    // don't need check if inventory is correct
    // event is allways cancelled (adding function in next release)
    event. getPlayer ( ). sendMessage ( "new inventory creation :)" ) ; // player is given to you, not HumanSender or such from orignal event :D
  }
} ;
// Now you create the inventory, as easy as in the original
new_inv. createInventory ( 9, "§cNew Inventory!" ) ; // don't need saving or the odd null
new_inv. setItem ( 0, your_1st_item_stack ) ;
new_inv. setItem ( 1, your_2nd_item_stack ) ;
new_inv. open ( ) ; // done!
 
I hope you like this! If you do, download it, use it and contribute to the source on GitHub :D

P.S.: My API has 3 less lines as the spigot one and is more "safe" ;)
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.

KevsInventory is a free Minecraft Java mod. Compatible with Minecraft 1.7, 1.8, 1.9. Downloaded 163 times (via Spigot). Download it and open it directly in the game.

Explore more