Sueta
TH

The New Item Library

0.1.3.0

An item serialize, and utility library.

·Plugin

About
The New Item Library is an item library that allows for easy serialization, and deserialization of items(enchanted, potions, books, shulker boxes of potions, etc). It also provides a calculations class that may be used to count, add, and remove items from a library, with plans for expanding the utility classes with future releases.

How To Use
In order to use this library, you must first download the library and add it as a dependency to your project. After that please use the example code below on how to use it, or if you'd like to visually learn, check out the source code to the project
here .

Sample Code
//First we setup our itemstack.  
    ItemStack stack  =   new  ItemStack  (  Material.  DIAMOND_SWORD   )   ;  
    ItemMeta meta  =  stack.  getItemMeta   (   )   ;  
    meta.  setDisplayName   (  ChatColor.  GOLD   +   "Non-Epic Sword"   )   ;  
    stack.  addEnchantment   (  Enchantment.  FIRE_ASPECT  ,  2   )   ;  
    stack.  addEnchantment   (  Enchantment.  KNOCKBACK  ,  2   )   ;  
    stack.  addEnchantment   (  Enchantment.  DAMAGE_ALL  ,  5   )   ;  

     //Now we Serialize our ItemStack.  
     final    String   serialized  =  SerialItem  (   )  .  serialize   (  stack  )   ;  
      System   .  out  .  println   (  serialized  )   ;  

     //Now we unserialize it.  
     try   {  
      stack  =  SerialItem.  unserialize   (  serialized  )  .  getStack   (   )   ;  
     }   catch   (    ParseException   ignore  )   {  
       //Invalid JSON String  
     }  

     //Now we re-serialize for our sanity check.  
     final    String   reserialized  =  SerialItem  (   )  .  serialize   (  stack  )   ;  
      System   .  out  .  println   (  reserialized  )   ;


MAVEN
The New Item Library also supports maven. In order to use it with your maven project use the following information:

<repositories  > 
       <repository  > 
           <id>tne-repo</id  > 
           <url>https://maven.pkg.github.com/TheNewEconomy/packages/</url  > 
       </repository  > 
   </repositories  > 
 
    <dependencies  > 
      <dependency  > 
         <groupId>net.tnemc</groupId  > 
         <artifactId>TheNewItemLibrary</artifactId  > 
         <version>0.1.3.0</version  > 
      </dependency  > 
   </dependencies>

Known Caveats
This is a list of known caveats:

Support
For support choose one of the following.


Team

  • creatorfromhell

Contribute
To contribute to The New Economy you may fork our Github Repository, and make a Pull Request. The repository is located at: https://github.com/TheNewEconomy/TheNewItemLibrary .

Similar projects

Plugin →