diff --git a/src/main/java/net/Indyuce/mmoitems/ItemStats.java b/src/main/java/net/Indyuce/mmoitems/ItemStats.java index 826e30ab..53041a58 100644 --- a/src/main/java/net/Indyuce/mmoitems/ItemStats.java +++ b/src/main/java/net/Indyuce/mmoitems/ItemStats.java @@ -35,7 +35,7 @@ public class ItemStats { GEN_TEMPLATE = new GenTemplate(), // Misc Stats - DISPLAYED_TYPE = new StringStat("DISPLAYED_TYPE", VersionMaterial.OAK_SIGN.toMaterial(), "Displayed Type", new String[]{"This option will only affect the", "type displayed on the item lore."}, new String[]{"all"}), + DISPLAYED_TYPE = new DisplayedType(), ENCHANTS = new Enchants(), HIDE_ENCHANTS = new HideEnchants(), PERMISSION = new Permission(), @@ -141,7 +141,7 @@ public class ItemStats { // Crafting Stats CRAFTING = new Crafting(), - CRAFT_PERMISSION = new StringStat("CRAFT_PERMISSION", VersionMaterial.OAK_SIGN.toMaterial(), "Crafting Recipe Permission", new String[]{"The permission needed to craft this item.", "Changing this value requires &o/mi reload recipes&7."}, new String[]{"all"}), + CRAFT_PERMISSION = new CraftingPermission(), //CRAFT_AMOUNT = new DoubleStat("CRAFTED_AMOUNT", Material.WOODEN_AXE, "Crafted Amount", new String[]{"The stack count for", "this item when crafted."}, new String[]{"all"}), // Unique Stats diff --git a/src/main/java/net/Indyuce/mmoitems/comp/enchants/CrazyEnchantsStat.java b/src/main/java/net/Indyuce/mmoitems/comp/enchants/CrazyEnchantsStat.java index d0344403..01c35b94 100644 --- a/src/main/java/net/Indyuce/mmoitems/comp/enchants/CrazyEnchantsStat.java +++ b/src/main/java/net/Indyuce/mmoitems/comp/enchants/CrazyEnchantsStat.java @@ -7,12 +7,9 @@ import me.badbones69.crazyenchantments.api.objects.CEnchantment; import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder; import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem; import net.Indyuce.mmoitems.gui.edition.EditionInventory; -import net.Indyuce.mmoitems.stat.data.SoulboundData; import net.Indyuce.mmoitems.stat.data.random.RandomStatData; -import net.Indyuce.mmoitems.stat.data.type.StatData; import net.Indyuce.mmoitems.stat.type.InternalStat; import net.Indyuce.mmoitems.stat.type.ItemStat; -import net.Indyuce.mmoitems.stat.type.StringStat; import org.apache.commons.lang.NotImplementedException; import org.bukkit.Material; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/net/Indyuce/mmoitems/comp/mmoinventory/stat/AccessorySet.java b/src/main/java/net/Indyuce/mmoitems/comp/mmoinventory/stat/AccessorySet.java index 4bf25ccc..11c03b2c 100644 --- a/src/main/java/net/Indyuce/mmoitems/comp/mmoinventory/stat/AccessorySet.java +++ b/src/main/java/net/Indyuce/mmoitems/comp/mmoinventory/stat/AccessorySet.java @@ -5,6 +5,7 @@ import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder; import net.Indyuce.mmoitems.gui.edition.EditionInventory; import net.Indyuce.mmoitems.stat.data.StringData; import net.Indyuce.mmoitems.stat.data.type.StatData; +import net.Indyuce.mmoitems.stat.type.GemStoneStat; import net.Indyuce.mmoitems.stat.type.StringStat; import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.item.ItemTag; @@ -12,7 +13,7 @@ import io.lumine.mythic.lib.version.VersionMaterial; import org.bukkit.ChatColor; import org.jetbrains.annotations.NotNull; -public class AccessorySet extends StringStat { +public class AccessorySet extends StringStat implements GemStoneStat { public AccessorySet() { super("ACCESSORY_SET", VersionMaterial.OAK_SIGN.toMaterial(), "Accessory Set (MMOInventory)", new String[] { "Used with MMOInventory's unique", "restriction to only allow one", "accessory to be equipped per set." }, new String[] { "!block", "all" }); } @@ -21,6 +22,7 @@ public class AccessorySet extends StringStat { public void whenApplied(@NotNull ItemStackBuilder item, @NotNull StringData data) { item.addItemTag(new ItemTag(getNBTPath(), data.toString())); } + @Override public void whenInput(@NotNull EditionInventory inv, @NotNull String message, Object... info) { message = message.toLowerCase(); diff --git a/src/main/java/net/Indyuce/mmoitems/stat/Amphibian.java b/src/main/java/net/Indyuce/mmoitems/stat/Amphibian.java index abd8d44b..c5a2d68b 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/Amphibian.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/Amphibian.java @@ -5,10 +5,7 @@ import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.item.SupportedNBTTagValues; import io.lumine.mythic.lib.api.util.ui.SilentNumbers; import net.Indyuce.mmoitems.api.player.RPGPlayer; -import net.Indyuce.mmoitems.stat.data.ArrowParticlesData; -import net.Indyuce.mmoitems.stat.data.BooleanData; import net.Indyuce.mmoitems.stat.data.StringData; -import net.Indyuce.mmoitems.stat.data.type.StatData; import net.Indyuce.mmoitems.stat.type.ChooseStat; import net.Indyuce.mmoitems.stat.type.GemStoneStat; import net.Indyuce.mmoitems.stat.type.ItemRestriction; diff --git a/src/main/java/net/Indyuce/mmoitems/stat/CraftingPermission.java b/src/main/java/net/Indyuce/mmoitems/stat/CraftingPermission.java index 40c0bcd2..6cd44e15 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/CraftingPermission.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/CraftingPermission.java @@ -1,48 +1,49 @@ package net.Indyuce.mmoitems.stat; import io.lumine.mythic.lib.api.item.ItemTag; +import io.lumine.mythic.lib.version.VersionMaterial; import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder; import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem; import net.Indyuce.mmoitems.stat.data.StringData; -import net.Indyuce.mmoitems.stat.data.type.StatData; +import net.Indyuce.mmoitems.stat.type.GemStoneStat; import net.Indyuce.mmoitems.stat.type.StringStat; -import io.lumine.mythic.lib.version.VersionMaterial; +import net.Indyuce.mmoitems.stat.type.TemplateOption; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; -public class CraftingPermission extends StringStat { - public CraftingPermission() { - super("CRAFT_PERMISSION", VersionMaterial.OAK_SIGN.toMaterial(), "Crafting Recipe Permission", - new String[] { "The permission needed to craft this item.", "Changing this value requires &o/mi reload recipes&7." }, - new String[] { "all" }); +public class CraftingPermission extends StringStat implements TemplateOption, GemStoneStat { + public CraftingPermission() { + super("CRAFT_PERMISSION", VersionMaterial.OAK_SIGN.toMaterial(), "Crafting Recipe Permission", + new String[]{"The permission needed to craft this item.", "Changing this value requires &o/mi reload recipes&7."}, + new String[]{"all"}); + } - disable(); - } + public void whenLoaded(@NotNull ReadMMOItem mmoitem) { + throw new RuntimeException("Not supported"); + } - /** - * This stat is not saved onto items. This method is empty. - */ - @Override - public void whenLoaded(@NotNull ReadMMOItem mmoitem) { } + /** + * This stat is not saved onto items. This method always returns null + */ + @Nullable + public StringData getLoadedNBT(@NotNull ArrayList storedTags) { + throw new RuntimeException("Not supported"); + } - /** - * This stat is not saved onto items. This method always returns null - */ - @Nullable - @Override - public StringData getLoadedNBT(@NotNull ArrayList storedTags) { return null; } + /** + * This stat is not saved onto items. This method is empty. + */ + public void whenApplied(@NotNull ItemStackBuilder item, @NotNull StringData data) { + throw new RuntimeException("Not supported"); + } - /** - * This stat is not saved onto items. This method is empty. - */ - @Override - public void whenApplied(@NotNull ItemStackBuilder item, @NotNull StringData data) { } - - /** - * This stat is not saved onto items. This method returns an empty array. - */ - @NotNull - @Override public ArrayList getAppliedNBT(@NotNull StringData data) { return new ArrayList<>(); } + /** + * This stat is not saved onto items. This method returns an empty array. + */ + @NotNull + public ArrayList getAppliedNBT(@NotNull StringData data) { + throw new RuntimeException("Not supported"); + } } \ No newline at end of file diff --git a/src/main/java/net/Indyuce/mmoitems/stat/DisplayedType.java b/src/main/java/net/Indyuce/mmoitems/stat/DisplayedType.java new file mode 100644 index 00000000..d386c833 --- /dev/null +++ b/src/main/java/net/Indyuce/mmoitems/stat/DisplayedType.java @@ -0,0 +1,11 @@ +package net.Indyuce.mmoitems.stat; + +import io.lumine.mythic.lib.version.VersionMaterial; +import net.Indyuce.mmoitems.stat.type.GemStoneStat; +import net.Indyuce.mmoitems.stat.type.StringStat; + +public class DisplayedType extends StringStat implements GemStoneStat { + public DisplayedType() { + super("DISPLAYED_TYPE", VersionMaterial.OAK_SIGN.toMaterial(), "Displayed Type", new String[]{"This option will only affect the", "type displayed on the item lore."}, new String[]{"all"}); + } +} diff --git a/src/main/java/net/Indyuce/mmoitems/stat/GemColor.java b/src/main/java/net/Indyuce/mmoitems/stat/GemColor.java index 5cbfe14a..e65745be 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/GemColor.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/GemColor.java @@ -3,12 +3,13 @@ package net.Indyuce.mmoitems.stat; import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder; import net.Indyuce.mmoitems.stat.data.StringData; import net.Indyuce.mmoitems.stat.data.type.StatData; +import net.Indyuce.mmoitems.stat.type.GemStoneStat; import net.Indyuce.mmoitems.stat.type.StringStat; import io.lumine.mythic.lib.api.item.ItemTag; import io.lumine.mythic.lib.version.VersionMaterial; import org.jetbrains.annotations.NotNull; -public class GemColor extends StringStat { +public class GemColor extends StringStat implements GemStoneStat { public GemColor() { super("GEM_COLOR", VersionMaterial.LIGHT_BLUE_DYE.toMaterial(), "Gem Color", new String[] { "Defines the color of the socket in", "which the gem can be applied." }, new String[] { "gem_stone" }); } diff --git a/src/main/java/net/Indyuce/mmoitems/stat/ItemSetStat.java b/src/main/java/net/Indyuce/mmoitems/stat/ItemSetStat.java index 826fc6fa..78286caa 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/ItemSetStat.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/ItemSetStat.java @@ -7,6 +7,7 @@ import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem; import net.Indyuce.mmoitems.gui.edition.EditionInventory; import net.Indyuce.mmoitems.stat.data.StringData; import net.Indyuce.mmoitems.stat.data.type.StatData; +import net.Indyuce.mmoitems.stat.type.GemStoneStat; import net.Indyuce.mmoitems.stat.type.StringStat; import io.lumine.mythic.lib.api.item.ItemTag; import org.apache.commons.lang.Validate; @@ -18,7 +19,7 @@ import org.jetbrains.annotations.NotNull; import java.util.ArrayList; -public class ItemSetStat extends StringStat { +public class ItemSetStat extends StringStat implements GemStoneStat { public ItemSetStat() { super("SET", Material.LEATHER_CHESTPLATE, "Item Set", new String[] { "Item sets can give to the player extra", "bonuses that depend on how many items", "from the same set your wear." }, diff --git a/src/main/java/net/Indyuce/mmoitems/stat/ItemTierStat.java b/src/main/java/net/Indyuce/mmoitems/stat/ItemTierStat.java index e2ecf8bc..96c6a7f7 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/ItemTierStat.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/ItemTierStat.java @@ -1,6 +1,7 @@ package net.Indyuce.mmoitems.stat; import net.Indyuce.mmoitems.stat.data.StringData; +import net.Indyuce.mmoitems.stat.type.GemStoneStat; import org.apache.commons.lang.Validate; import org.bukkit.Material; @@ -13,7 +14,7 @@ import net.Indyuce.mmoitems.stat.type.StringStat; import io.lumine.mythic.lib.api.item.ItemTag; import org.jetbrains.annotations.NotNull; -public class ItemTierStat extends StringStat { +public class ItemTierStat extends StringStat implements GemStoneStat { public ItemTierStat() { super("TIER", Material.DIAMOND, "Item Tier", new String[] { "The tier defines how rare your item is", "and what item is dropped when your", "item is deconstructed.", "&9Tiers can be configured in the tiers.yml file" }, new String[] { "all" }); diff --git a/src/main/java/net/Indyuce/mmoitems/stat/LoreFormat.java b/src/main/java/net/Indyuce/mmoitems/stat/LoreFormat.java index d0f132b8..36f2e9c4 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/LoreFormat.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/LoreFormat.java @@ -2,6 +2,7 @@ package net.Indyuce.mmoitems.stat; import net.Indyuce.mmoitems.stat.data.StringData; import net.Indyuce.mmoitems.stat.data.StringListData; +import net.Indyuce.mmoitems.stat.type.GemStoneStat; import org.apache.commons.lang.Validate; import org.bukkit.Material; @@ -13,7 +14,7 @@ import net.Indyuce.mmoitems.stat.type.StringStat; import io.lumine.mythic.lib.api.item.ItemTag; import org.jetbrains.annotations.NotNull; -public class LoreFormat extends StringStat { +public class LoreFormat extends StringStat implements GemStoneStat { public LoreFormat() { super("LORE_FORMAT", Material.MAP, "Lore Format", new String[] { "The lore format decides", "where each stat goes.", "&9Formats can be configured in", "&9the lore-formats folder" }, diff --git a/src/main/java/net/Indyuce/mmoitems/stat/LuteAttackEffectStat.java b/src/main/java/net/Indyuce/mmoitems/stat/LuteAttackEffectStat.java index d0b5bc7b..ad6d5a1d 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/LuteAttackEffectStat.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/LuteAttackEffectStat.java @@ -10,12 +10,13 @@ import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder; import net.Indyuce.mmoitems.gui.edition.EditionInventory; import net.Indyuce.mmoitems.stat.data.StringData; import net.Indyuce.mmoitems.stat.data.type.StatData; +import net.Indyuce.mmoitems.stat.type.GemStoneStat; import net.Indyuce.mmoitems.stat.type.StringStat; import org.bukkit.event.inventory.InventoryAction; import org.bukkit.event.inventory.InventoryClickEvent; import org.jetbrains.annotations.NotNull; -public class LuteAttackEffectStat extends StringStat { +public class LuteAttackEffectStat extends StringStat implements GemStoneStat { public LuteAttackEffectStat() { super("LUTE_ATTACK_EFFECT", VersionMaterial.DIAMOND_HORSE_ARMOR.toMaterial(), "Lute Attack Effect", new String[] { "Changes how your lute behaves", "when right clicked.", "&9Tip: /mi list lute" }, new String[] { "lute" }); diff --git a/src/main/java/net/Indyuce/mmoitems/stat/LuteAttackSoundStat.java b/src/main/java/net/Indyuce/mmoitems/stat/LuteAttackSoundStat.java index 0ed6a331..c4f8f5d2 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/LuteAttackSoundStat.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/LuteAttackSoundStat.java @@ -3,12 +3,13 @@ package net.Indyuce.mmoitems.stat; import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder; import net.Indyuce.mmoitems.stat.data.StringData; import net.Indyuce.mmoitems.stat.data.type.StatData; +import net.Indyuce.mmoitems.stat.type.GemStoneStat; import net.Indyuce.mmoitems.stat.type.StringStat; import io.lumine.mythic.lib.api.item.ItemTag; import io.lumine.mythic.lib.version.VersionMaterial; import org.jetbrains.annotations.NotNull; -public class LuteAttackSoundStat extends StringStat { +public class LuteAttackSoundStat extends StringStat implements GemStoneStat { public LuteAttackSoundStat() { super("LUTE_ATTACK_SOUND", VersionMaterial.GOLDEN_HORSE_ARMOR.toMaterial(), "Lute Attack Sound", new String[] { "The sound played when", "basic attacking with this lute." }, new String[] { "lute" }); } diff --git a/src/main/java/net/Indyuce/mmoitems/stat/RepairType.java b/src/main/java/net/Indyuce/mmoitems/stat/RepairType.java index e1e6638d..1b3a1620 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/RepairType.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/RepairType.java @@ -1,9 +1,10 @@ package net.Indyuce.mmoitems.stat; +import net.Indyuce.mmoitems.stat.type.GemStoneStat; import net.Indyuce.mmoitems.stat.type.StringStat; import org.bukkit.Material; -public class RepairType extends StringStat { +public class RepairType extends StringStat implements GemStoneStat { public RepairType() { super("REPAIR_TYPE", Material.ANVIL, "Repair Type", new String[]{"If items have a repair type they can", "only be repaired by consumables", "with the same repair type.", "(And vice-versa)"}, new String[]{"all"}); } diff --git a/src/main/java/net/Indyuce/mmoitems/stat/StaffSpiritStat.java b/src/main/java/net/Indyuce/mmoitems/stat/StaffSpiritStat.java index 418d2a59..5e95f541 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/StaffSpiritStat.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/StaffSpiritStat.java @@ -9,6 +9,7 @@ import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder; import net.Indyuce.mmoitems.gui.edition.EditionInventory; import net.Indyuce.mmoitems.stat.data.StringData; import net.Indyuce.mmoitems.stat.data.type.StatData; +import net.Indyuce.mmoitems.stat.type.GemStoneStat; import net.Indyuce.mmoitems.stat.type.StringStat; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/net/Indyuce/mmoitems/stat/type/ExternalStat.java b/src/main/java/net/Indyuce/mmoitems/stat/type/ExternalStat.java deleted file mode 100644 index 33e9d269..00000000 --- a/src/main/java/net/Indyuce/mmoitems/stat/type/ExternalStat.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.Indyuce.mmoitems.stat.type; - -/** - * Stats are marked externals when refering to item templates options: - * - {@link net.Indyuce.mmoitems.stat.BrowserDisplayIDX} - * - {@link} - *

- * These stats do not save any information in the item NBT - */ -public interface ExternalStat { -} diff --git a/src/main/java/net/Indyuce/mmoitems/stat/type/StringStat.java b/src/main/java/net/Indyuce/mmoitems/stat/type/StringStat.java index baedd2be..9990207f 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/type/StringStat.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/type/StringStat.java @@ -21,7 +21,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; -public class StringStat extends ItemStat implements GemStoneStat { +public class StringStat extends ItemStat { public StringStat(String id, Material mat, String name, String[] lore, String[] types, Material... materials) { super(id, mat, name, lore, types, materials); } diff --git a/src/main/java/net/Indyuce/mmoitems/stat/type/TemplateOption.java b/src/main/java/net/Indyuce/mmoitems/stat/type/TemplateOption.java new file mode 100644 index 00000000..9aa1599a --- /dev/null +++ b/src/main/java/net/Indyuce/mmoitems/stat/type/TemplateOption.java @@ -0,0 +1,50 @@ +package net.Indyuce.mmoitems.stat.type; + +import io.lumine.mythic.lib.api.item.ItemTag; +import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder; +import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem; +import net.Indyuce.mmoitems.stat.data.StringData; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; + +/** + * Stats are marked externals when refering to item templates options: + * - {@link net.Indyuce.mmoitems.stat.BrowserDisplayIDX} + * - {@link} + *

+ * These stats do not save any information in the item NBT + */ +public interface TemplateOption { + + /** + * This stat is not saved onto items. This method is empty. + */ + public default void whenLoaded(@NotNull ReadMMOItem mmoitem) { + throw new RuntimeException("Not supported"); + } + + /** + * This stat is not saved onto items. This method always returns null + */ + @Nullable + public default StringData getLoadedNBT(@NotNull ArrayList storedTags) { + throw new RuntimeException("Not supported"); + } + + /** + * This stat is not saved onto items. This method is empty. + */ + public default void whenApplied(@NotNull ItemStackBuilder item, @NotNull StringData data) { + throw new RuntimeException("Not supported"); + } + + /** + * This stat is not saved onto items. This method returns an empty array. + */ + @NotNull + public default ArrayList getAppliedNBT(@NotNull StringData data) { + throw new RuntimeException("Not supported"); + } +}