Fixed an issue with Unstackable (would disappear after any item update)

This commit is contained in:
Indyuce 2020-08-09 11:11:42 +02:00
parent b35719869c
commit 1908022380

View File

@ -1,26 +1,27 @@
package net.Indyuce.mmoitems.stat;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
import net.Indyuce.mmoitems.stat.data.BooleanData;
import net.Indyuce.mmoitems.stat.data.type.StatData;
import net.Indyuce.mmoitems.stat.type.BooleanStat;
import net.mmogroup.mmolib.api.item.ItemTag;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import java.util.UUID;
public class Unstackable extends BooleanStat {
public Unstackable() {
super("UNSTACKABLE", new ItemStack(Material.CHEST_MINECART), "Unstackable",
new String[] { "This will make the item unable", "to be stacked with itself." }, new String[] { "all" });
}
public Unstackable() {
super("UNSTACKABLE", new ItemStack(Material.CHEST_MINECART), "Unstackable", new String[] { "This will make the item unable", "to be stacked with itself."}, new String[] { "all" });
}
@Override
public void whenApplied(MMOItemBuilder item, StatData data) {
if (((BooleanData) data).isEnabled()) {
item.addItemTag(new ItemTag("UNSTACKABLE", true));
item.addItemTag(new ItemTag("UNSTACKABLE_UUID", UUID.randomUUID().toString()));
}
}
@Override
public void whenApplied(MMOItemBuilder item, StatData data) {
if (((BooleanData) data).isEnabled()) {
item.addItemTag(new ItemTag("MMOITEMS_UNSTACKABLE", true));
item.addItemTag(new ItemTag("MMOITEMS_UNSTACKABLE_UUID", UUID.randomUUID().toString()));
}
}
}