mirror of
https://github.com/HibiscusMC/HibiscusCommons.git
synced 2025-12-19 15:09:26 +00:00
feat: allow ItemBuilder to just consume the ItemStack
This commit is contained in:
@@ -25,7 +25,7 @@ public class ItemBuilder {
|
||||
|
||||
private final ItemStack itemStack;
|
||||
private final ItemMeta itemMeta;
|
||||
private final boolean onPaper;
|
||||
private final boolean onPaper = HibiscusCommonsPlugin.isOnPaper();
|
||||
@Getter
|
||||
private final Material material;
|
||||
|
||||
@@ -33,14 +33,18 @@ public class ItemBuilder {
|
||||
this.material = material;
|
||||
this.itemStack = new ItemStack(material);
|
||||
this.itemMeta = itemStack.getItemMeta();
|
||||
this.onPaper = HibiscusCommonsPlugin.isOnPaper();
|
||||
}
|
||||
|
||||
public ItemBuilder(@NotNull ItemStack itemStack) {
|
||||
this.itemStack = itemStack;
|
||||
this.itemMeta = itemStack.getItemMeta();
|
||||
this.material = itemStack.getType();
|
||||
}
|
||||
|
||||
public ItemBuilder(@NotNull ItemStack itemStack, @NotNull ItemMeta itemMeta) {
|
||||
this.itemStack = itemStack;
|
||||
this.itemMeta = itemMeta;
|
||||
this.material = itemStack.getType();
|
||||
this.onPaper = HibiscusCommonsPlugin.isOnPaper();
|
||||
}
|
||||
|
||||
public ItemBuilder setDisplayName(@NotNull String displayName) {
|
||||
@@ -151,7 +155,7 @@ public class ItemBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemStack build() {
|
||||
public @NotNull ItemStack build() {
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user