Create advanced ItemStacks with just one line of code.
- 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();
- Create a Instance of the ItemBuilder
ItemBuilder builder = new ItemBuilder(Material.DIAMOND_SWORD);
- Access the
Unsafe
Class 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 inUnsafe
andbuild();
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();
- 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
,fromConfig
andtoConfig
are static. You can access them all usingItemBuilder.<Method>
without creating a Instance of the ItemBuilder.
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>