add item stack value
This commit is contained in:
parent
7f326710b9
commit
54d1f7ba52
1 changed files with 16 additions and 0 deletions
|
@ -57,6 +57,8 @@ public class Item {
|
|||
|
||||
@NotNull private Integer customModelData;
|
||||
|
||||
@NotNull private Integer stackSize;
|
||||
|
||||
@NotNull private Rarity rarity;
|
||||
|
||||
@NotNull private ItemType type;
|
||||
|
@ -74,6 +76,7 @@ public class Item {
|
|||
this.description = "";
|
||||
this.rarity = Rarity.COMMON;
|
||||
this.customModelData = 0;
|
||||
this.stackSize = 1;
|
||||
this.abilities = List.of();
|
||||
this.attributes = new EnumMap<>(Attribute.class);
|
||||
this.enchantments = new HashMap<>();
|
||||
|
@ -87,6 +90,7 @@ public class Item {
|
|||
this.description = "";
|
||||
this.rarity = Rarity.COMMON;
|
||||
this.customModelData = 0;
|
||||
this.stackSize = 1;
|
||||
this.abilities = List.of();
|
||||
this.attributes = new EnumMap<>(Attribute.class);
|
||||
this.enchantments = new HashMap<>();
|
||||
|
@ -208,6 +212,15 @@ public class Item {
|
|||
this.customModelData = customModelData;
|
||||
}
|
||||
|
||||
// TODO: implement check for stack size on item related events
|
||||
public @NotNull Integer getStackSize() {
|
||||
return stackSize;
|
||||
}
|
||||
|
||||
public void setStackSize(@NotNull Integer stackSize) {
|
||||
this.stackSize = stackSize;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ItemStack toItemStack() {
|
||||
ItemStack item = new ItemStack(material);
|
||||
|
@ -244,6 +257,8 @@ public class Item {
|
|||
+ description
|
||||
+ "\", \"customModelData\": "
|
||||
+ customModelData
|
||||
+ ", \"stackSize\": "
|
||||
+ stackSize
|
||||
+ ", \"rarity\": \""
|
||||
+ rarity
|
||||
+ "\", \"type\": \""
|
||||
|
@ -270,6 +285,7 @@ public class Item {
|
|||
this.material = Material.valueOf((String) map.get("material"));
|
||||
this.description = (String) map.get("description");
|
||||
this.customModelData = ((Double) map.get("customModelData")).intValue();
|
||||
this.stackSize = ((Double) map.get("stackSize")).intValue();
|
||||
this.rarity = Rarity.valueOf((String) map.get("rarity"));
|
||||
this.type = ItemType.valueOf((String) map.get("type"));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue