Fixed string stats being gem stone stats

This commit is contained in:
Indyuce 2022-07-25 19:57:10 +02:00
parent cd19e679a2
commit 9551b04965
17 changed files with 114 additions and 59 deletions

View File

@ -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

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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 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();
}
/**
* This stat is not saved onto items. This method is empty.
*/
@Override
public void whenLoaded(@NotNull ReadMMOItem mmoitem) { }
public void whenLoaded(@NotNull ReadMMOItem mmoitem) {
throw new RuntimeException("Not supported");
}
/**
* This stat is not saved onto items. This method always returns null
*/
@Nullable
@Override
public StringData getLoadedNBT(@NotNull ArrayList<ItemTag> storedTags) { return null; }
public StringData getLoadedNBT(@NotNull ArrayList<ItemTag> storedTags) {
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) { }
public 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
@Override public ArrayList<ItemTag> getAppliedNBT(@NotNull StringData data) { return new ArrayList<>(); }
public ArrayList<ItemTag> getAppliedNBT(@NotNull StringData data) {
throw new RuntimeException("Not supported");
}
}

View File

@ -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"});
}
}

View File

@ -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" });
}

View File

@ -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." },

View File

@ -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" });

View File

@ -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" },

View File

@ -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" });

View File

@ -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" });
}

View File

@ -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"});
}

View File

@ -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;

View File

@ -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}
* <p>
* These stats do not save any information in the item NBT
*/
public interface ExternalStat {
}

View File

@ -21,7 +21,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class StringStat extends ItemStat<StringData, StringData> implements GemStoneStat {
public class StringStat extends ItemStat<StringData, StringData> {
public StringStat(String id, Material mat, String name, String[] lore, String[] types, Material... materials) {
super(id, mat, name, lore, types, materials);
}

View File

@ -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}
* <p>
* 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<ItemTag> 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<ItemTag> getAppliedNBT(@NotNull StringData data) {
throw new RuntimeException("Not supported");
}
}