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 customModelData;
|
||||||
|
|
||||||
|
@NotNull private Integer stackSize;
|
||||||
|
|
||||||
@NotNull private Rarity rarity;
|
@NotNull private Rarity rarity;
|
||||||
|
|
||||||
@NotNull private ItemType type;
|
@NotNull private ItemType type;
|
||||||
|
@ -74,6 +76,7 @@ public class Item {
|
||||||
this.description = "";
|
this.description = "";
|
||||||
this.rarity = Rarity.COMMON;
|
this.rarity = Rarity.COMMON;
|
||||||
this.customModelData = 0;
|
this.customModelData = 0;
|
||||||
|
this.stackSize = 1;
|
||||||
this.abilities = List.of();
|
this.abilities = List.of();
|
||||||
this.attributes = new EnumMap<>(Attribute.class);
|
this.attributes = new EnumMap<>(Attribute.class);
|
||||||
this.enchantments = new HashMap<>();
|
this.enchantments = new HashMap<>();
|
||||||
|
@ -87,6 +90,7 @@ public class Item {
|
||||||
this.description = "";
|
this.description = "";
|
||||||
this.rarity = Rarity.COMMON;
|
this.rarity = Rarity.COMMON;
|
||||||
this.customModelData = 0;
|
this.customModelData = 0;
|
||||||
|
this.stackSize = 1;
|
||||||
this.abilities = List.of();
|
this.abilities = List.of();
|
||||||
this.attributes = new EnumMap<>(Attribute.class);
|
this.attributes = new EnumMap<>(Attribute.class);
|
||||||
this.enchantments = new HashMap<>();
|
this.enchantments = new HashMap<>();
|
||||||
|
@ -208,6 +212,15 @@ public class Item {
|
||||||
this.customModelData = customModelData;
|
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
|
@Nullable
|
||||||
public ItemStack toItemStack() {
|
public ItemStack toItemStack() {
|
||||||
ItemStack item = new ItemStack(material);
|
ItemStack item = new ItemStack(material);
|
||||||
|
@ -244,6 +257,8 @@ public class Item {
|
||||||
+ description
|
+ description
|
||||||
+ "\", \"customModelData\": "
|
+ "\", \"customModelData\": "
|
||||||
+ customModelData
|
+ customModelData
|
||||||
|
+ ", \"stackSize\": "
|
||||||
|
+ stackSize
|
||||||
+ ", \"rarity\": \""
|
+ ", \"rarity\": \""
|
||||||
+ rarity
|
+ rarity
|
||||||
+ "\", \"type\": \""
|
+ "\", \"type\": \""
|
||||||
|
@ -270,6 +285,7 @@ public class Item {
|
||||||
this.material = Material.valueOf((String) map.get("material"));
|
this.material = Material.valueOf((String) map.get("material"));
|
||||||
this.description = (String) map.get("description");
|
this.description = (String) map.get("description");
|
||||||
this.customModelData = ((Double) map.get("customModelData")).intValue();
|
this.customModelData = ((Double) map.get("customModelData")).intValue();
|
||||||
|
this.stackSize = ((Double) map.get("stackSize")).intValue();
|
||||||
this.rarity = Rarity.valueOf((String) map.get("rarity"));
|
this.rarity = Rarity.valueOf((String) map.get("rarity"));
|
||||||
this.type = ItemType.valueOf((String) map.get("type"));
|
this.type = ItemType.valueOf((String) map.get("type"));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue