diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/EcoArmorPlugin.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/EcoArmorPlugin.java index 9dff2d0..d6189cb 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/EcoArmorPlugin.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/EcoArmorPlugin.java @@ -10,6 +10,7 @@ import com.willfp.ecoarmor.commands.CommandEareload; import com.willfp.ecoarmor.commands.TabcompleterEagive; import com.willfp.ecoarmor.conditions.Conditions; import com.willfp.ecoarmor.config.SetsJson; +import com.willfp.ecoarmor.config.TiersJson; import com.willfp.ecoarmor.display.ArmorDisplay; import com.willfp.ecoarmor.effects.Effect; import com.willfp.ecoarmor.effects.Effects; @@ -43,6 +44,12 @@ public class EcoArmorPlugin extends EcoPlugin { @Getter private final SetsJson setsJson; + /** + * tiers.json. + */ + @Getter + private final TiersJson tiersJson; + /** * Internal constructor called by bukkit on plugin load. */ @@ -51,6 +58,7 @@ public class EcoArmorPlugin extends EcoPlugin { instance = this; this.setsJson = new SetsJson(this); + this.tiersJson = new TiersJson(this); } /** diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEagive.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEagive.java index e748222..a8cacdf 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEagive.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEagive.java @@ -127,7 +127,7 @@ public class CommandEagive extends AbstractCommand { } if (tier == null) { - tier = Tiers.DEFAULT; + tier = Tiers.getDefaultTier(); } for (ArmorSlot slot : slots) { diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/BaseEcoArmorConfig.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/BaseEcoArmorConfig.java deleted file mode 100644 index 0affa15..0000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/BaseEcoArmorConfig.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.willfp.ecoarmor.config; - -import com.willfp.eco.core.config.ExtendableConfig; -import com.willfp.ecoarmor.EcoArmorPlugin; -import org.jetbrains.annotations.NotNull; - -public class BaseEcoArmorConfig extends ExtendableConfig { - /** - * Create new ArmorSet config. - * - * @param configName The name of the config. - */ - public BaseEcoArmorConfig(@NotNull final String configName) { - super(configName, true, EcoArmorPlugin.getInstance(), EcoArmorPlugin.class, "sets/"); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/BaseTierConfig.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/BaseTierConfig.java deleted file mode 100644 index 9644bc3..0000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/BaseTierConfig.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.willfp.ecoarmor.config; - -import com.willfp.eco.core.config.ExtendableConfig; -import com.willfp.ecoarmor.EcoArmorPlugin; -import org.jetbrains.annotations.NotNull; - -public class BaseTierConfig extends ExtendableConfig { - /** - * Create new ArmorSet config. - * - * @param configName The name of the config. - */ - public BaseTierConfig(@NotNull final String configName) { - super(configName, true, EcoArmorPlugin.getInstance(), EcoArmorPlugin.class, "tiers/"); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/CustomConfig.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/CustomConfig.java deleted file mode 100644 index 877c8b0..0000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/CustomConfig.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoarmor.config; - -import com.willfp.eco.core.config.YamlConfig; -import org.bukkit.configuration.file.YamlConfiguration; -import org.jetbrains.annotations.NotNull; - -public class CustomConfig extends YamlConfig { - /** - * The config name. - */ - private final String configName; - - /** - * Create new custom config. - * - * @param configName The name of the config. - * @param config The config. - */ - public CustomConfig(@NotNull final String configName, - @NotNull final YamlConfiguration config) { - super(config); - this.configName = configName; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/TiersJson.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/TiersJson.java new file mode 100644 index 0000000..669eee1 --- /dev/null +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/TiersJson.java @@ -0,0 +1,16 @@ +package com.willfp.ecoarmor.config; + +import com.willfp.eco.core.EcoPlugin; +import com.willfp.eco.core.config.JsonStaticBaseConfig; +import org.jetbrains.annotations.NotNull; + +public class TiersJson extends JsonStaticBaseConfig { + /** + * Create tiers.json. + * + * @param plugin Instance of EcoArmor. + */ + public TiersJson(@NotNull final EcoPlugin plugin) { + super("tiers", plugin); + } +} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSet.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSet.java index b2c6ee2..a7f3689 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSet.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSet.java @@ -1,21 +1,58 @@ package com.willfp.ecoarmor.sets; +import com.willfp.eco.core.EcoPlugin; +import com.willfp.eco.core.config.Config; +import com.willfp.eco.core.config.JSONConfig; +import com.willfp.eco.core.display.Display; +import com.willfp.eco.core.items.CustomItem; +import com.willfp.eco.core.items.builder.ItemBuilder; +import com.willfp.eco.core.items.builder.ItemStackBuilder; +import com.willfp.eco.core.items.builder.LeatherArmorBuilder; +import com.willfp.eco.core.items.builder.SkullBuilder; +import com.willfp.eco.core.recipe.Recipes; import com.willfp.ecoarmor.conditions.Condition; +import com.willfp.ecoarmor.conditions.Conditions; import com.willfp.ecoarmor.effects.Effect; +import com.willfp.ecoarmor.effects.Effects; import com.willfp.ecoarmor.sets.meta.ArmorSlot; -import lombok.AllArgsConstructor; +import com.willfp.ecoarmor.sets.util.ArmorUtils; +import com.willfp.ecoarmor.upgrades.Tier; +import com.willfp.ecoarmor.upgrades.Tiers; +import lombok.AccessLevel; import lombok.Getter; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.persistence.PersistentDataType; import org.bukkit.potion.PotionEffectType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.stream.Collectors; -@AllArgsConstructor @SuppressWarnings("unchecked") public class ArmorSet { + /** + * Instance of EcoArmor. + */ + @Getter(AccessLevel.PRIVATE) + private final EcoPlugin plugin; + + /** + * The config of the set. + */ + @Getter(AccessLevel.PRIVATE) + private final JSONConfig config; + /** * The name of the set. */ @@ -26,31 +63,31 @@ public class ArmorSet { * Conditions and their values. */ @Getter - private final Map, Object> conditions; + private final Map, Object> conditions = new HashMap<>(); /** * Effects and their strengths. */ @Getter - private final Map, Object> effects; + private final Map, Object> effects = new HashMap<>(); /** * Effects and their strengths on advanced armor. */ @Getter - private final Map, Object> advancedEffects; + private final Map, Object> advancedEffects = new HashMap<>(); /** * Potion effects to be applied on equip. */ @Getter - private final Map potionEffects; + private final Map potionEffects = new HashMap<>(); /** * Potion effects to be applied on equipping advanced. */ @Getter - private final Map advancedPotionEffects; + private final Map advancedPotionEffects = new HashMap<>(); /** * The base64 texture of a skull used as a helmet. @@ -59,17 +96,17 @@ public class ArmorSet { */ @Getter @Nullable - private final String skullBase64; + private String skullBase64; /** * Items in set. */ - private final Map items; + private final Map items = new HashMap<>(); /** * Items in advanced set. */ - private final Map advancedItems; + private final Map advancedItems = new HashMap<>(); /** * Advancement shard item. @@ -77,6 +114,221 @@ public class ArmorSet { @Getter private final ItemStack advancementShardItem; + /** + * Create a new Armor Set. + * + * @param config The set's config. + * @param plugin Instance of EcoArmor. + */ + public ArmorSet(@NotNull final JSONConfig config, + @NotNull final EcoPlugin plugin) { + this.config = config; + this.plugin = plugin; + this.name = config.getString("name"); + + for (String definedKey : this.getConfig().getStrings("conditions")) { + String[] split = definedKey.split(":"); + String key = split[0].trim(); + String value = split[1].trim(); + Condition condition = Conditions.getByName(key); + if (condition == null) { + Bukkit.getLogger().warning("Invalid condition specified in " + this.name); + } else { + conditions.put(condition, ArmorUtils.getConditionValue(value, condition)); + } + } + + for (JSONConfig cfg : this.getConfig().getSubsections("effects")) { + Effect effect = Effects.getByName(cfg.getString("id")); + Object value = cfg.get("args"); + effects.put(effect, value); + } + + for (JSONConfig cfg : this.getConfig().getSubsections("advanced-effects")) { + Effect effect = Effects.getByName(cfg.getString("id")); + Object value = cfg.get("args"); + advancedEffects.put(effect, value); + } + + for (JSONConfig cfg : this.getConfig().getSubsections("potion-effects")) { + PotionEffectType effect = PotionEffectType.getByName(cfg.getString("id").toUpperCase()); + int level = cfg.getInt("level"); + potionEffects.put(effect, level); + } + + for (JSONConfig cfg : this.getConfig().getSubsections("advanced-potion-effects")) { + PotionEffectType effect = PotionEffectType.getByName(cfg.getString("id").toUpperCase()); + int level = cfg.getInt("level"); + advancedPotionEffects.put(effect, level); + } + + for (ArmorSlot slot : ArmorSlot.values()) { + ItemStack item = construct(slot, (JSONConfig) this.getConfig().getSubsection(slot.name().toLowerCase()), false); + items.put(slot, item); + if (this.getConfig().getBool("enabled")) { + constructRecipe(slot, this.getConfig().getSubsection(slot.name().toLowerCase()), item); + } + + ItemStack advancedItem = construct(slot, (JSONConfig) this.getConfig().getSubsection(slot.name().toLowerCase()), true); + advancedItems.put(slot, advancedItem); + } + + this.advancementShardItem = constructShard(); + } + + private ItemStack constructShard() { + ItemStack shard = new ItemStackBuilder(Objects.requireNonNull(Material.getMaterial(this.getPlugin().getConfigYml().getString("advancement-shard-material").toUpperCase()))) + .setDisplayName(this.getConfig().getString("advancement-shard-name")) + .addEnchantment(Enchantment.DURABILITY, 3) + .addItemFlag(ItemFlag.HIDE_ENCHANTS) + .addLoreLines(this.getConfig().getStrings("advancement-shard-lore")) + .writeMetaKey(this.getPlugin().getNamespacedKeyFactory().create("advancement-shard"), PersistentDataType.STRING, name) + .build(); + + if (this.getConfig().getBool("shard-craftable")) { + Recipes.createAndRegisterRecipe(this.getPlugin(), + this.getName() + "_shard", + shard, + this.getConfig().getStrings("shard-recipe")); + } + + return shard; + } + + private ItemStack construct(@NotNull final ArmorSlot slot, + @NotNull final JSONConfig slotConfig, + final boolean advanced) { + Material material = Material.getMaterial(slotConfig.getString("material").toUpperCase()); + + assert material != null; + + ItemBuilder builder; + + builder = switch (material) { + case PLAYER_HEAD -> new SkullBuilder(); + case LEATHER_HELMET, LEATHER_CHESTPLATE, LEATHER_LEGGINGS, LEATHER_BOOTS -> new LeatherArmorBuilder(material); + default -> new ItemStackBuilder(material); + }; + + builder.setDisplayName(advanced ? slotConfig.getString("advanced-name") : slotConfig.getString("name")) + .addItemFlag( + slotConfig.getStrings("flags").stream() + .map(s -> ItemFlag.valueOf(s.toUpperCase())) + .toArray(ItemFlag[]::new) + ) + .setUnbreakable(slotConfig.getBool("unbreakable")) + .addLoreLines(slotConfig.getStrings("lore").stream().map(s -> Display.PREFIX + s).collect(Collectors.toList())) + .addLoreLines(() -> { + if (advanced) { + return slotConfig.getStrings("advanced-lore").stream().map(s -> Display.PREFIX + s).collect(Collectors.toList()); + } else { + return null; + } + }) + .setCustomModelData(() -> { + int data = slotConfig.getInt("custom-model-data"); + return data != -1 ? data : null; + }) + .setDisplayName(() -> advanced ? slotConfig.getString("advanced-name") : slotConfig.getString("name")); + + + if (builder instanceof SkullBuilder skullBuilder) { + this.skullBase64 = slotConfig.getString("skull-texture"); + skullBuilder.setSkullTexture(skullBase64); + } + + if (builder instanceof LeatherArmorBuilder leatherArmorBuilder) { + String colorString = slotConfig.getString("leather-color"); + java.awt.Color awtColor = java.awt.Color.decode(colorString); + leatherArmorBuilder.setColor(awtColor); + builder.addItemFlag(ItemFlag.HIDE_DYE); + } + + + Map enchants = new HashMap<>(); + + for (JSONConfig enchantSection : slotConfig.getSubsections("enchants")) { + Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft(enchantSection.getString("id"))); + int level = enchantSection.getInt("level"); + enchants.put(enchantment, level); + } + + enchants.forEach(builder::addEnchantment); + + builder.writeMetaKey( + this.getPlugin().getNamespacedKeyFactory().create("set"), + PersistentDataType.STRING, + name + ).writeMetaKey( + this.getPlugin().getNamespacedKeyFactory().create("effective-durability"), + PersistentDataType.INTEGER, + slotConfig.getInt("effective-durability") + ); + + ItemStack itemStack = builder.build(); + + ArmorUtils.setAdvanced(itemStack, advanced); + Tier defaultTier = Tiers.getByName(slotConfig.getString("default-tier")); + if (defaultTier == null) { + Bukkit.getLogger().warning("Default tier specified in " + this.name + " " + slot.name().toLowerCase() + " is invalid! Defaulting to 'default'"); + ArmorUtils.setTier(itemStack, Tiers.getDefaultTier()); + } else { + ArmorUtils.setTier(itemStack, defaultTier); + } + + if (advanced) { + new CustomItem(this.getPlugin().getNamespacedKeyFactory().create("set_" + name.toLowerCase() + "_" + slot.name().toLowerCase() + "_advanced"), test -> { + if (ArmorSlot.getSlot(test) != ArmorSlot.getSlot(itemStack)) { + return false; + } + if (!ArmorUtils.isAdvanced(itemStack)) { + return false; + } + return Objects.equals(this.getName(), ArmorUtils.getSetOnItem(test).getName()); + }, itemStack).register(); + } else { + new CustomItem(this.getPlugin().getNamespacedKeyFactory().create("set_" + name.toLowerCase() + "_" + slot.name().toLowerCase()), test -> { + if (ArmorSlot.getSlot(test) != ArmorSlot.getSlot(itemStack)) { + return false; + } + if (ArmorUtils.isAdvanced(itemStack)) { + return false; + } + return Objects.equals(this.getName(), ArmorUtils.getSetOnItem(test).getName()); + }, itemStack).register(); + } + + return itemStack; + } + + private void constructRecipe(@NotNull final ArmorSlot slot, + @NotNull final Config slotConfig, + @NotNull final ItemStack out) { + if (slotConfig.getBool("craftable")) { + ItemStack formattedOut = out.clone(); + ItemMeta meta = formattedOut.getItemMeta(); + assert meta != null; + assert meta.getLore() != null; + + List lore = new ArrayList<>(); + + for (String s : meta.getLore()) { + s = s.replace("%tier%", Tiers.getDefaultTier().getDisplayName()); + lore.add(s); + } + + meta.setLore(lore); + formattedOut.setItemMeta(meta); + + Recipes.createAndRegisterRecipe( + this.getPlugin(), + this.getName() + "_" + slot.name().toLowerCase(), + formattedOut, + slotConfig.getStrings("recipe") + ); + } + } + /** * Get item stack from slot. * diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSetFactory.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSetFactory.java deleted file mode 100644 index d5ac28e..0000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSetFactory.java +++ /dev/null @@ -1,347 +0,0 @@ -package com.willfp.ecoarmor.sets; - -import com.willfp.eco.core.config.Config; -import com.willfp.eco.core.config.JSONConfig; -import com.willfp.eco.core.display.Display; -import com.willfp.eco.core.items.CustomItem; -import com.willfp.eco.core.items.builder.ItemBuilder; -import com.willfp.eco.core.items.builder.ItemStackBuilder; -import com.willfp.eco.core.items.builder.LeatherArmorBuilder; -import com.willfp.eco.core.items.builder.SkullBuilder; -import com.willfp.eco.core.recipe.Recipes; -import com.willfp.ecoarmor.EcoArmorPlugin; -import com.willfp.ecoarmor.conditions.Condition; -import com.willfp.ecoarmor.conditions.Conditions; -import com.willfp.ecoarmor.effects.Effect; -import com.willfp.ecoarmor.effects.Effects; -import com.willfp.ecoarmor.sets.meta.ArmorSlot; -import com.willfp.ecoarmor.sets.util.ArmorUtils; -import com.willfp.ecoarmor.upgrades.Tier; -import com.willfp.ecoarmor.upgrades.Tiers; -import lombok.AccessLevel; -import lombok.Getter; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.NamespacedKey; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemFlag; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.persistence.PersistentDataType; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -public class ArmorSetFactory { - - /** - * Instance of EcoArmor. - */ - private static final EcoArmorPlugin PLUGIN = EcoArmorPlugin.getInstance(); - - /** - * The name of the set. - */ - @Getter - private final String name; - - /** - * The config of the set. - */ - @Getter(AccessLevel.PRIVATE) - private final JSONConfig config; - - /** - * Conditions and their values. - */ - @Getter - private final Map, Object> conditions = new HashMap<>(); - - /** - * Effects and their strengths. - */ - @Getter - private final Map, Object> effects = new HashMap<>(); - - /** - * Effects and their strengths on advanced armor. - */ - @Getter - private final Map, Object> advancedEffects = new HashMap<>(); - - /** - * Potion effects to be applied on equip. - */ - @Getter - private final Map potionEffects = new HashMap<>(); - - /** - * Potion effects to be applied on equipping advanced. - */ - @Getter - private final Map advancedPotionEffects = new HashMap<>(); - - /** - * The base64 texture of a skull used as a helmet. - *

- * Null if no skull. - */ - @Getter - @Nullable - private String skullBase64; - - /** - * Items in set. - */ - private final Map items = new HashMap<>(); - - /** - * Items in advanced set. - */ - private final Map advancedItems = new HashMap<>(); - - /** - * Advancement shard item. - */ - @Getter - private final ItemStack advancementShardItem; - - /** - * Create a new Armor Set. - * - * @param config The set's config. - */ - public ArmorSetFactory(@NotNull final JSONConfig config) { - this.config = config; - this.name = config.getString("name"); - - for (String definedKey : this.getConfig().getStrings("conditions")) { - String[] split = definedKey.split(":"); - String key = split[0].trim(); - String value = split[1].trim(); - Condition condition = Conditions.getByName(key); - if (condition == null) { - Bukkit.getLogger().warning("Invalid condition specified in " + this.name); - } else { - conditions.put(condition, ArmorUtils.getConditionValue(value, condition)); - } - } - - for (JSONConfig cfg : this.getConfig().getSubsections("effects")) { - Effect effect = Effects.getByName(cfg.getString("id")); - Object value = cfg.get("args"); - effects.put(effect, value); - } - - for (JSONConfig cfg : this.getConfig().getSubsections("advanced-effects")) { - Effect effect = Effects.getByName(cfg.getString("id")); - Object value = cfg.get("args"); - advancedEffects.put(effect, value); - } - - for (JSONConfig cfg : this.getConfig().getSubsections("potion-effects")) { - PotionEffectType effect = PotionEffectType.getByName(cfg.getString("id").toUpperCase()); - int level = cfg.getInt("level"); - potionEffects.put(effect, level); - } - - for (JSONConfig cfg : this.getConfig().getSubsections("advanced-potion-effects")) { - PotionEffectType effect = PotionEffectType.getByName(cfg.getString("id").toUpperCase()); - int level = cfg.getInt("level"); - advancedPotionEffects.put(effect, level); - } - - for (ArmorSlot slot : ArmorSlot.values()) { - ItemStack item = construct(slot, (JSONConfig) this.getConfig().getSubsection(slot.name().toLowerCase()), false); - items.put(slot, item); - if (this.getConfig().getBool("enabled")) { - constructRecipe(slot, this.getConfig().getSubsection(slot.name().toLowerCase()), item); - } - - ItemStack advancedItem = construct(slot, (JSONConfig) this.getConfig().getSubsection(slot.name().toLowerCase()), true); - advancedItems.put(slot, advancedItem); - } - - this.advancementShardItem = constructShard(); - } - - private ItemStack constructShard() { - ItemStack shard = new ItemStackBuilder(Objects.requireNonNull(Material.getMaterial(PLUGIN.getConfigYml().getString("advancement-shard-material").toUpperCase()))) - .setDisplayName(this.getConfig().getString("advancement-shard-name")) - .addEnchantment(Enchantment.DURABILITY, 3) - .addItemFlag(ItemFlag.HIDE_ENCHANTS) - .addLoreLines(this.getConfig().getStrings("advancement-shard-lore")) - .writeMetaKey(PLUGIN.getNamespacedKeyFactory().create("advancement-shard"), PersistentDataType.STRING, name) - .build(); - - if (this.getConfig().getBool("shard-craftable")) { - Recipes.createAndRegisterRecipe(PLUGIN, - this.getName() + "_shard", - shard, - this.getConfig().getStrings("shard-recipe")); - } - - return shard; - } - - private ItemStack construct(@NotNull final ArmorSlot slot, - @NotNull final JSONConfig slotConfig, - final boolean advanced) { - Material material = Material.getMaterial(slotConfig.getString("material").toUpperCase()); - - assert material != null; - - ItemBuilder builder; - - builder = switch (material) { - case PLAYER_HEAD -> new SkullBuilder(); - case LEATHER_HELMET, LEATHER_CHESTPLATE, LEATHER_LEGGINGS, LEATHER_BOOTS -> new LeatherArmorBuilder(material); - default -> new ItemStackBuilder(material); - }; - - builder.setDisplayName(advanced ? slotConfig.getString("advanced-name") : slotConfig.getString("name")) - .addItemFlag( - slotConfig.getStrings("flags").stream() - .map(s -> ItemFlag.valueOf(s.toUpperCase())) - .toArray(ItemFlag[]::new) - ) - .setUnbreakable(slotConfig.getBool("unbreakable")) - .addLoreLines(slotConfig.getStrings("lore").stream().map(s -> Display.PREFIX + s).collect(Collectors.toList())) - .addLoreLines(() -> { - if (advanced) { - return slotConfig.getStrings("advanced-lore").stream().map(s -> Display.PREFIX + s).collect(Collectors.toList()); - } else { - return null; - } - }) - .setCustomModelData(() -> { - int data = slotConfig.getInt("custom-model-data"); - return data != -1 ? data : null; - }) - .setDisplayName(() -> advanced ? slotConfig.getString("advanced-name") : slotConfig.getString("name")); - - - if (builder instanceof SkullBuilder skullBuilder) { - this.skullBase64 = slotConfig.getString("skull-texture"); - skullBuilder.setSkullTexture(skullBase64); - } - - if (builder instanceof LeatherArmorBuilder leatherArmorBuilder) { - String colorString = slotConfig.getString("leather-color"); - java.awt.Color awtColor = java.awt.Color.decode(colorString); - leatherArmorBuilder.setColor(awtColor); - builder.addItemFlag(ItemFlag.HIDE_DYE); - } - - - Map enchants = new HashMap<>(); - - for (JSONConfig enchantSection : slotConfig.getSubsections("enchants")) { - Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft(enchantSection.getString("id"))); - int level = enchantSection.getInt("level"); - enchants.put(enchantment, level); - } - - enchants.forEach(builder::addEnchantment); - - builder.writeMetaKey( - PLUGIN.getNamespacedKeyFactory().create("set"), - PersistentDataType.STRING, - name - ).writeMetaKey( - PLUGIN.getNamespacedKeyFactory().create("effective-durability"), - PersistentDataType.INTEGER, - slotConfig.getInt("effective-durability") - ); - - ItemStack itemStack = builder.build(); - - ArmorUtils.setAdvanced(itemStack, advanced); - Tier defaultTier = Tiers.getByName(slotConfig.getString("default-tier")); - if (defaultTier == null) { - Bukkit.getLogger().warning("Default tier specified in " + this.name + " " + slot.name().toLowerCase() + " is invalid! Defaulting to 'default'"); - ArmorUtils.setTier(itemStack, Tiers.DEFAULT); - } else { - ArmorUtils.setTier(itemStack, defaultTier); - } - - if (advanced) { - new CustomItem(PLUGIN.getNamespacedKeyFactory().create("set_" + name.toLowerCase() + "_" + slot.name().toLowerCase() + "_advanced"), test -> { - if (ArmorSlot.getSlot(test) != ArmorSlot.getSlot(itemStack)) { - return false; - } - if (!ArmorUtils.isAdvanced(itemStack)) { - return false; - } - return Objects.equals(this.getName(), ArmorUtils.getSetOnItem(test).getName()); - }, itemStack).register(); - } else { - new CustomItem(PLUGIN.getNamespacedKeyFactory().create("set_" + name.toLowerCase() + "_" + slot.name().toLowerCase()), test -> { - if (ArmorSlot.getSlot(test) != ArmorSlot.getSlot(itemStack)) { - return false; - } - if (ArmorUtils.isAdvanced(itemStack)) { - return false; - } - return Objects.equals(this.getName(), ArmorUtils.getSetOnItem(test).getName()); - }, itemStack).register(); - } - - return itemStack; - } - - private void constructRecipe(@NotNull final ArmorSlot slot, - @NotNull final Config slotConfig, - @NotNull final ItemStack out) { - if (slotConfig.getBool("craftable")) { - ItemStack formattedOut = out.clone(); - ItemMeta meta = formattedOut.getItemMeta(); - assert meta != null; - assert meta.getLore() != null; - - List lore = new ArrayList<>(); - - for (String s : meta.getLore()) { - s = s.replace("%tier%", Tiers.DEFAULT.getDisplayName()); - lore.add(s); - } - - meta.setLore(lore); - formattedOut.setItemMeta(meta); - - Recipes.createAndRegisterRecipe( - PLUGIN, - this.getName() + "_" + slot.name().toLowerCase(), - formattedOut, - slotConfig.getStrings("recipe") - ); - } - } - - /** - * Create the Armor Set. - * - * @return The set. - */ - public ArmorSet create() { - return new ArmorSet( - name, - conditions, - effects, - advancedEffects, - potionEffects, - advancedPotionEffects, - skullBase64, - items, - advancedItems, - advancementShardItem - ); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSets.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSets.java index c979c1f..b260fef 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSets.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSets.java @@ -15,11 +15,6 @@ import java.util.List; @UtilityClass public class ArmorSets { - /** - * Instance of EcoArmor. - */ - private static final EcoArmorPlugin PLUGIN = EcoArmorPlugin.getInstance(); - /** * Registered armor sets. */ @@ -47,15 +42,17 @@ public class ArmorSets { /** * Update all {@link ArmorSet}s. + * + * @param plugin Instance of EcoArmor. */ @ConfigUpdater - public static void update() { + public static void update(@NotNull final EcoArmorPlugin plugin) { for (ArmorSet set : values()) { removeSet(set); } - for (JSONConfig setConfig : PLUGIN.getSetsJson().getSubsections("sets")) { - addNewSet(new ArmorSetFactory(setConfig).create()); + for (JSONConfig setConfig : plugin.getSetsJson().getSubsections("sets")) { + addNewSet(new ArmorSet(setConfig, plugin)); } } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/util/ArmorUtils.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/util/ArmorUtils.java index 230e263..5f339d7 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/util/ArmorUtils.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/util/ArmorUtils.java @@ -178,8 +178,8 @@ public class ArmorUtils { Tier tier = getTier(meta); if (getSetOnItem(meta) != null && tier == null) { - setTier(itemStack, Tiers.DEFAULT); - return Tiers.DEFAULT; + setTier(itemStack, Tiers.getDefaultTier()); + return Tiers.getDefaultTier(); } else { return tier; } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/upgrades/Tier.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/upgrades/Tier.java index c2e93cc..c08948a 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/upgrades/Tier.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/upgrades/Tier.java @@ -3,6 +3,7 @@ package com.willfp.ecoarmor.upgrades; import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.PluginDependent; import com.willfp.eco.core.config.Config; +import com.willfp.eco.core.config.JSONConfig; import com.willfp.eco.core.display.Display; import com.willfp.eco.core.items.CustomItem; import com.willfp.eco.core.items.Items; @@ -79,21 +80,15 @@ public class Tier extends PluginDependent { /** * Create a new Tier. * - * @param tierName The name of the tier. - * @param config The config of the tier. - * @param plugin Instance of EcoArmor. + * @param config The config of the tier. + * @param plugin Instance of EcoArmor. */ - public Tier(@NotNull final String tierName, - @NotNull final Config config, + public Tier(@NotNull final JSONConfig config, @NotNull final EcoPlugin plugin) { super(plugin); - this.name = tierName; + this.name = config.getString("name"); this.config = config; - if (!this.config.getBool("enabled") && !this.getName().equalsIgnoreCase("default")) { - return; - } - Tiers.addNewTier(this); this.update(); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/upgrades/Tiers.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/upgrades/Tiers.java index c117e50..e4cfe65 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/upgrades/Tiers.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/upgrades/Tiers.java @@ -4,50 +4,27 @@ import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.google.common.collect.ImmutableList; import com.willfp.eco.core.config.ConfigUpdater; +import com.willfp.eco.core.config.JSONConfig; import com.willfp.ecoarmor.EcoArmorPlugin; -import com.willfp.ecoarmor.config.BaseTierConfig; -import com.willfp.ecoarmor.config.CustomConfig; +import lombok.Getter; import lombok.experimental.UtilityClass; -import org.bukkit.configuration.file.YamlConfiguration; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Arrays; import java.util.List; @UtilityClass public class Tiers { - /** - * Instance of EcoArmor. - */ - private static final EcoArmorPlugin PLUGIN = EcoArmorPlugin.getInstance(); - /** * Registered tiers. */ private static final BiMap BY_NAME = HashBiMap.create(); - /** - * Tiers that exist by default. - */ - private static final List DEFAULT_TIER_NAMES = Arrays.asList( - "iron", - "diamond", - "netherite", - "manyullyn", - "cobalt", - "osmium", - "exotic" - ); - /** * Default tier. */ - public static final Tier DEFAULT = new Tier("default", new BaseTierConfig("default"), PLUGIN); + @Getter + private static Tier defaultTier; /** * Get {@link Tiers} matching name. @@ -81,32 +58,21 @@ public class Tiers { /** * Update. + * + * @param plugin Instance of EcoArmor. */ @ConfigUpdater - public static void reload() { + public static void reload(@NotNull final EcoArmorPlugin plugin) { BY_NAME.clear(); - for (String defaultSetName : DEFAULT_TIER_NAMES) { - new Tier(defaultSetName, new BaseTierConfig(defaultSetName), PLUGIN); + for (JSONConfig tierConfig : plugin.getSetsJson().getSubsections("tiers")) { + addNewTier(new Tier(tierConfig, plugin)); } - try { - Files.walk(Paths.get(new File(EcoArmorPlugin.getInstance().getDataFolder(), "tiers/").toURI())) - .filter(Files::isRegularFile) - .forEach(path -> { - String name = path.getFileName().toString().replace(".yml", ""); - new Tier( - name, - new CustomConfig(name, YamlConfiguration.loadConfiguration(path.toFile())), - PLUGIN - ); - }); - } catch (IOException e) { - e.printStackTrace(); - } + defaultTier = Tiers.getByName("default"); } static { - reload(); + reload(EcoArmorPlugin.getInstance()); } } diff --git a/eco-core/core-plugin/src/main/resources/tiers.json b/eco-core/core-plugin/src/main/resources/tiers.json new file mode 100644 index 0000000..dcb5884 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/tiers.json @@ -0,0 +1,601 @@ +{ + "tiers": [ + { + "name": "default", + "display": "&8&lDEFAULT", + "requires-tiers": [], + "crystal-craftable": false, + "crystal-name": "&8Default Upgrade Crystal", + "crystal-recipe": [ + "air", + "leather", + "air", + "leather", + "leather_chestplate", + "leather", + "air", + "leather", + "air" + ], + "recipe-give-amount": 1, + "crystal-lore": [ + "&8Drop this onto an armor piece", + "&8to set its tier to:", + "&8&lDEFAULT" + ], + "properties": { + "helmet": { + "armor": 1, + "toughness": 0, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "chestplate": { + "armor": 3, + "toughness": 0, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "elytra": { + "armor": 0, + "toughness": 0, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "leggings": { + "armor": 2, + "toughness": 0, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "boots": { + "armor": 1, + "toughness": 0, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + } + } + }, + { + "name": "iron", + "display": "&7&lIRON", + "requires-tiers": [ + "default" + ], + "crystal-craftable": true, + "crystal-name": "&7Iron Upgrade Crystal", + "crystal-recipe": [ + "air", + "iron_block", + "air", + "iron_block", + "leather_chestplate", + "iron_block", + "air", + "iron_block", + "air" + ], + "recipe-give-amount": 1, + "crystal-lore": [ + "&8Drop this onto an armor piece", + "&8to set its tier to:", + "&7&lIRON", + "", + "&8&oRequires the armor to already have default tier" + ], + "properties": { + "helmet": { + "armor": 2, + "toughness": 0, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "chestplate": { + "armor": 6, + "toughness": 0, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "elytra": { + "armor": 2, + "toughness": 0, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "leggings": { + "armor": 5, + "toughness": 0, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "boots": { + "armor": 2, + "toughness": 0, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + } + } + }, + { + "name": "diamond", + "display": "&b&lDIAMOND", + "requires-tiers": [ + "iron" + ], + "crystal-craftable": true, + "crystal-name": "&bDiamond Upgrade Crystal", + "crystal-recipe": [ + "air", + "diamond_block", + "air", + "diamond_block", + "ecoarmor:upgrade_crystal_iron", + "diamond_block", + "air", + "diamond_block", + "air" + ], + "recipe-give-amount": 1, + "crystal-lore": [ + "&8Drop this onto an armor piece", + "&8to set its tier to:", + "&b&lDIAMOND", + "", + "&8&oRequires the armor to already have Iron tier" + ], + "properties": { + "helmet": { + "armor": 3, + "toughness": 2, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "chestplate": { + "armor": 8, + "toughness": 2, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "elytra": { + "armor": 3, + "toughness": 0, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "leggings": { + "armor": 6, + "toughness": 2, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "boots": { + "armor": 3, + "toughness": 2, + "knockback-resistance": 0, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + } + } + }, + { + "name": "netherite", + "display": "&c&lNETHERITE", + "requires-tiers": [ + "diamond" + ], + "crystal-craftable": true, + "crystal-name": "&cNetherite Upgrade Crystal", + "crystal-recipe": [ + "air", + "netherite_ingot", + "air", + "netherite_ingot", + "ecoarmor:upgrade_crystal_diamond", + "netherite_ingot", + "air", + "netherite_ingot", + "air" + ], + "recipe-give-amount": 1, + "crystal-lore": [ + "&8Drop this onto an armor piece", + "&8to set its tier to:", + "&c&lNETHERITE", + "", + "&8&oRequires the armor to already have Diamond tier" + ], + "properties": { + "helmet": { + "armor": 3, + "toughness": 3, + "knockback-resistance": 1, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "chestplate": { + "armor": 8, + "toughness": 3, + "knockback-resistance": 1, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "elytra": { + "armor": 3, + "toughness": 0, + "knockback-resistance": 1, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "leggings": { + "armor": 6, + "toughness": 3, + "knockback-resistance": 1, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "boots": { + "armor": 3, + "toughness": 3, + "knockback-resistance": 1, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + } + } + }, + { + "name": "manyullyn", + "enabled": true, + "display": "&d&k!!&r &lMANYULLYN&r &d&k!!&r", + "requires-tiers": [ + "netherite" + ], + "crystal-craftable": true, + "crystal-name": "Manyullyn Upgrade Crystal", + "crystal-recipe": [ + "ecoarmor:upgrade_crystal_netherite", + "enchanted_golden_apple", + "ecoarmor:upgrade_crystal_netherite", + "enchanted_golden_apple", + "ecoarmor:upgrade_crystal_netherite", + "enchanted_golden_apple", + "ecoarmor:upgrade_crystal_netherite", + "enchanted_golden_apple", + "ecoarmor:upgrade_crystal_netherite" + ], + "recipe-give-amount": 1, + "crystal-lore": [ + "&8Drop this onto an armor piece", + "&8to set its tier to:", + "&d&k!!&r &lMANYULLYN&r &d&k!!&r", + "", + "&8&oRequires the armor to already have Netherite tier" + ], + "properties": { + "helmet": { + "armor": 3, + "toughness": 5, + "knockback-resistance": 2, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "chestplate": { + "armor": 8, + "toughness": 5, + "knockback-resistance": 2, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "elytra": { + "armor": 3, + "toughness": 0, + "knockback-resistance": 2, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "leggings": { + "armor": 6, + "toughness": 5, + "knockback-resistance": 2, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + }, + "boots": { + "armor": 3, + "toughness": 5, + "knockback-resistance": 2, + "speed-percentage": 0, + "attack-speed-percentage": 0, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 0 + } + } + }, + { + "name": "cobalt", + "display": "/ab&lCOBALT", + "requires-tiers": [ + "iron" + ], + "crystal-craftable": true, + "crystal-name": "/abCobalt Upgrade Crystal", + "crystal-recipe": [ + "air", + "obsidian", + "air", + "obsidian", + "ecoarmor:upgrade_crystal_iron", + "obsidian", + "air", + "obsidian", + "air" + ], + "recipe-give-amount": 1, + "crystal-lore": [ + "&8Drop this onto an armor piece", + "&8to set its tier to:", + "/ab&lCOBALT", + "", + "&8&oRequires the armor to already have Iron tier" + ], + "properties": { + "helmet": { + "armor": 3, + "toughness": 4, + "knockback-resistance": 1, + "speed-percentage": -10, + "attack-speed-percentage": -10, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 10 + }, + "chestplate": { + "armor": 8, + "toughness": 4, + "knockback-resistance": 1, + "speed-percentage": -10, + "attack-speed-percentage": -10, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 10 + }, + "elytra": { + "armor": 6, + "toughness": 2, + "knockback-resistance": 1, + "speed-percentage": -10, + "attack-speed-percentage": -10, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 10 + }, + "leggings": { + "armor": 6, + "toughness": 4, + "knockback-resistance": 1, + "speed-percentage": -10, + "attack-speed-percentage": -1, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 10 + }, + "boots": { + "armor": 3, + "toughness": 4, + "knockback-resistance": 1, + "speed-percentage": -10, + "attack-speed-percentage": -10, + "attack-damage-percentage": 0, + "attack-knockback-percentage": 10 + } + } + }, + { + "name": "osmium", + "display": "&b&k!!&r &lOSMIUM&r &b&k!!", + "requires-tiers": [ + "cobalt" + ], + "crystal-craftable": true, + "crystal-name": "Osmium upgrade crystal", + "crystal-recipe": [ + "air", + "netherite_block", + "air", + "netherite_block", + "ecoarmor:upgrade_crystal_cobalt", + "netherite_block", + "air", + "netherite_block", + "air" + ], + "recipe-give-amount": 1, + "crystal-lore": [ + "&8Drop this onto an armor piece", + "&8to set its tier to:", + "&b&k!!&r &lOSMIUM&r &b&k!!", + "", + "&8&oRequires the armor to already have Cobalt tier" + ], + "properties": { + "helmet": { + "armor": 3, + "toughness": 6, + "knockback-resistance": 3, + "speed-percentage": -15, + "attack-speed-percentage": -15, + "attack-damage-percentage": 5, + "attack-knockback-percentage": 25 + }, + "chestplate": { + "armor": 8, + "toughness": 6, + "knockback-resistance": 3, + "speed-percentage": -15, + "attack-speed-percentage": -15, + "attack-damage-percentage": 5, + "attack-knockback-percentage": 25 + }, + "elytra": { + "armor": 8, + "toughness": 6, + "knockback-resistance": 3, + "speed-percentage": -15, + "attack-speed-percentage": -15, + "attack-damage-percentage": 5, + "attack-knockback-percentage": 25 + }, + "leggings": { + "armor": 6, + "toughness": 6, + "knockback-resistance": 3, + "speed-percentage": -15, + "attack-speed-percentage": -15, + "attack-damage-percentage": 5, + "attack-knockback-percentage": 25 + }, + "boots": { + "armor": 3, + "toughness": 6, + "knockback-resistance": 3, + "speed-percentage": -15, + "attack-speed-percentage": -15, + "attack-damage-percentage": 5, + "attack-knockback-percentage": 25 + } + } + }, + { + "name": "exotic", + "display": "&6&k!!&r &lEXOTIC&r &6&k!!&r", + "requires-tiers": [ + "netherite" + ], + "crystal-craftable": true, + "crystal-name": "Exotic Upgrade Crystal", + "crystal-recipe": [ + "ecoarmor:upgrade_crystal_netherite", + "turtle_egg", + "ecoarmor:upgrade_crystal_netherite", + "turtle_egg", + "ecoarmor:upgrade_crystal_cobalt", + "turtle_egg", + "ecoarmor:upgrade_crystal_netherite", + "turtle_egg", + "ecoarmor:upgrade_crystal_netherite" + ], + "recipe-give-amount": 1, + "crystal-lore": [ + "&8Drop this onto an armor piece", + "&8to set its tier to:", + "&6&k!!&r &lEXOTIC&r &6&k!!&r", + "", + "&8&oRequires the armor to already have Netherite tier" + ], + "properties": { + "helmet": { + "armor": 3, + "toughness": 2, + "knockback-resistance": 0, + "speed-percentage": 5, + "attack-speed-percentage": 10, + "attack-damage-percentage": -5, + "attack-knockback-percentage": -20 + }, + "chestplate": { + "armor": 8, + "toughness": 2, + "knockback-resistance": 0, + "speed-percentage": 5, + "attack-speed-percentage": 10, + "attack-damage-percentage": -5, + "attack-knockback-percentage": -20 + }, + "elytra": { + "armor": 3, + "toughness": 0, + "knockback-resistance": 0, + "speed-percentage": 5, + "attack-speed-percentage": 10, + "attack-damage-percentage": -5, + "attack-knockback-percentage": -20 + }, + "leggings": { + "armor": 6, + "toughness": 2, + "knockback-resistance": 0, + "speed-percentage": 5, + "attack-speed-percentage": 10, + "attack-damage-percentage": -5, + "attack-knockback-percentage": -20 + }, + "boots": { + "armor": 3, + "toughness": 2, + "knockback-resistance": 0, + "speed-percentage": 5, + "attack-speed-percentage": 10, + "attack-damage-percentage": -5, + "attack-knockback-percentage": -20 + } + } + } + ] +} \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/tiers/cobalt.yml b/eco-core/core-plugin/src/main/resources/tiers/cobalt.yml deleted file mode 100644 index 9d82028..0000000 --- a/eco-core/core-plugin/src/main/resources/tiers/cobalt.yml +++ /dev/null @@ -1,66 +0,0 @@ -enabled: true -display: "/ab&lCOBALT" -requires-tiers: # Leave empty to always allow application - - iron -crystal-craftable: true -crystal-name: "/abCobalt Upgrade Crystal" -crystal-recipe: - - air - - obsidian - - air - - - obsidian - - ecoarmor:upgrade_crystal_iron - - obsidian - - - air - - obsidian - - air -recipe-give-amount: 1 -crystal-lore: - - "&8Drop this onto an armor piece" - - "&8to set its tier to:" - - "/ab&lCOBALT" - - "" - - "&8&oRequires the armor to already have Iron tier" -properties: - helmet: - armor: 3 - toughness: 4 - knockback-resistance: 1 - speed-percentage: -10 - attack-speed-percentage: -10 - attack-damage-percentage: 0 - attack-knockback-percentage: 10 - chestplate: - armor: 8 - toughness: 4 - knockback-resistance: 1 - speed-percentage: -10 - attack-speed-percentage: -10 - attack-damage-percentage: 0 - attack-knockback-percentage: 10 - elytra: - armor: 6 - toughness: 2 - knockback-resistance: 1 - speed-percentage: -10 - attack-speed-percentage: -10 - attack-damage-percentage: 0 - attack-knockback-percentage: 10 - leggings: - armor: 6 - toughness: 4 - knockback-resistance: 1 - speed-percentage: -10 - attack-speed-percentage: -1 - attack-damage-percentage: 0 - attack-knockback-percentage: 10 - boots: - armor: 3 - toughness: 4 - knockback-resistance: 1 - speed-percentage: -10 - attack-speed-percentage: -10 - attack-damage-percentage: 0 - attack-knockback-percentage: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/tiers/default.yml b/eco-core/core-plugin/src/main/resources/tiers/default.yml deleted file mode 100644 index 6645637..0000000 --- a/eco-core/core-plugin/src/main/resources/tiers/default.yml +++ /dev/null @@ -1,62 +0,0 @@ -display: "&8&lDEFAULT" -requires-tiers: [] # Leave empty to always allow application -crystal-craftable: false -crystal-name: "&8Default Upgrade Crystal" -crystal-recipe: - - air - - leather - - air - - - leather - - leather_chestplate - - leather - - - air - - leather - - air -recipe-give-amount: 1 -crystal-lore: - - "&8Drop this onto an armor piece" - - "&8to set its tier to:" - - "&8&lDEFAULT" -properties: - helmet: - armor: 1 - toughness: 0 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - chestplate: - armor: 3 - toughness: 0 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - elytra: - armor: 0 - toughness: 0 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - leggings: - armor: 2 - toughness: 0 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - boots: - armor: 1 - toughness: 0 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/tiers/diamond.yml b/eco-core/core-plugin/src/main/resources/tiers/diamond.yml deleted file mode 100644 index aaf7933..0000000 --- a/eco-core/core-plugin/src/main/resources/tiers/diamond.yml +++ /dev/null @@ -1,66 +0,0 @@ -enabled: true -display: "&b&lDIAMOND" -requires-tiers: # Leave empty to always allow application - - iron -crystal-craftable: true -crystal-name: "&bDiamond Upgrade Crystal" -crystal-recipe: - - air - - diamond_block - - air - - - diamond_block - - ecoarmor:upgrade_crystal_iron - - diamond_block - - - air - - diamond_block - - air -recipe-give-amount: 1 -crystal-lore: - - "&8Drop this onto an armor piece" - - "&8to set its tier to:" - - "&b&lDIAMOND" - - "" - - "&8&oRequires the armor to already have Iron tier" -properties: - helmet: - armor: 3 - toughness: 2 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - chestplate: - armor: 8 - toughness: 2 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - elytra: - armor: 3 - toughness: 0 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - leggings: - armor: 6 - toughness: 2 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - boots: - armor: 3 - toughness: 2 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/tiers/exotic.yml b/eco-core/core-plugin/src/main/resources/tiers/exotic.yml deleted file mode 100644 index e315000..0000000 --- a/eco-core/core-plugin/src/main/resources/tiers/exotic.yml +++ /dev/null @@ -1,66 +0,0 @@ -enabled: true -display: "&6&k!!&r &lEXOTIC&r &6&k!!&r" -requires-tiers: # Leave empty to always allow application - - netherite -crystal-craftable: true -crystal-name: "Exotic Upgrade Crystal" -crystal-recipe: - - ecoarmor:upgrade_crystal_netherite - - turtle_egg - - ecoarmor:upgrade_crystal_netherite - - - turtle_egg - - ecoarmor:upgrade_crystal_cobalt - - turtle_egg - - - ecoarmor:upgrade_crystal_netherite - - turtle_egg - - ecoarmor:upgrade_crystal_netherite -recipe-give-amount: 1 -crystal-lore: - - "&8Drop this onto an armor piece" - - "&8to set its tier to:" - - "&6&k!!&r &lEXOTIC&r &6&k!!&r" - - "" - - "&8&oRequires the armor to already have Netherite tier" -properties: - helmet: - armor: 3 - toughness: 2 - knockback-resistance: 0 - speed-percentage: 5 - attack-speed-percentage: 10 - attack-damage-percentage: -5 - attack-knockback-percentage: -20 - chestplate: - armor: 8 - toughness: 2 - knockback-resistance: 0 - speed-percentage: 5 - attack-speed-percentage: 10 - attack-damage-percentage: -5 - attack-knockback-percentage: -20 - elytra: - armor: 3 - toughness: 0 - knockback-resistance: 0 - speed-percentage: 5 - attack-speed-percentage: 10 - attack-damage-percentage: -5 - attack-knockback-percentage: -20 - leggings: - armor: 6 - toughness: 2 - knockback-resistance: 0 - speed-percentage: 5 - attack-speed-percentage: 10 - attack-damage-percentage: -5 - attack-knockback-percentage: -20 - boots: - armor: 3 - toughness: 2 - knockback-resistance: 0 - speed-percentage: 5 - attack-speed-percentage: 10 - attack-damage-percentage: -5 - attack-knockback-percentage: -20 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/tiers/iron.yml b/eco-core/core-plugin/src/main/resources/tiers/iron.yml deleted file mode 100644 index 36fc5a2..0000000 --- a/eco-core/core-plugin/src/main/resources/tiers/iron.yml +++ /dev/null @@ -1,66 +0,0 @@ -enabled: true -display: "&7&lIRON" -requires-tiers: # Leave empty to always allow application - - default -crystal-craftable: true -crystal-name: "&7Iron Upgrade Crystal" -crystal-recipe: - - air - - iron_block - - air - - - iron_block - - leather_chestplate - - iron_block - - - air - - iron_block - - air -recipe-give-amount: 1 -crystal-lore: - - "&8Drop this onto an armor piece" - - "&8to set its tier to:" - - "&7&lIRON" - - "" - - "&8&oRequires the armor to already have default tier" -properties: - helmet: - armor: 2 - toughness: 0 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - chestplate: - armor: 6 - toughness: 0 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - elytra: - armor: 2 - toughness: 0 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - leggings: - armor: 5 - toughness: 0 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - boots: - armor: 2 - toughness: 0 - knockback-resistance: 0 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/tiers/manyullyn.yml b/eco-core/core-plugin/src/main/resources/tiers/manyullyn.yml deleted file mode 100644 index 0276abe..0000000 --- a/eco-core/core-plugin/src/main/resources/tiers/manyullyn.yml +++ /dev/null @@ -1,66 +0,0 @@ -enabled: true -display: "&d&k!!&r &lMANYULLYN&r &d&k!!&r" -requires-tiers: # Leave empty to always allow application - - netherite -crystal-craftable: true -crystal-name: "Manyullyn Upgrade Crystal" -crystal-recipe: - - ecoarmor:upgrade_crystal_netherite - - enchanted_golden_apple - - ecoarmor:upgrade_crystal_netherite - - - enchanted_golden_apple - - ecoarmor:upgrade_crystal_netherite - - enchanted_golden_apple - - - ecoarmor:upgrade_crystal_netherite - - enchanted_golden_apple - - ecoarmor:upgrade_crystal_netherite -recipe-give-amount: 1 -crystal-lore: - - "&8Drop this onto an armor piece" - - "&8to set its tier to:" - - "&d&k!!&r &lMANYULLYN&r &d&k!!&r" - - "" - - "&8&oRequires the armor to already have Netherite tier" -properties: - helmet: - armor: 3 - toughness: 5 - knockback-resistance: 2 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - chestplate: - armor: 8 - toughness: 5 - knockback-resistance: 2 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - elytra: - armor: 3 - toughness: 0 - knockback-resistance: 2 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - leggings: - armor: 6 - toughness: 5 - knockback-resistance: 2 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - boots: - armor: 3 - toughness: 5 - knockback-resistance: 2 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/tiers/netherite.yml b/eco-core/core-plugin/src/main/resources/tiers/netherite.yml deleted file mode 100644 index 8782729..0000000 --- a/eco-core/core-plugin/src/main/resources/tiers/netherite.yml +++ /dev/null @@ -1,66 +0,0 @@ -enabled: true -display: "&c&lNETHERITE" -requires-tiers: # Leave empty to always allow application - - diamond -crystal-craftable: true -crystal-name: "&cNetherite Upgrade Crystal" -crystal-recipe: - - air - - netherite_ingot - - air - - - netherite_ingot - - ecoarmor:upgrade_crystal_diamond - - netherite_ingot - - - air - - netherite_ingot - - air -recipe-give-amount: 1 -crystal-lore: - - "&8Drop this onto an armor piece" - - "&8to set its tier to:" - - "&c&lNETHERITE" - - "" - - "&8&oRequires the armor to already have Diamond tier" -properties: - helmet: - armor: 3 - toughness: 3 - knockback-resistance: 1 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - chestplate: - armor: 8 - toughness: 3 - knockback-resistance: 1 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - elytra: - armor: 3 - toughness: 0 - knockback-resistance: 1 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - leggings: - armor: 6 - toughness: 3 - knockback-resistance: 1 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 - boots: - armor: 3 - toughness: 3 - knockback-resistance: 1 - speed-percentage: 0 - attack-speed-percentage: 0 - attack-damage-percentage: 0 - attack-knockback-percentage: 0 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/tiers/osmium.yml b/eco-core/core-plugin/src/main/resources/tiers/osmium.yml deleted file mode 100644 index 10b0a6c..0000000 --- a/eco-core/core-plugin/src/main/resources/tiers/osmium.yml +++ /dev/null @@ -1,66 +0,0 @@ -enabled: true -display: "&b&k!!&r &lOSMIUM&r &b&k!!" -requires-tiers: # Leave empty to always allow application - - cobalt -crystal-craftable: true -crystal-name: "Osmium upgrade crystal" -crystal-recipe: - - air - - netherite_block - - air - - - netherite_block - - ecoarmor:upgrade_crystal_cobalt - - netherite_block - - - air - - netherite_block - - air -recipe-give-amount: 1 -crystal-lore: - - "&8Drop this onto an armor piece" - - "&8to set its tier to:" - - "&b&k!!&r &lOSMIUM&r &b&k!!" - - "" - - "&8&oRequires the armor to already have Cobalt tier" -properties: - helmet: - armor: 3 - toughness: 6 - knockback-resistance: 3 - speed-percentage: -15 - attack-speed-percentage: -15 - attack-damage-percentage: 5 - attack-knockback-percentage: 25 - chestplate: - armor: 8 - toughness: 6 - knockback-resistance: 3 - speed-percentage: -15 - attack-speed-percentage: -15 - attack-damage-percentage: 5 - attack-knockback-percentage: 25 - elytra: - armor: 8 - toughness: 6 - knockback-resistance: 3 - speed-percentage: -15 - attack-speed-percentage: -15 - attack-damage-percentage: 5 - attack-knockback-percentage: 25 - leggings: - armor: 6 - toughness: 6 - knockback-resistance: 3 - speed-percentage: -15 - attack-speed-percentage: -15 - attack-damage-percentage: 5 - attack-knockback-percentage: 25 - boots: - armor: 3 - toughness: 6 - knockback-resistance: 3 - speed-percentage: -15 - attack-speed-percentage: -15 - attack-damage-percentage: 5 - attack-knockback-percentage: 25 \ No newline at end of file