ItemBuilder
Create ItemStacks with Displayname, Material, Lore, ItemFlags etc. with just one Line of Code
Install / Use
/learn @Acquized/ItemBuilderREADME
ItemBuilder
Create advanced ItemStacks with just one line of code.
Standart ItemBuilder API Usage
- Create a Instance of the ItemBuilder:
ItemBuilder builder = new ItemBuilder(Material.GLOWSTONE); - Modify the ItemStack using one of the many methods, for example:
builder.displayname("§6ItemBuiler Glowstone"); - When you are finish modifing it, use
builder.build();to get the Bukkit ItemStack back
You can also do all steps in just one line:ItemStack item = new ItemBuilder(Material.GLOWSTONE).displayname("§6ItemBuilder Glowstone").build();
NBT Tags Writing / Reading (Advanced)
- Create a Instance of the ItemBuilder
ItemBuilder builder = new ItemBuilder(Material.DIAMOND_SWORD); - Access the
UnsafeClass using thebuilder.unsafe();Method - Add/Remove NBT Tags using
builder.unsafe().addString("Key", "Value");orbuilder.unsafe().removeString("Key", "Value"); - Go back to the ItemBuilder Class using the
builder();Method inUnsafeandbuild();the ItemStack.
You can also do all steps in just one line:ItemStack item = new ItemBuilder(Material.DIAMOND_SWORD).unsafe().addString("Key", "Value").builder().build();
Json and Config Writing / Reading (Advanced)
- Create a Instance of the ItemBuilder and set anything you need.
- Convert it to a JSON String using
builder.toJson()or to a Config Path usingbuilder.toConfig(MyPlugin.getInstance().getConfig(), "my.custom.item"). - TIP! The Methods
fromJson,toJson,fromConfigandtoConfigare static. You can access them all usingItemBuilder.<Method>without creating a Instance of the ItemBuilder.
Maven
Repository:
<repositories>
<repository>
<id>acquized-repo</id>
<url>http://repo.acquized.pw/maven/</url>
</repository>
</repositories>
Dependency:
<dependencies>
<dependency>
<groupId>cc.acquized</groupId>
<artifactId>ItemBuilder</artifactId>
<version>1.8</version>
</dependency>
</dependencies>
