9
0
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:
LoJoSho
2025-07-23 15:51:23 -05:00
parent 24a4ae3d23
commit 038c230282

View File

@@ -25,7 +25,7 @@ public class ItemBuilder {
private final ItemStack itemStack; private final ItemStack itemStack;
private final ItemMeta itemMeta; private final ItemMeta itemMeta;
private final boolean onPaper; private final boolean onPaper = HibiscusCommonsPlugin.isOnPaper();
@Getter @Getter
private final Material material; private final Material material;
@@ -33,14 +33,18 @@ public class ItemBuilder {
this.material = material; this.material = material;
this.itemStack = new ItemStack(material); this.itemStack = new ItemStack(material);
this.itemMeta = itemStack.getItemMeta(); 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) { public ItemBuilder(@NotNull ItemStack itemStack, @NotNull ItemMeta itemMeta) {
this.itemStack = itemStack; this.itemStack = itemStack;
this.itemMeta = itemMeta; this.itemMeta = itemMeta;
this.material = itemStack.getType(); this.material = itemStack.getType();
this.onPaper = HibiscusCommonsPlugin.isOnPaper();
} }
public ItemBuilder setDisplayName(@NotNull String displayName) { public ItemBuilder setDisplayName(@NotNull String displayName) {
@@ -151,7 +155,7 @@ public class ItemBuilder {
return this; return this;
} }
public ItemStack build() { public @NotNull ItemStack build() {
itemStack.setItemMeta(itemMeta); itemStack.setItemMeta(itemMeta);
return itemStack; return itemStack;
} }