From 442ffc85d0c9bc4e70de5914c863c722168e1d03 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 17 Jun 2021 11:53:52 +0100 Subject: [PATCH 01/25] Began migrating to JSON --- build.gradle | 2 +- .../com/willfp/ecoarmor/EcoArmorPlugin.java | 9 + .../com/willfp/ecoarmor/config/SetsJson.java | 16 + .../com/willfp/ecoarmor/sets/ArmorSet.java | 338 +---------------- .../willfp/ecoarmor/sets/ArmorSetFactory.java | 347 ++++++++++++++++++ .../com/willfp/ecoarmor/sets/ArmorSets.java | 42 +-- .../willfp/ecoarmor/sets/util/ArmorUtils.java | 27 -- .../core-plugin/src/main/resources/sets.json | 261 +++++++++++++ gradle.properties | 2 +- 9 files changed, 657 insertions(+), 387 deletions(-) create mode 100644 eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/SetsJson.java create mode 100644 eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSetFactory.java create mode 100644 eco-core/core-plugin/src/main/resources/sets.json diff --git a/build.gradle b/build.gradle index 078c3ee..9a42c3c 100644 --- a/build.gradle +++ b/build.gradle @@ -46,7 +46,7 @@ allprojects { } dependencies { - compileOnly 'com.willfp:eco:5.2.0' + compileOnly 'com.willfp:eco:5.5.0' compileOnly 'org.jetbrains:annotations:19.0.0' 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 a749cc4..9dff2d0 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 @@ -9,6 +9,7 @@ import com.willfp.ecoarmor.commands.CommandEagive; 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.display.ArmorDisplay; import com.willfp.ecoarmor.effects.Effect; import com.willfp.ecoarmor.effects.Effects; @@ -36,12 +37,20 @@ public class EcoArmorPlugin extends EcoPlugin { @Getter private static EcoArmorPlugin instance; + /** + * sets.json. + */ + @Getter + private final SetsJson setsJson; + /** * Internal constructor called by bukkit on plugin load. */ public EcoArmorPlugin() { super("EcoArmor", 88246, 10002, "com.willfp.ecoarmor.proxy", "&c"); instance = this; + + this.setsJson = new SetsJson(this); } /** diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/SetsJson.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/SetsJson.java new file mode 100644 index 0000000..6e86674 --- /dev/null +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/SetsJson.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 SetsJson extends JsonStaticBaseConfig { + /** + * Create sets.json. + * + * @param plugin Instance of EcoArmor. + */ + public SetsJson(@NotNull final EcoPlugin plugin) { + super("sets", 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 c3cf7df..b2c6ee2 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,93 +1,56 @@ package com.willfp.ecoarmor.sets; -import com.willfp.eco.core.config.Config; -import com.willfp.eco.core.display.Display; -import com.willfp.eco.core.items.CustomItem; -import com.willfp.eco.core.items.Items; -import com.willfp.eco.core.recipe.recipes.ShapedCraftingRecipe; -import com.willfp.eco.util.SkullUtils; -import com.willfp.eco.util.StringUtils; -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.AllArgsConstructor; import lombok.Getter; -import org.bukkit.Bukkit; -import org.bukkit.Color; -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.inventory.meta.LeatherArmorMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.persistence.PersistentDataContainer; -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; +@AllArgsConstructor @SuppressWarnings("unchecked") public class ArmorSet { - /** - * 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 Config config; - /** * Conditions and their values. */ @Getter - private final Map, Object> conditions = new HashMap<>(); + private final Map, Object> conditions; /** * Effects and their strengths. */ @Getter - private final Map, Object> effects = new HashMap<>(); + private final Map, Object> effects; /** * Effects and their strengths on advanced armor. */ @Getter - private final Map, Object> advancedEffects = new HashMap<>(); + private final Map, Object> advancedEffects; /** * Potion effects to be applied on equip. */ @Getter - private final Map potionEffects = new HashMap<>(); + private final Map potionEffects; /** * Potion effects to be applied on equipping advanced. */ @Getter - private final Map advancedPotionEffects = new HashMap<>(); + private final Map advancedPotionEffects; /** * The base64 texture of a skull used as a helmet. @@ -96,17 +59,17 @@ public class ArmorSet { */ @Getter @Nullable - private String skullBase64; + private final String skullBase64; /** * Items in set. */ - private final Map items = new HashMap<>(); + private final Map items; /** * Items in advanced set. */ - private final Map advancedItems = new HashMap<>(); + private final Map advancedItems; /** * Advancement shard item. @@ -114,278 +77,6 @@ public class ArmorSet { @Getter private final ItemStack advancementShardItem; - /** - * Create a new Armor Set. - * - * @param name The name of the set. - * @param config The set's config. - */ - public ArmorSet(@NotNull final String name, - @NotNull final Config config) { - this.config = config; - this.name = 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 (String definedKey : this.getConfig().getStrings("set-bonus")) { - String[] split = definedKey.split(":"); - String key = split[0].trim(); - String value = split[1].trim(); - Effect effect = Effects.getByName(key); - if (effect == null) { - Bukkit.getLogger().warning("Invalid effect specified in " + this.name); - } else { - effects.put(effect, ArmorUtils.getEffectValue(value, effect)); - } - } - - for (String definedKey : this.getConfig().getStrings("advanced-set-bonus")) { - String[] split = definedKey.split(":"); - String key = split[0].trim(); - String value = split[1].trim(); - Effect effect = Effects.getByName(key); - if (effect == null) { - Bukkit.getLogger().warning("Invalid advanced effect specified in " + this.name); - } else { - advancedEffects.put(effect, ArmorUtils.getEffectValue(value, effect)); - } - } - - for (String definedKey : this.getConfig().getStrings("potion-effects")) { - String[] split = definedKey.split(":"); - String key = split[0].trim(); - String value = split[1].trim(); - PotionEffectType type = PotionEffectType.getByName(key.toUpperCase()); - if (type == null) { - Bukkit.getLogger().warning("Invalid potion effect specified in " + this.name); - } else { - potionEffects.put(type, Integer.parseInt(value)); - } - } - - for (String definedKey : this.getConfig().getStrings("advanced-potion-effects")) { - String[] split = definedKey.split(":"); - String key = split[0].trim(); - String value = split[1].trim(); - PotionEffectType type = PotionEffectType.getByName(key.toUpperCase()); - if (type == null) { - Bukkit.getLogger().warning("Invalid advanced potion effect specified in " + this.name); - } else { - advancedPotionEffects.put(type, Integer.parseInt(value)); - } - } - - for (ArmorSlot slot : ArmorSlot.values()) { - ItemStack item = construct(slot, 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, this.getConfig().getSubsection(slot.name().toLowerCase()), true); - advancedItems.put(slot, advancedItem); - } - - if (this.getConfig().getBool("enabled")) { - ArmorSets.addNewSet(this); - } - - this.advancementShardItem = constructShard(); - } - - private ItemStack constructShard() { - ItemStack shardItem = new ItemStack(Objects.requireNonNull(Material.getMaterial(PLUGIN.getConfigYml().getString("advancement-shard-material").toUpperCase()))); - ItemMeta shardMeta = shardItem.getItemMeta(); - assert shardMeta != null; - shardMeta.setDisplayName(this.getConfig().getString("advancement-shard-name")); - - shardMeta.addEnchant(Enchantment.DURABILITY, 3, true); - shardMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); - - List shardLore = new ArrayList<>(); - for (String loreLine : this.getConfig().getStrings("advancement-shard-lore")) { - shardLore.add(Display.PREFIX + StringUtils.translate(loreLine)); - } - - shardMeta.setLore(shardLore); - shardMeta.getPersistentDataContainer().set(PLUGIN.getNamespacedKeyFactory().create("advancement-shard"), PersistentDataType.STRING, name); - - shardItem.setItemMeta(shardMeta); - - if (this.getConfig().getBool("shard-craftable")) { - ShapedCraftingRecipe.Builder builder = ShapedCraftingRecipe.builder(PLUGIN, this.getName() + "_shard").setOutput(shardItem); - - List recipeStrings = this.getConfig().getStrings("shard-recipe"); - - for (int i = 0; i < 9; i++) { - builder.setRecipePart(i, Items.lookup(recipeStrings.get(i))); - } - - ShapedCraftingRecipe recipe = builder.build(); - recipe.register(); - } - - return shardItem; - } - - private ItemStack construct(@NotNull final ArmorSlot slot, - @NotNull final Config slotConfig, - final boolean advanced) { - Material material = Material.getMaterial(slotConfig.getString("material").toUpperCase()); - Map enchants = new HashMap<>(); - - for (String definedKey : slotConfig.getStrings("enchants")) { - String[] split = definedKey.split(":"); - String key = split[0].trim(); - String value = split[1].trim(); - Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft(key)); - if (enchantment == null) { - Bukkit.getLogger().warning("Invalid enchantment specified in " + this.name + " " + slot.name().toLowerCase()); - } else { - enchants.put(enchantment, Integer.valueOf(value)); - } - } - - assert material != null; - - ItemStack itemStack = new ItemStack(material); - ItemMeta meta = itemStack.getItemMeta(); - - assert meta != null; - - String displayName; - if (advanced) { - displayName = slotConfig.getString("advanced-name"); - } else { - displayName = slotConfig.getString("name"); - } - - List flags = new ArrayList<>(); - for (String flagName : slotConfig.getStrings("flags")) { - ItemFlag flag = ItemFlag.valueOf(flagName.toUpperCase()); - flags.add(flag); - } - meta.addItemFlags(flags.toArray(new ItemFlag[0])); - - int data = slotConfig.getInt("custom-model-data"); - if (data != -1) { - meta.setCustomModelData(data); - } - - boolean unbreakable = slotConfig.getBool("unbreakable"); - meta.setUnbreakable(unbreakable); - - List lore = new ArrayList<>(); - for (String loreLine : slotConfig.getStrings("lore")) { - lore.add(Display.PREFIX + StringUtils.translate(loreLine)); - } - - if (advanced) { - for (String loreLine : this.getConfig().getStrings("advanced-lore")) { - lore.add(Display.PREFIX + StringUtils.translate(loreLine)); - } - } - - if (meta instanceof SkullMeta) { - this.skullBase64 = slotConfig.getString("skull-texture"); - SkullUtils.setSkullTexture((SkullMeta) meta, skullBase64); - } - - if (meta instanceof LeatherArmorMeta) { - String colorString = slotConfig.getString("leather-color"); - java.awt.Color awtColor = java.awt.Color.decode(colorString); - Color color = Color.fromRGB(awtColor.getRed(), awtColor.getGreen(), awtColor.getBlue()); - ((LeatherArmorMeta) meta).setColor(color); - - meta.addItemFlags(ItemFlag.HIDE_DYE); - } - - meta.setDisplayName(displayName); - - meta.setLore(lore); - - enchants.forEach((enchantment, integer) -> meta.addEnchant(enchantment, integer, true)); - PersistentDataContainer container = meta.getPersistentDataContainer(); - container.set(PLUGIN.getNamespacedKeyFactory().create("set"), PersistentDataType.STRING, name); - container.set(PLUGIN.getNamespacedKeyFactory().create("effective-durability"), PersistentDataType.INTEGER, slotConfig.getInt("effective-durability")); - itemStack.setItemMeta(meta); - - 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, ArmorUtils.getSetOnItem(test)); - }, 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, ArmorUtils.getSetOnItem(test)); - }, 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); - - ShapedCraftingRecipe.Builder builder = ShapedCraftingRecipe.builder(PLUGIN, this.getName() + "_" + slot.name().toLowerCase()).setOutput(formattedOut); - - List recipeStrings = slotConfig.getStrings("recipe"); - - for (int i = 0; i < 9; i++) { - builder.setRecipePart(i, Items.lookup(recipeStrings.get(i))); - } - - ShapedCraftingRecipe recipe = builder.build(); - recipe.register(); - } - } - /** * Get item stack from slot. * @@ -455,23 +146,22 @@ public class ArmorSet { return true; } - if (!(o instanceof ArmorSet)) { + if (!(o instanceof ArmorSet set)) { return false; } - ArmorSet set = (ArmorSet) o; - return this.getName().equals(set.getName()); + return this.name.equals(set.name); } @Override public int hashCode() { - return Objects.hash(this.getName()); + return Objects.hash(this.name); } @Override public String toString() { return "ArmorSet{" - + this.getName() + + this.name + "}"; } } 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 new file mode 100644 index 0000000..d5ac28e --- /dev/null +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSetFactory.java @@ -0,0 +1,347 @@ +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 f107dd2..c979c1f 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 @@ -5,38 +5,26 @@ 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.BaseEcoArmorConfig; -import com.willfp.ecoarmor.config.CustomConfig; 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 ArmorSets { + /** + * Instance of EcoArmor. + */ + private static final EcoArmorPlugin PLUGIN = EcoArmorPlugin.getInstance(); + /** * Registered armor sets. */ private static final BiMap BY_NAME = HashBiMap.create(); - /** - * Sets that exist by default. - */ - private static final List DEFAULT_SET_NAMES = Arrays.asList( - "miner", - "reaper", - "ender", - "young" - ); - /** * Get all registered {@link ArmorSet}s. * @@ -66,22 +54,8 @@ public class ArmorSets { removeSet(set); } - for (String defaultSetName : DEFAULT_SET_NAMES) { - new ArmorSet(defaultSetName, new BaseEcoArmorConfig(defaultSetName)); - } - - try { - Files.walk(Paths.get(new File(EcoArmorPlugin.getInstance().getDataFolder(), "sets/").toURI())) - .filter(Files::isRegularFile) - .forEach(path -> { - String name = path.getFileName().toString().replace(".yml", ""); - new ArmorSet( - name, - new CustomConfig(name, YamlConfiguration.loadConfiguration(path.toFile())) - ); - }); - } catch (IOException e) { - e.printStackTrace(); + for (JSONConfig setConfig : PLUGIN.getSetsJson().getSubsections("sets")) { + addNewSet(new ArmorSetFactory(setConfig).create()); } } 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 79fcd0f..230e263 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 @@ -2,7 +2,6 @@ package com.willfp.ecoarmor.sets.util; import com.willfp.ecoarmor.EcoArmorPlugin; import com.willfp.ecoarmor.conditions.Condition; -import com.willfp.ecoarmor.effects.Effect; import com.willfp.ecoarmor.sets.ArmorSet; import com.willfp.ecoarmor.sets.ArmorSets; import com.willfp.ecoarmor.sets.meta.ArmorSlot; @@ -403,32 +402,6 @@ public class ArmorUtils { return ArmorSets.getByName(shardSet); } - /** - * Get value of effect. - * - * @param string Value as string. - * @param effect Effect. - * @param The type of the effect. - * @return Value. - */ - @NotNull - public static Object getEffectValue(@NotNull final String string, - @NotNull final Effect effect) { - if (effect.getTypeClass().equals(Boolean.class)) { - return Boolean.parseBoolean(string); - } - - if (effect.getTypeClass().equals(Integer.class)) { - return Integer.parseInt(string); - } - - if (effect.getTypeClass().equals(Double.class)) { - return Double.parseDouble(string); - } - - return string; - } - /** * Get value of condition. * diff --git a/eco-core/core-plugin/src/main/resources/sets.json b/eco-core/core-plugin/src/main/resources/sets.json new file mode 100644 index 0000000..d4133b4 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/sets.json @@ -0,0 +1,261 @@ +{ + "sets": [ + { + "name": "ender", + "conditions": [], + "effects": [ + { + "id": "warp-chance", + "args": 20 + }, + { + "id": "evade-chance", + "args": 10 + } + ], + "advanced-effects": [ + { + "id": "warp-chance", + "args": 30 + }, + { + "id": "evade-chance", + "args": 20 + } + ], + "potion-effects": [ + ], + "advanced-potion-effects": [ + ], + "advanced-lore": [ + "", + "&lADVANCED BONUS", + "&8» &330% Chance to warp behind your opponent", + "&8» &320% Chance to evade attacks", + "&8&oRequires full set to be worn" + ], + "advancement-shard-name": "Advancement Shard: &3Ender", + "advancement-shard-lore": [ + "&8Drop this onto &3Ender Armor", + "&8to make it Advanced." + ], + "shard-craftable": true, + "shard-recipe": [ + "prismarine_shard", + "ecoarmor:set_ender_helmet", + "prismarine_shard", + "ecoarmor:set_ender_chestplate", + "nether_star", + "ecoarmor:set_ender_leggings", + "prismarine_shard", + "ecoarmor:set_ender_boots", + "prismarine_shard" + ], + "helmet": { + "enchants": [ + { + "id": "protection", + "level": 3 + }, + { + "id": "unbreaking", + "level": 1 + } + ], + "material": "player_head", + "skull-texture": "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGFhOGZjOGRlNjQxN2I0OGQ0OGM4MGI0NDNjZjUzMjZlM2Q5ZGE0ZGJlOWIyNWZjZDQ5NTQ5ZDk2MTY4ZmMwIn19fQ==", + "name": "&bEnder Helmet", + "advanced-name": "Advanced&3 Ender Helmet", + "effective-durability": 1024, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&3&lENDER SET BONUS", + "&8» &320% Chance to warp behind your opponent", + "&8» &310% Chance to evade attacks", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "ender_eye", + "ender_eye", + "ender_eye", + "ender_eye", + "iron_helmet", + "ender_eye", + "ender_eye", + "ender_eye", + "ender_eye" + ] + }, + "chestplate": { + "enchants": [ + { + "id": "protection", + "level": 3 + }, + { + "id": "unbreaking", + "level": 1 + } + ], + "material": "leather_chestplate", + "leather-color": "#0d6961", + "name": "&3Ender Chestplate", + "advanced-name": "Advanced&3 Ender Chestplate", + "effective-durability": 1024, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&3&lENDER SET BONUS", + "&8» &320% Chance to warp behind your opponent", + "&8» &310% Chance to evade attacks", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "diamond", + "recipe": [ + "ender_eye", + "ender_eye", + "ender_eye", + "ender_eye", + "iron_chestplate", + "ender_eye", + "ender_eye", + "ender_eye", + "ender_eye" + ] + }, + "elytra": { + "enchants": [ + { + "id": "unbreaking", + "level": 1 + } + ], + "material": "elytra", + "name": "&3Ender Elytra", + "advanced-name": "Advanced&3 Ender Elytra", + "effective-durability": 1024, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&3&lENDER SET BONUS", + "&8» &320% Chance to warp behind your opponent", + "&8» &310% Chance to evade attacks", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "ender_eye", + "ender_eye", + "ender_eye", + "ender_eye", + "elytra", + "ender_eye", + "ender_eye", + "ender_eye", + "ender_eye" + ] + }, + "leggings": { + "enchants": [ + { + "id": "protection", + "level": 3 + }, + { + "id": "unbreaking", + "level": 1 + } + ], + "material": "leather_leggings", + "leather-color": "#0d6961", + "name": "&3Ender Leggings", + "advanced-name": "Advanced&3 Ender Leggings", + "effective-durability": 1024, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&3&lENDER SET BONUS", + "&8» &320% Chance to warp behind your opponent", + "&8» &310% Chance to evade attacks", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "ender_eye", + "ender_eye", + "ender_eye", + "ender_eye", + "iron_leggings", + "ender_eye", + "ender_eye", + "ender_eye", + "ender_eye" + ] + }, + "boots": { + "enchants": [ + { + "id": "protection", + "level": 3 + }, + { + "id": "unbreaking", + "level": 1 + } + ], + "material": "leather_boots", + "leather-color": "#0d6961", + "name": "&3Ender Boots", + "advanced-name": "Advanced&3 Ender Boots", + "effective-durability": 1024, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&3&lENDER SET BONUS", + "&8» &320% Chance to warp behind your opponent", + "&8» &310% Chance to evade attacks", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "ender_eye", + "ender_eye", + "ender_eye", + "ender_eye", + "iron_boots", + "ender_eye", + "ender_eye", + "ender_eye", + "ender_eye" + ] + } + } + ] +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 1f962bd..3205854 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version = 4.3.2 +version = 5.0.0 plugin-name = EcoArmor \ No newline at end of file From c0a0759ae9abeb7e33c86fea701727101867e1dd Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 17 Jun 2021 13:34:07 +0100 Subject: [PATCH 02/25] Switched tiers to json --- .../com/willfp/ecoarmor/EcoArmorPlugin.java | 8 + .../ecoarmor/commands/CommandEagive.java | 2 +- .../ecoarmor/config/BaseEcoArmorConfig.java | 16 - .../ecoarmor/config/BaseTierConfig.java | 16 - .../willfp/ecoarmor/config/CustomConfig.java | 24 - .../com/willfp/ecoarmor/config/TiersJson.java | 16 + .../com/willfp/ecoarmor/sets/ArmorSet.java | 272 +++++++- .../willfp/ecoarmor/sets/ArmorSetFactory.java | 347 ---------- .../com/willfp/ecoarmor/sets/ArmorSets.java | 13 +- .../willfp/ecoarmor/sets/util/ArmorUtils.java | 4 +- .../com/willfp/ecoarmor/upgrades/Tier.java | 15 +- .../com/willfp/ecoarmor/upgrades/Tiers.java | 56 +- .../core-plugin/src/main/resources/tiers.json | 601 ++++++++++++++++++ .../src/main/resources/tiers/cobalt.yml | 66 -- .../src/main/resources/tiers/default.yml | 62 -- .../src/main/resources/tiers/diamond.yml | 66 -- .../src/main/resources/tiers/exotic.yml | 66 -- .../src/main/resources/tiers/iron.yml | 66 -- .../src/main/resources/tiers/manyullyn.yml | 66 -- .../src/main/resources/tiers/netherite.yml | 66 -- .../src/main/resources/tiers/osmium.yml | 66 -- 21 files changed, 911 insertions(+), 1003 deletions(-) delete mode 100644 eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/BaseEcoArmorConfig.java delete mode 100644 eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/BaseTierConfig.java delete mode 100644 eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/CustomConfig.java create mode 100644 eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/TiersJson.java delete mode 100644 eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSetFactory.java create mode 100644 eco-core/core-plugin/src/main/resources/tiers.json delete mode 100644 eco-core/core-plugin/src/main/resources/tiers/cobalt.yml delete mode 100644 eco-core/core-plugin/src/main/resources/tiers/default.yml delete mode 100644 eco-core/core-plugin/src/main/resources/tiers/diamond.yml delete mode 100644 eco-core/core-plugin/src/main/resources/tiers/exotic.yml delete mode 100644 eco-core/core-plugin/src/main/resources/tiers/iron.yml delete mode 100644 eco-core/core-plugin/src/main/resources/tiers/manyullyn.yml delete mode 100644 eco-core/core-plugin/src/main/resources/tiers/netherite.yml delete mode 100644 eco-core/core-plugin/src/main/resources/tiers/osmium.yml 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 From d6ca717843abb43d0d8a7384a1e5b163f7328eeb Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 17 Jun 2021 13:44:22 +0100 Subject: [PATCH 03/25] Fixed tiers bug --- .../src/main/java/com/willfp/ecoarmor/upgrades/Tiers.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e4cfe65..e5eec3b 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 @@ -65,7 +65,7 @@ public class Tiers { public static void reload(@NotNull final EcoArmorPlugin plugin) { BY_NAME.clear(); - for (JSONConfig tierConfig : plugin.getSetsJson().getSubsections("tiers")) { + for (JSONConfig tierConfig : plugin.getTiersJson().getSubsections("tiers")) { addNewTier(new Tier(tierConfig, plugin)); } From 346a6cc2260a762f3c8c054418d7e9ab04551f13 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 17 Jun 2021 17:15:47 +0100 Subject: [PATCH 04/25] Migrated miner set to json --- .../core-plugin/src/main/resources/sets.json | 257 ++++++++++++++++++ .../src/main/resources/sets/ender.yml | 199 -------------- .../src/main/resources/sets/miner.yml | 201 -------------- 3 files changed, 257 insertions(+), 400 deletions(-) delete mode 100644 eco-core/core-plugin/src/main/resources/sets/ender.yml delete mode 100644 eco-core/core-plugin/src/main/resources/sets/miner.yml diff --git a/eco-core/core-plugin/src/main/resources/sets.json b/eco-core/core-plugin/src/main/resources/sets.json index d4133b4..f34fffe 100644 --- a/eco-core/core-plugin/src/main/resources/sets.json +++ b/eco-core/core-plugin/src/main/resources/sets.json @@ -256,6 +256,263 @@ "ender_eye" ] } + }, + { + "name": "miner", + "conditions": [], + "set-bonus": [ + { + "id": "experience-multiplier", + "args": 1.25 + } + ], + "advanced-set-bonus": [ + { + "id": "hunger-loss-multiplier", + "args": 0.5 + } + ], + "potion-effects": [ + { + "id": "FAST_DIGGING", + "args": 2 + } + ], + "advanced-potion-effects": [ + { + "id": "FAST_DIGGING", + "args": 3 + } + ], + "advanced-lore": [ + "", + "&lADVANCED BONUS", + "&8» &6Lose 50% less hunger", + "&8» &6Permanent Haste III", + "&8&oRequires full set to be worn" + ], + "advancement-shard-name": "Advancement Shard: &9Miner", + "advancement-shard-lore": [ + "&8Drop this onto &9Miner Armor", + "&8to make it Advanced." + ], + "shard-craftable": true, + "shard-recipe": [ + "prismarine_shard", + "ecoarmor:set_miner_helmet", + "prismarine_shard", + "ecoarmor:set_miner_chestplate", + "nether_star", + "ecoarmor:set_miner_leggings", + "prismarine_shard", + "ecoarmor:set_miner_boots", + "prismarine_shard" + ], + "helmet": { + "enchants": [ + { + "id": "fire_protection", + "level": 4 + }, + { + "id": "unbreaking", + "level": 1 + } + ], + "material": "leather_helmet", + "leather-color": "#6699cc", + "name": "&9Miner Helmet", + "advanced-name": "Advanced&9 Miner Helmet", + "effective-durability": 1024, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&9&lMINER SET BONUS", + "&8» &9Gain 50% more experience", + "&8» &9Permanent Haste II", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "air", + "diamond_pickaxe", + "air", + "diamond_pickaxe", + "diamond_helmet", + "diamond_pickaxe", + "air", + "diamond_pickaxe", + "air" + ] + }, + "chestplate": { + "enchants": [ + { + "id": "fire_protection", + "level": 4 + }, + { + "id": "unbreaking", + "level": 1 + } + ], + "material": "leather_chestplate", + "leather-color": "#6699cc", + "name": "&9Miner Chestplate", + "advanced-name": "Advanced&9 Miner Chestplate", + "effective-durability": 1024, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&9&lMINER SET BONUS", + "&8» &9Gain 50% more experience", + "&8» &9Permanent Haste II", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "air", + "diamond_pickaxe", + "air", + "diamond_pickaxe", + "diamond_chestplate", + "diamond_pickaxe", + "air", + "diamond_pickaxe", + "air" + ] + }, + "elytra": { + "enchants": [ + { + "id": "unbreaking", + "level": 1 + } + ], + "material": "elytra", + "name": "&9Miner Elytra", + "advanced-name": "Advanced&9 Miner Elytra", + "effective-durability": 1024, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&9&lMINER SET BONUS", + "&8» &9Gain 50% more experience", + "&8» &9Permanent Haste II", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "air", + "diamond_pickaxe", + "air", + "diamond_pickaxe", + "elytra", + "diamond_pickaxe", + "air", + "diamond_pickaxe", + "air" + ] + }, + "leggings": { + "enchants": [ + { + "id": "fire_protection", + "level": 4 + }, + { + "id": "unbreaking", + "level": 1 + } + ], + "material": "leather_leggings", + "leather-color": "#6699cc", + "name": "&9Miner Leggings", + "advanced-name": "Advanced&9 Miner Leggings", + "effective-durability": 1024, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&9&lMINER SET BONUS", + "&8» &9Gain 50% more experience", + "&8» &9Permanent Haste II", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "air", + "diamond_pickaxe", + "air", + "diamond_pickaxe", + "diamond_leggings", + "diamond_pickaxe", + "air", + "diamond_pickaxe", + "air" + ] + }, + "boots": { + "enchants": [ + { + "id": "fire_protection", + "level": 4 + }, + { + "id": "unbreaking", + "level": 1 + } + ], + "material": "leather_boots", + "leather-color": "#6699cc", + "name": "&9Miner Boots", + "advanced-name": "Advanced&9 Miner Boots", + "effective-durability": 1024, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&9&lMINER SET BONUS", + "&8» &9Gain 50% more experience", + "&8» &9Permanent Haste II", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "air", + "diamond_pickaxe", + "air", + "diamond_pickaxe", + "diamond_boots", + "diamond_pickaxe", + "air", + "diamond_pickaxe", + "air" + ] + } } ] } \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/sets/ender.yml b/eco-core/core-plugin/src/main/resources/sets/ender.yml deleted file mode 100644 index 3051fde..0000000 --- a/eco-core/core-plugin/src/main/resources/sets/ender.yml +++ /dev/null @@ -1,199 +0,0 @@ -enabled: true -conditions: [] -set-bonus: - - "warp-chance: 20" - - "evade-chance: 10" -advanced-set-bonus: - - "warp-chance: 30" - - "evade-chance: 20" -advanced-lore: - - "" - - "&lADVANCED BONUS" - - "&8» &330% Chance to warp behind your opponent" - - "&8» &320% Chance to evade attacks" - - "&8&oRequires full set to be worn" -advancement-shard-name: "Advancement Shard: &3Ender" -advancement-shard-lore: - - "&8Drop this onto &3Ender Armor" - - "&8to make it Advanced." -shard-craftable: true -shard-recipe: - - prismarine_shard - - ecoarmor:set_ender_helmet - - prismarine_shard - - - ecoarmor:set_ender_chestplate - - nether_star - - ecoarmor:set_ender_leggings - - - prismarine_shard - - ecoarmor:set_ender_boots - - prismarine_shard -helmet: - enchants: - - "protection: 3" - - "unbreaking: 1" - material: player_head - skull-texture: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGFhOGZjOGRlNjQxN2I0OGQ0OGM4MGI0NDNjZjUzMjZlM2Q5ZGE0ZGJlOWIyNWZjZDQ5NTQ5ZDk2MTY4ZmMwIn19fQ== - name: "&bEnder Helmet" - advanced-name: "Advanced&3 Ender Helmet" - effective-durability: 1024 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&3&lENDER SET BONUS" - - "&8» &320% Chance to warp behind your opponent" - - "&8» &310% Chance to evade attacks" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - ender_eye - - ender_eye - - ender_eye - - - ender_eye - - iron_helmet - - ender_eye - - - ender_eye - - ender_eye - - ender_eye -chestplate: - enchants: - - "protection: 3" - - "unbreaking: 1" - material: leather_chestplate - leather-color: "#0d6961" - name: "&3Ender Chestplate" - advanced-name: "Advanced&3 Ender Chestplate" - effective-durability: 1024 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&3&lENDER SET BONUS" - - "&8» &320% Chance to warp behind your opponent" - - "&8» &310% Chance to evade attacks" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - ender_eye - - ender_eye - - ender_eye - - - ender_eye - - iron_chestplate - - ender_eye - - - ender_eye - - ender_eye - - ender_eye -elytra: - enchants: - - "unbreaking: 1" - material: elytra - name: "&3Ender Elytra" - advanced-name: "Advanced&3 Ender Elytra" - effective-durability: 1024 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&3&lENDER SET BONUS" - - "&8» &320% Chance to warp behind your opponent" - - "&8» &310% Chance to evade attacks" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - ender_eye - - ender_eye - - ender_eye - - - ender_eye - - elytra - - ender_eye - - - ender_eye - - ender_eye - - ender_eye -leggings: - enchants: - - "protection: 3" - - "unbreaking: 1" - material: leather_leggings - leather-color: "#0d6961" - name: "&3Ender Leggings" - advanced-name: "Advanced&3 Ender Leggings" - effective-durability: 1024 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&3&lENDER SET BONUS" - - "&8» &320% Chance to warp behind your opponent" - - "&8» &310% Chance to evade attacks" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - ender_eye - - ender_eye - - ender_eye - - - ender_eye - - iron_leggings - - ender_eye - - - ender_eye - - ender_eye - - ender_eye -boots: - enchants: - - "protection: 3" - - "unbreaking: 1" - material: leather_boots - leather-color: "#0d6961" - name: "&3Ender Boots" - advanced-name: "Advanced&3 Ender Boots" - effective-durability: 1024 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&3&lENDER SET BONUS" - - "&8» &320% Chance to warp behind your opponent" - - "&8» &310% Chance to evade attacks" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - ender_eye - - ender_eye - - ender_eye - - - ender_eye - - iron_boots - - ender_eye - - - ender_eye - - ender_eye - - ender_eye \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/sets/miner.yml b/eco-core/core-plugin/src/main/resources/sets/miner.yml deleted file mode 100644 index 644f6c0..0000000 --- a/eco-core/core-plugin/src/main/resources/sets/miner.yml +++ /dev/null @@ -1,201 +0,0 @@ -enabled: true -conditions: [] -set-bonus: - - "experience-multiplier: 1.25" -advanced-set-bonus: - - "hunger-loss-multiplier: 0.5" -potion-effects: - - "fast_digging: 2" -advanced-potion-effects: - - "fast_digging: 3" -advanced-lore: - - "" - - "&lADVANCED BONUS" - - "&8» &6Lose 50% less hunger" - - "&8» &6Permanent Haste III" - - "&8&oRequires full set to be worn" -advancement-shard-name: "Advancement Shard: &9Miner" -advancement-shard-lore: - - "&8Drop this onto &9Miner Armor" - - "&8to make it Advanced." -shard-craftable: true -shard-recipe: - - prismarine_shard - - ecoarmor:set_miner_helmet - - prismarine_shard - - - ecoarmor:set_miner_chestplate - - nether_star - - ecoarmor:set_miner_leggings - - - prismarine_shard - - ecoarmor:set_miner_boots - - prismarine_shard -helmet: - enchants: - - "fire_protection: 4" - - "unbreaking: 1" - material: leather_helmet - leather-color: "#6699cc" - name: "&9Miner Helmet" - advanced-name: "Advanced&9 Miner Helmet" - effective-durability: 1024 - unbreakable: false - flags: [] - custom-model-data: -1 - lore: - - "&9&lMINER SET BONUS" - - "&8» &9Gain 50% more experience" - - "&8» &9Permanent Haste II" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - air - - diamond_pickaxe - - air - - - diamond_pickaxe - - diamond_helmet - - diamond_pickaxe - - - air - - diamond_pickaxe - - air -chestplate: - enchants: - - "fire_protection: 4" - - "unbreaking: 1" - material: leather_chestplate - leather-color: "#6699cc" - name: "&9Miner Chestplate" - advanced-name: "Advanced&9 Miner Chestplate" - effective-durability: 1024 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&9&lMINER SET BONUS" - - "&8» &9Gain 50% more experience" - - "&8» &9Permanent Haste II" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - air - - diamond_pickaxe - - air - - - diamond_pickaxe - - diamond_chestplate - - diamond_pickaxe - - - air - - diamond_pickaxe - - air -elytra: - enchants: - - "unbreaking: 1" - material: elytra - name: "&9Miner Elytra" - advanced-name: "Advanced&9 Miner Elytra" - effective-durability: 1024 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&9&lMINER SET BONUS" - - "&8» &9Gain 50% more experience" - - "&8» &9Permanent Haste II" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - air - - diamond_pickaxe - - air - - - diamond_pickaxe - - elytra - - diamond_pickaxe - - - air - - diamond_pickaxe - - air -leggings: - enchants: - - "fire_protection: 4" - - "unbreaking: 1" - material: leather_leggings - leather-color: "#6699cc" - name: "&9Miner Leggings" - advanced-name: "Advanced&9 Miner Leggings" - effective-durability: 1024 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&9&lMINER SET BONUS" - - "&8» &9Gain 50% more experience" - - "&8» &9Permanent Haste II" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - air - - diamond_pickaxe - - air - - - diamond_pickaxe - - diamond_leggings - - diamond_pickaxe - - - air - - diamond_pickaxe - - air -boots: - enchants: - - "fire_protection: 4" - - "unbreaking: 1" - material: leather_boots - leather-color: "#6699cc" - name: "&9Miner Boots" - advanced-name: "Advanced&9 Miner Boots" - effective-durability: 1024 - unbreakable: false - flags: [] - custom-model-data: -1 - lore: - - "&9&lMINER SET BONUS" - - "&8» &9Gain 50% more experience" - - "&8» &9Permanent Haste II" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - air - - diamond_pickaxe - - air - - - diamond_pickaxe - - diamond_boots - - diamond_pickaxe - - - air - - diamond_pickaxe - - air \ No newline at end of file From d3d2bb35d9d9f16b6e7079484c521053ef8ac210 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 17 Jun 2021 17:19:33 +0100 Subject: [PATCH 05/25] Migrated reaper set to json --- .../core-plugin/src/main/resources/sets.json | 239 ++++++++++++++++++ .../src/main/resources/sets/reaper.yml | 191 -------------- 2 files changed, 239 insertions(+), 191 deletions(-) delete mode 100644 eco-core/core-plugin/src/main/resources/sets/reaper.yml diff --git a/eco-core/core-plugin/src/main/resources/sets.json b/eco-core/core-plugin/src/main/resources/sets.json index f34fffe..a6bc3f2 100644 --- a/eco-core/core-plugin/src/main/resources/sets.json +++ b/eco-core/core-plugin/src/main/resources/sets.json @@ -513,6 +513,245 @@ "air" ] } + }, + { + "name": "reaper", + "conditions": [], + "set-bonus": [ + { + "id": "damage-multiplier", + "args": 1.25 + } + ], + "advanced-set-bonus": [ + { + "id": "damage-taken-multiplier", + "args": 0.9 + } + ], + "advanced-lore": [ + "", + "&lADVANCED BONUS", + "&8» &6Take 10% less damage", + "&8&oRequires full set to be worn" + ], + "advancement-shard-name": "Advancement Shard: &cReaper", + "advancement-shard-lore": [ + "&8Drop this onto &cReaper Armor", + "&8to make it Advanced." + ], + "shard-craftable": true, + "shard-recipe": [ + "prismarine_shard", + "ecoarmor:set_reaper_helmet", + "prismarine_shard", + "ecoarmor:set_reaper_chestplate", + "nether_star", + "ecoarmor:set_reaper_leggings", + "prismarine_shard", + "ecoarmor:set_reaper_boots", + "prismarine_shard" + ], + "helmet": { + "enchants": [ + { + "id": "protection", + "level": "4" + }, + { + "id": "unbreaking", + "level": 3 + } + ], + "material": "leather_helmet", + "leather-color": "#303030", + "name": "&cReaper Helmet", + "advanced-name": "Advanced&c Reaper Helmet", + "effective-durability": 2048, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&c&lREAPER SET BONUS", + "&8» &cDeal 25% more damage", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "air", + "nether_star", + "air", + "nether_star", + "netherite_helmet", + "nether_star", + "air", + "nether_star", + "air" + ] + }, + "chestplate": { + "enchants": [ + { + "id": "protection", + "level": "4" + }, + { + "id": "unbreaking", + "level": 3 + } + ], + "material": "leather_chestplate", + "leather-color": "#303030", + "name": "&cReaper Chestplate", + "advanced-name": "Advanced&c Reaper Chestplate", + "effective-durability": 2048, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&c&lREAPER SET BONUS", + "&8» &cDeal 25% more damage", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "air", + "nether_star", + "air", + "nether_star", + "netherite_chestplate", + "nether_star", + "air", + "nether_star", + "air" + ] + }, + "elytra": { + "enchants": [ + { + "id": "unbreaking", + "level": 3 + } + ], + "material": "elytra", + "name": "&cReaper Elytra", + "advanced-name": "Advanced&c Reaper Elytra", + "effective-durability": 2048, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&c&lREAPER SET BONUS", + "&8» &cDeal 25% more damage", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "air", + "nether_star", + "air", + "nether_star", + "elytra", + "nether_star", + "air", + "nether_star", + "air" + ] + }, + "leggings": { + "enchants": [ + { + "id": "protection", + "level": "4" + }, + { + "id": "unbreaking", + "level": 3 + } + ], + "material": "leather_leggings", + "leather-color": "#303030", + "name": "&cReaper Leggings", + "advanced-name": "Advanced&c Reaper Leggings", + "effective-durability": 2048, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&c&lREAPER SET BONUS", + "&8» &cDeal 25% more damage", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "air", + "nether_star", + "air", + "nether_star", + "netherite_leggings", + "nether_star", + "air", + "nether_star", + "air" + ] + }, + "boots": { + "enchants": [ + { + "id": "protection", + "level": "4" + }, + { + "id": "unbreaking", + "level": 3 + } + ], + "material": "leather_boots", + "leather-color": "#303030", + "name": "&cReaper Boots", + "advanced-name": "Advanced&c Reaper Boots", + "effective-durability": 2048, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&c&lREAPER SET BONUS", + "&8» &cDeal 25% more damage", + "&8&oRequires full set to be worn", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "air", + "nether_star", + "air", + "nether_star", + "netherite_boots", + "nether_star", + "air", + "nether_star", + "air" + ] + } } ] } \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/sets/reaper.yml b/eco-core/core-plugin/src/main/resources/sets/reaper.yml deleted file mode 100644 index 4e634b4..0000000 --- a/eco-core/core-plugin/src/main/resources/sets/reaper.yml +++ /dev/null @@ -1,191 +0,0 @@ -enabled: true -conditions: [] -set-bonus: - - "damage-multiplier: 1.25" -advanced-set-bonus: - - "damage-taken-multiplier: 0.9" -advanced-lore: - - "" - - "&lADVANCED BONUS" - - "&8» &6Take 10% less damage" - - "&8&oRequires full set to be worn" -advancement-shard-name: "Advancement Shard: &cReaper" -advancement-shard-lore: - - "&8Drop this onto &cReaper Armor" - - "&8to make it Advanced." -shard-craftable: true -shard-recipe: - - prismarine_shard - - ecoarmor:set_reaper_helmet - - prismarine_shard - - - ecoarmor:set_reaper_chestplate - - nether_star - - ecoarmor:set_reaper_leggings - - - prismarine_shard - - ecoarmor:set_reaper_boots - - prismarine_shard -helmet: - enchants: - - "protection: 4" - - "unbreaking: 3" - material: leather_helmet - leather-color: "#303030" - name: "&cReaper Helmet" - advanced-name: "Advanced&c Reaper Helmet" - effective-durability: 2048 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&c&lREAPER SET BONUS" - - "&8» &cDeal 25% more damage" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - air - - nether_star - - air - - - nether_star - - netherite_helmet - - nether_star - - - air - - nether_star - - air -chestplate: - enchants: - - "protection: 4" - - "unbreaking: 3" - material: leather_chestplate - leather-color: "#303030" - name: "&cReaper Chestplate" - advanced-name: "Advanced&c Reaper Chestplate" - effective-durability: 2048 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&c&lREAPER SET BONUS" - - "&8» &cDeal 25% more damage" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - air - - nether_star - - air - - - nether_star - - netherite_chestplate - - nether_star - - - air - - nether_star - - air -elytra: - enchants: - - "unbreaking: 3" - material: elytra - name: "&cReaper Elytra" - advanced-name: "Advanced&c Reaper Elytra" - effective-durability: 2048 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&c&lREAPER SET BONUS" - - "&8» &cDeal 25% more damage" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - air - - nether_star - - air - - - nether_star - - elytra - - nether_star - - - air - - nether_star - - air -leggings: - enchants: - - "protection: 4" - - "unbreaking: 3" - material: leather_leggings - leather-color: "#303030" - name: "&cReaper Leggings" - advanced-name: "Advanced&c Reaper Leggings" - effective-durability: 2048 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&c&lREAPER SET BONUS" - - "&8» &cDeal 25% more damage" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - air - - nether_star - - air - - - nether_star - - netherite_leggings - - nether_star - - - air - - nether_star - - air -boots: - enchants: - - "protection: 4" - - "unbreaking: 3" - material: leather_boots - leather-color: "#303030" - name: "&cReaper Boots" - advanced-name: "Advanced&c Reaper Boots" - effective-durability: 2048 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&c&lREAPER SET BONUS" - - "&8» &cDeal 25% more damage" - - "&8&oRequires full set to be worn" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - air - - nether_star - - air - - - nether_star - - netherite_boots - - nether_star - - - air - - nether_star - - air \ No newline at end of file From eb9cb81f64d2a57aadfc8a98c60d70e1feeee6cf Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 17 Jun 2021 17:21:44 +0100 Subject: [PATCH 06/25] Migrated young set to json --- .../core-plugin/src/main/resources/sets.json | 255 ++++++++++++++++++ .../src/main/resources/sets/young.yml | 196 -------------- 2 files changed, 255 insertions(+), 196 deletions(-) delete mode 100644 eco-core/core-plugin/src/main/resources/sets/young.yml diff --git a/eco-core/core-plugin/src/main/resources/sets.json b/eco-core/core-plugin/src/main/resources/sets.json index a6bc3f2..57485f6 100644 --- a/eco-core/core-plugin/src/main/resources/sets.json +++ b/eco-core/core-plugin/src/main/resources/sets.json @@ -752,6 +752,261 @@ "air" ] } + }, + { + "name": "young", + "conditions": [ + { + "id": "above-health-percent", + "args": 50 + } + ], + "set-bonus": [ + { + "id": "speed-multiplier", + "args": 1.25 + } + ], + "advanced-set-bonus": [ + { + "id": "speed-multiplier", + "args": 1.5 + } + ], + "advanced-potion-effects": [ + { + "id": "jump", + "args": 2 + } + ], + "advanced-lore": [ + "", + "&lADVANCED BONUS", + "&8» &bPermanent Jump Boost II", + "&8» &bMove 50% faster", + "&8&oRequires full set to be worn above 50% health" + ], + "advancement-shard-name": "Advancement Shard: &bYoung", + "advancement-shard-lore": [ + "&8Drop this onto &bYoung Armor", + "&8to make it Advanced." + ], + "shard-craftable": true, + "shard-recipe": [ + "prismarine_shard", + "ecoarmor:set_young_helmet", + "prismarine_shard", + "ecoarmor:set_young_chestplate", + "nether_star", + "ecoarmor:set_young_leggings", + "prismarine_shard", + "ecoarmor:set_young_boots", + "prismarine_shard" + ], + "helmet": { + "enchants": [ + { + "id": "protection", + "level": 2 + }, + { + "id": "protection", + "level": 3 + } + ], + "material": "player_head", + "skull-texture": "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNWM0ODZhZjNiODgyNzY2ZTgyYTBiYzE2NjVmZjAyZWI2ZTg3M2I2ZTBkNzcxZjNhZGFiYzc1OWI3MjAyMjZhIn19fQ==", + "name": "&bYoung Helmet", + "advanced-name": "Advanced&b Young Helmet", + "effective-durability": 768, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&b&lYOUNG SET BONUS", + "&8» &bMove 25% faster", + "&8&oRequires full set to be worn above 50% health", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "diamond", + "redstone", + "diamond", + "redstone", + "air", + "redstone", + "air", + "air", + "air" + ] + }, + "chestplate": { + "enchants": [ + { + "id": "protection", + "level": 2 + }, + { + "id": "protection", + "level": 3 + } + ], + "material": "leather_chestplate", + "leather-color": "#DDE4F0", + "name": "&bYoung Chestplate", + "advanced-name": "Advanced&b Young Chestplate", + "effective-durability": 768, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&b&lYOUNG SET BONUS", + "&8» &bMove 25% faster", + "&8&oRequires full set to be worn above 50% health", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "diamond", + "air", + "diamond", + "redstone", + "diamond", + "redstone", + "diamond", + "redstone", + "diamond" + ] + }, + "elytra": { + "enchants": [ + { + "id": "protection", + "level": 3 + } + ], + "material": "elytra", + "name": "&bYoung Elytra", + "advanced-name": "Advanced&b Young Elytra", + "effective-durability": 768, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&b&lYOUNG SET BONUS", + "&8» &bMove 25% faster", + "&8&oRequires full set to be worn above 50% health", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "air", + "redstone", + "air", + "redstone", + "elytra", + "redstone", + "air", + "redstone", + "air" + ] + }, + "leggings": { + "enchants": [ + { + "id": "protection", + "level": 2 + }, + { + "id": "protection", + "level": 3 + } + ], + "material": "leather_leggings", + "leather-color": "#DDE4F0", + "name": "&bYoung Leggings", + "advanced-name": "Advanced&b Young Leggings", + "effective-durability": 768, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&b&lYOUNG SET BONUS", + "&8» &bMove 25% faster", + "&8&oRequires full set to be worn above 50% health", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "diamond", + "redstone", + "diamond", + "redstone", + "air", + "redstone", + "diamond", + "air", + "diamond" + ] + }, + "boots": { + "enchants": [ + { + "id": "protection", + "level": 2 + }, + { + "id": "protection", + "level": 3 + }, + { + "id": "depth_strider", + "level": 3 + } + ], + "material": "leather_boots", + "leather-color": "#DDE4F0", + "name": "&bYoung Boots", + "advanced-name": "Advanced&b Young Boots", + "effective-durability": 768, + "unbreakable": false, + "flags": [], + "custom-model-data": -1, + "lore": [ + "&b&lYOUNG SET BONUS", + "&8» &bMove 25% faster", + "&8&oRequires full set to be worn above 50% health", + "", + "&fTier: %tier%", + "&8&oUpgrade with an Upgrade Crystal" + ], + "craftable": true, + "default-tier": "default", + "recipe": [ + "air", + "air", + "air", + "diamond", + "air", + "diamond", + "redstone", + "air", + "redstone" + ] + } } ] } \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/sets/young.yml b/eco-core/core-plugin/src/main/resources/sets/young.yml deleted file mode 100644 index 0287c71..0000000 --- a/eco-core/core-plugin/src/main/resources/sets/young.yml +++ /dev/null @@ -1,196 +0,0 @@ -enabled: true -conditions: - - "above-health-percent: 50" -set-bonus: - - "speed-multiplier: 1.25" -advanced-set-bonus: - - "speed-multiplier: 1.5" -advanced-potion-effects: - - "jump: 2" -advanced-lore: - - "" - - "&lADVANCED BONUS" - - "&8» &bPermanent Jump Boost II" - - "&8» &bMove 50% faster" - - "&8&oRequires full set to be worn above 50% health" -advancement-shard-name: "Advancement Shard: &bYoung" -advancement-shard-lore: - - "&8Drop this onto &bYoung Armor" - - "&8to make it Advanced." -shard-craftable: true -shard-recipe: - - prismarine_shard - - ecoarmor:set_young_helmet - - prismarine_shard - - - ecoarmor:set_young_chestplate - - nether_star - - ecoarmor:set_young_leggings - - - prismarine_shard - - ecoarmor:set_young_boots - - prismarine_shard -helmet: - enchants: - - "protection: 2" - - "unbreaking: 3" - material: player_head - skull-texture: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNWM0ODZhZjNiODgyNzY2ZTgyYTBiYzE2NjVmZjAyZWI2ZTg3M2I2ZTBkNzcxZjNhZGFiYzc1OWI3MjAyMjZhIn19fQ== - name: "&bYoung Helmet" - advanced-name: "Advanced&b Young Helmet" - effective-durability: 768 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&b&lYOUNG SET BONUS" - - "&8» &bMove 25% faster" - - "&8&oRequires full set to be worn above 50% health" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - diamond - - redstone - - diamond - - - redstone - - air - - redstone - - - air - - air - - air -chestplate: - enchants: - - "protection: 2" - - "unbreaking: 3" - material: leather_chestplate - leather-color: "#DDE4F0" - name: "&bYoung Chestplate" - advanced-name: "Advanced&b Young Chestplate" - effective-durability: 768 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&b&lYOUNG SET BONUS" - - "&8» &bMove 25% faster" - - "&8&oRequires full set to be worn above 50% health" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - diamond - - air - - diamond - - - redstone - - diamond - - redstone - - - diamond - - redstone - - diamond -elytra: - enchants: - - "unbreaking: 3" - material: elytra - name: "&bYoung Elytra" - advanced-name: "Advanced&b Young Elytra" - effective-durability: 768 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&b&lYOUNG SET BONUS" - - "&8» &bMove 25% faster" - - "&8&oRequires full set to be worn above 50% health" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - air - - redstone - - air - - - redstone - - elytra - - redstone - - - air - - redstone - - air -leggings: - enchants: - - "protection: 2" - - "unbreaking: 3" - material: leather_leggings - leather-color: "#DDE4F0" - name: "&bYoung Leggings" - advanced-name: "Advanced&b Young Leggings" - effective-durability: 768 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&b&lYOUNG SET BONUS" - - "&8» &bMove 25% faster" - - "&8&oRequires full set to be worn above 50% health" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - diamond - - redstone - - diamond - - - redstone - - air - - redstone - - - diamond - - air - - diamond -boots: - enchants: - - "protection: 2" - - "unbreaking: 3" - - "depth_strider: 3" - material: leather_boots - leather-color: "#DDE4F0" - name: "&bYoung Boots" - advanced-name: "Advanced&b Young Boots" - effective-durability: 768 - unbreakable: false - flags: [ ] - custom-model-data: -1 - lore: - - "&b&lYOUNG SET BONUS" - - "&8» &bMove 25% faster" - - "&8&oRequires full set to be worn above 50% health" - - "" - - "&fTier: %tier%" - - "&8&oUpgrade with an Upgrade Crystal" - craftable: true - default-tier: default - recipe: - - air - - air - - air - - - diamond - - air - - diamond - - - redstone - - air - - redstone From 9e8880c986628ab136d86e2ae8f611f8ab2bbc64 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 18 Jun 2021 08:51:13 +0100 Subject: [PATCH 07/25] Added /eaeditor and combined sets.json and tiers.json into ecoarmor.json --- .../com/willfp/ecoarmor/EcoArmorPlugin.java | 18 +- .../ecoarmor/commands/CommandEaeditor.java | 30 + .../{TiersJson.java => EcoArmorJson.java} | 6 +- .../com/willfp/ecoarmor/config/SetsJson.java | 16 - .../com/willfp/ecoarmor/sets/ArmorSets.java | 2 +- .../com/willfp/ecoarmor/upgrades/Tiers.java | 2 +- .../resources/{sets.json => ecoarmor.json} | 599 +++++++++++++++++ .../core-plugin/src/main/resources/lang.yml | 3 +- .../core-plugin/src/main/resources/plugin.yml | 7 + .../core-plugin/src/main/resources/tiers.json | 601 ------------------ 10 files changed, 649 insertions(+), 635 deletions(-) create mode 100644 eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java rename eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/{TiersJson.java => EcoArmorJson.java} (64%) delete mode 100644 eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/SetsJson.java rename eco-core/core-plugin/src/main/resources/{sets.json => ecoarmor.json} (61%) delete mode 100644 eco-core/core-plugin/src/main/resources/tiers.json 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 d6189cb..a3893b7 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 @@ -5,12 +5,12 @@ import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.command.AbstractCommand; import com.willfp.eco.core.display.DisplayModule; import com.willfp.eco.core.integrations.IntegrationLoader; +import com.willfp.ecoarmor.commands.CommandEaeditor; import com.willfp.ecoarmor.commands.CommandEagive; 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.config.EcoArmorJson; import com.willfp.ecoarmor.display.ArmorDisplay; import com.willfp.ecoarmor.effects.Effect; import com.willfp.ecoarmor.effects.Effects; @@ -38,17 +38,11 @@ public class EcoArmorPlugin extends EcoPlugin { @Getter private static EcoArmorPlugin instance; - /** - * sets.json. - */ - @Getter - private final SetsJson setsJson; - /** * tiers.json. */ @Getter - private final TiersJson tiersJson; + private final EcoArmorJson ecoArmorJson; /** * Internal constructor called by bukkit on plugin load. @@ -57,8 +51,7 @@ public class EcoArmorPlugin extends EcoPlugin { super("EcoArmor", 88246, 10002, "com.willfp.ecoarmor.proxy", "&c"); instance = this; - this.setsJson = new SetsJson(this); - this.tiersJson = new TiersJson(this); + this.ecoArmorJson = new EcoArmorJson(this); } /** @@ -133,7 +126,8 @@ public class EcoArmorPlugin extends EcoPlugin { public List getCommands() { return Arrays.asList( new CommandEareload(this), - new CommandEagive(this) + new CommandEagive(this), + new CommandEaeditor(this) ); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java new file mode 100644 index 0000000..6b14615 --- /dev/null +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java @@ -0,0 +1,30 @@ +package com.willfp.ecoarmor.commands; + +import com.willfp.eco.core.EcoPlugin; +import com.willfp.eco.core.command.AbstractCommand; +import com.willfp.eco.core.web.Paste; +import com.willfp.ecoarmor.EcoArmorPlugin; +import org.bukkit.command.CommandSender; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +public class CommandEaeditor extends AbstractCommand { + /** + * Instantiate a new /eaeditor command handler. + * + * @param plugin The plugin for the commands to listen for. + */ + public CommandEaeditor(@NotNull final EcoPlugin plugin) { + super(plugin, "eaeditor", "ecoarmor.editor", false); + } + + @Override + public void onExecute(@NotNull final CommandSender sender, + @NotNull final List args) { + String token = new Paste(((EcoArmorPlugin) this.getPlugin()).getEcoArmorJson().toPlaintext()).getHastebinToken(); + String message = this.getPlugin().getLangYml().getMessage("open-editor") + .replace("%url%", "https://auxilor.io/editor/ecoarmor?token=" + token); + sender.sendMessage(message); + } +} 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/EcoArmorJson.java similarity index 64% rename from eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/TiersJson.java rename to eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/EcoArmorJson.java index 669eee1..e29b167 100644 --- 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/EcoArmorJson.java @@ -4,13 +4,13 @@ import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.config.JsonStaticBaseConfig; import org.jetbrains.annotations.NotNull; -public class TiersJson extends JsonStaticBaseConfig { +public class EcoArmorJson extends JsonStaticBaseConfig { /** * Create tiers.json. * * @param plugin Instance of EcoArmor. */ - public TiersJson(@NotNull final EcoPlugin plugin) { - super("tiers", plugin); + public EcoArmorJson(@NotNull final EcoPlugin plugin) { + super("ecoarmor", plugin); } } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/SetsJson.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/SetsJson.java deleted file mode 100644 index 6e86674..0000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/config/SetsJson.java +++ /dev/null @@ -1,16 +0,0 @@ -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 SetsJson extends JsonStaticBaseConfig { - /** - * Create sets.json. - * - * @param plugin Instance of EcoArmor. - */ - public SetsJson(@NotNull final EcoPlugin plugin) { - super("sets", plugin); - } -} 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 b260fef..3b70e98 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 @@ -51,7 +51,7 @@ public class ArmorSets { removeSet(set); } - for (JSONConfig setConfig : plugin.getSetsJson().getSubsections("sets")) { + for (JSONConfig setConfig : plugin.getEcoArmorJson().getSubsections("sets")) { addNewSet(new ArmorSet(setConfig, plugin)); } } 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 e5eec3b..ff44169 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 @@ -65,7 +65,7 @@ public class Tiers { public static void reload(@NotNull final EcoArmorPlugin plugin) { BY_NAME.clear(); - for (JSONConfig tierConfig : plugin.getTiersJson().getSubsections("tiers")) { + for (JSONConfig tierConfig : plugin.getEcoArmorJson().getSubsections("tiers")) { addNewTier(new Tier(tierConfig, plugin)); } diff --git a/eco-core/core-plugin/src/main/resources/sets.json b/eco-core/core-plugin/src/main/resources/ecoarmor.json similarity index 61% rename from eco-core/core-plugin/src/main/resources/sets.json rename to eco-core/core-plugin/src/main/resources/ecoarmor.json index 57485f6..9bfdfa8 100644 --- a/eco-core/core-plugin/src/main/resources/sets.json +++ b/eco-core/core-plugin/src/main/resources/ecoarmor.json @@ -1,4 +1,603 @@ { + "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 + } + } + } + ], "sets": [ { "name": "ender", diff --git a/eco-core/core-plugin/src/main/resources/lang.yml b/eco-core/core-plugin/src/main/resources/lang.yml index c29d2d4..8fe7ce4 100644 --- a/eco-core/core-plugin/src/main/resources/lang.yml +++ b/eco-core/core-plugin/src/main/resources/lang.yml @@ -7,4 +7,5 @@ messages: invalid-player: "&cInvalid player!" needs-item: "&cYou must specify an item!" invalid-item: "&cInvalid item!" - give-success: "Gave &a%item%&r to &a%recipient%" \ No newline at end of file + give-success: "Gave &a%item%&r to &a%recipient%" + open-editor: "Open the editor here: &a%url%" \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/plugin.yml b/eco-core/core-plugin/src/main/resources/plugin.yml index 3709680..a3f2589 100644 --- a/eco-core/core-plugin/src/main/resources/plugin.yml +++ b/eco-core/core-plugin/src/main/resources/plugin.yml @@ -29,6 +29,9 @@ commands: eagive: description: Give a player a set permission: ecoarmor.give + eaeditor: + description: Open the editor + permission: ecoarmor.editor permissions: ecoarmor.*: @@ -38,6 +41,7 @@ permissions: ecoarmor.reload: true ecoarmor.give: true ecoarmor.noflydisable: true + ecoarmor.editor: true ecoarmor.reload: description: Allows reloading the config @@ -48,3 +52,6 @@ permissions: ecoarmor.noflydisable: description: Prevents losing fly. default: op + ecoarmor.editor: + description: Allows the user of /eaeditor. + default: op diff --git a/eco-core/core-plugin/src/main/resources/tiers.json b/eco-core/core-plugin/src/main/resources/tiers.json deleted file mode 100644 index dcb5884..0000000 --- a/eco-core/core-plugin/src/main/resources/tiers.json +++ /dev/null @@ -1,601 +0,0 @@ -{ - "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 From 5ae91f88cbb2d9b184f31847522f434e29173022 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 18 Jun 2021 08:54:52 +0100 Subject: [PATCH 08/25] Fixed set loading --- .../core-plugin/src/main/resources/ecoarmor.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eco-core/core-plugin/src/main/resources/ecoarmor.json b/eco-core/core-plugin/src/main/resources/ecoarmor.json index 9bfdfa8..e4f606f 100644 --- a/eco-core/core-plugin/src/main/resources/ecoarmor.json +++ b/eco-core/core-plugin/src/main/resources/ecoarmor.json @@ -859,13 +859,13 @@ { "name": "miner", "conditions": [], - "set-bonus": [ + "effects": [ { "id": "experience-multiplier", "args": 1.25 } ], - "advanced-set-bonus": [ + "advanced-effects": [ { "id": "hunger-loss-multiplier", "args": 0.5 @@ -1116,13 +1116,13 @@ { "name": "reaper", "conditions": [], - "set-bonus": [ + "effects": [ { "id": "damage-multiplier", "args": 1.25 } ], - "advanced-set-bonus": [ + "advanced-effects": [ { "id": "damage-taken-multiplier", "args": 0.9 @@ -1360,13 +1360,13 @@ "args": 50 } ], - "set-bonus": [ + "effects": [ { "id": "speed-multiplier", "args": 1.25 } ], - "advanced-set-bonus": [ + "advanced-effects": [ { "id": "speed-multiplier", "args": 1.5 From 437a931848215434a005839f7c72240b3456dec2 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 18 Jun 2021 08:57:44 +0100 Subject: [PATCH 09/25] Fixed set loading --- eco-core/core-plugin/src/main/resources/ecoarmor.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eco-core/core-plugin/src/main/resources/ecoarmor.json b/eco-core/core-plugin/src/main/resources/ecoarmor.json index e4f606f..2343cac 100644 --- a/eco-core/core-plugin/src/main/resources/ecoarmor.json +++ b/eco-core/core-plugin/src/main/resources/ecoarmor.json @@ -1128,6 +1128,10 @@ "args": 0.9 } ], + "potion-effects": [ + ], + "advanced-potion-effects": [ + ], "advanced-lore": [ "", "&lADVANCED BONUS", @@ -1372,6 +1376,8 @@ "args": 1.5 } ], + "potion-effects": [ + ], "advanced-potion-effects": [ { "id": "jump", From ca347113b6c5c5ac4fd0a028cab2208dc422019b Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 18 Jun 2021 08:59:51 +0100 Subject: [PATCH 10/25] Fixed invalid set config --- eco-core/core-plugin/src/main/resources/ecoarmor.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eco-core/core-plugin/src/main/resources/ecoarmor.json b/eco-core/core-plugin/src/main/resources/ecoarmor.json index 2343cac..746decf 100644 --- a/eco-core/core-plugin/src/main/resources/ecoarmor.json +++ b/eco-core/core-plugin/src/main/resources/ecoarmor.json @@ -1159,7 +1159,7 @@ "enchants": [ { "id": "protection", - "level": "4" + "level": 4 }, { "id": "unbreaking", @@ -1200,7 +1200,7 @@ "enchants": [ { "id": "protection", - "level": "4" + "level": 4 }, { "id": "unbreaking", @@ -1277,7 +1277,7 @@ "enchants": [ { "id": "protection", - "level": "4" + "level": 4 }, { "id": "unbreaking", @@ -1318,7 +1318,7 @@ "enchants": [ { "id": "protection", - "level": "4" + "level": 4 }, { "id": "unbreaking", From c4213abb2ba442c56270dd0cabb5d270fc58f3e9 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 18 Jun 2021 11:45:21 +0100 Subject: [PATCH 11/25] Fixed conditions --- .../com/willfp/ecoarmor/sets/ArmorSet.java | 14 +++------- .../willfp/ecoarmor/sets/util/ArmorUtils.java | 26 ------------------- 2 files changed, 4 insertions(+), 36 deletions(-) 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 a7f3689..de38186 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 @@ -126,16 +126,10 @@ public class ArmorSet { 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("conditions")) { + Condition effect = Conditions.getByName(cfg.getString("id")); + Object value = cfg.get("args"); + conditions.put(effect, value); } for (JSONConfig cfg : this.getConfig().getSubsections("effects")) { 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 5f339d7..e7a66ec 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 @@ -401,30 +401,4 @@ public class ArmorUtils { return ArmorSets.getByName(shardSet); } - - /** - * Get value of condition. - * - * @param string Value as string. - * @param condition Condition. - * @param The type of the condition. - * @return Value. - */ - @NotNull - public static Object getConditionValue(@NotNull final String string, - @NotNull final Condition condition) { - if (condition.getTypeClass().equals(Boolean.class)) { - return Boolean.parseBoolean(string); - } - - if (condition.getTypeClass().equals(Integer.class)) { - return Integer.parseInt(string); - } - - if (condition.getTypeClass().equals(Double.class)) { - return Double.parseDouble(string); - } - - return string; - } } From 437560b0f03af0e73fff36d60206b9c2510b75a9 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 19 Jun 2021 11:55:06 +0100 Subject: [PATCH 12/25] Changed json to camelCase --- .../src/main/resources/ecoarmor.json | 748 +++++++++--------- 1 file changed, 374 insertions(+), 374 deletions(-) diff --git a/eco-core/core-plugin/src/main/resources/ecoarmor.json b/eco-core/core-plugin/src/main/resources/ecoarmor.json index 746decf..670daa0 100644 --- a/eco-core/core-plugin/src/main/resources/ecoarmor.json +++ b/eco-core/core-plugin/src/main/resources/ecoarmor.json @@ -4,9 +4,9 @@ "name": "default", "display": "&8&lDEFAULT", "requires-tiers": [], - "crystal-craftable": false, - "crystal-name": "&8Default Upgrade Crystal", - "crystal-recipe": [ + "crystalCraftable": false, + "crystalName": "&8Default Upgrade Crystal", + "crystalRecipe": [ "air", "leather", "air", @@ -17,8 +17,8 @@ "leather", "air" ], - "recipe-give-amount": 1, - "crystal-lore": [ + "recipeGiveAmount": 1, + "crystalLore": [ "&8Drop this onto an armor piece", "&8to set its tier to:", "&8&lDEFAULT" @@ -27,47 +27,47 @@ "helmet": { "armor": 1, "toughness": 0, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "chestplate": { "armor": 3, "toughness": 0, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "elytra": { "armor": 0, "toughness": 0, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedpercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "leggings": { "armor": 2, "toughness": 0, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "boots": { "armor": 1, "toughness": 0, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 } } }, @@ -77,9 +77,9 @@ "requires-tiers": [ "default" ], - "crystal-craftable": true, - "crystal-name": "&7Iron Upgrade Crystal", - "crystal-recipe": [ + "crystalCraftable": true, + "crystalName": "&7Iron Upgrade Crystal", + "crystalRecipe": [ "air", "iron_block", "air", @@ -90,8 +90,8 @@ "iron_block", "air" ], - "recipe-give-amount": 1, - "crystal-lore": [ + "recipeGiveAmount": 1, + "crystalLore": [ "&8Drop this onto an armor piece", "&8to set its tier to:", "&7&lIRON", @@ -102,59 +102,59 @@ "helmet": { "armor": 2, "toughness": 0, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "chestplate": { "armor": 6, "toughness": 0, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "elytra": { "armor": 2, "toughness": 0, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "leggings": { "armor": 5, "toughness": 0, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "boots": { "armor": 2, "toughness": 0, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 } } }, { "name": "diamond", "display": "&b&lDIAMOND", - "requires-tiers": [ + "requiresTiers": [ "iron" ], - "crystal-craftable": true, - "crystal-name": "&bDiamond Upgrade Crystal", - "crystal-recipe": [ + "crystalCraftable": true, + "crystalName": "&bDiamond Upgrade Crystal", + "crystalRecipe": [ "air", "diamond_block", "air", @@ -165,8 +165,8 @@ "diamond_block", "air" ], - "recipe-give-amount": 1, - "crystal-lore": [ + "recipeGiveAmount": 1, + "crystalLore": [ "&8Drop this onto an armor piece", "&8to set its tier to:", "&b&lDIAMOND", @@ -177,59 +177,59 @@ "helmet": { "armor": 3, "toughness": 2, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "chestplate": { "armor": 8, "toughness": 2, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "elytra": { "armor": 3, "toughness": 0, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "leggings": { "armor": 6, "toughness": 2, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "boots": { "armor": 3, "toughness": 2, - "knockback-resistance": 0, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 0, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 } } }, { "name": "netherite", "display": "&c&lNETHERITE", - "requires-tiers": [ + "requiresTiers": [ "diamond" ], - "crystal-craftable": true, - "crystal-name": "&cNetherite Upgrade Crystal", - "crystal-recipe": [ + "crystalCraftable": true, + "crystalName": "&cNetherite Upgrade Crystal", + "crystalRecipe": [ "air", "netherite_ingot", "air", @@ -240,8 +240,8 @@ "netherite_ingot", "air" ], - "recipe-give-amount": 1, - "crystal-lore": [ + "recipeGiveAmount": 1, + "crystalLore": [ "&8Drop this onto an armor piece", "&8to set its tier to:", "&c&lNETHERITE", @@ -252,47 +252,47 @@ "helmet": { "armor": 3, "toughness": 3, - "knockback-resistance": 1, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 1, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "chestplate": { "armor": 8, "toughness": 3, - "knockback-resistance": 1, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 1, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "elytra": { "armor": 3, "toughness": 0, - "knockback-resistance": 1, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 1, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "leggings": { "armor": 6, "toughness": 3, - "knockback-resistance": 1, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 1, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "boots": { "armor": 3, "toughness": 3, - "knockback-resistance": 1, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 1, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 } } }, @@ -300,12 +300,12 @@ "name": "manyullyn", "enabled": true, "display": "&d&k!!&r &lMANYULLYN&r &d&k!!&r", - "requires-tiers": [ + "requiresTiers": [ "netherite" ], - "crystal-craftable": true, - "crystal-name": "Manyullyn Upgrade Crystal", - "crystal-recipe": [ + "crystalCraftable": true, + "crystalName": "Manyullyn Upgrade Crystal", + "crystalRecipe": [ "ecoarmor:upgrade_crystal_netherite", "enchanted_golden_apple", "ecoarmor:upgrade_crystal_netherite", @@ -316,8 +316,8 @@ "enchanted_golden_apple", "ecoarmor:upgrade_crystal_netherite" ], - "recipe-give-amount": 1, - "crystal-lore": [ + "recipeGiveAmount": 1, + "crystalLore": [ "&8Drop this onto an armor piece", "&8to set its tier to:", "&d&k!!&r &lMANYULLYN&r &d&k!!&r", @@ -328,59 +328,59 @@ "helmet": { "armor": 3, "toughness": 5, - "knockback-resistance": 2, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 2, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "chestplate": { "armor": 8, "toughness": 5, - "knockback-resistance": 2, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 2, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "elytra": { "armor": 3, "toughness": 0, - "knockback-resistance": 2, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 2, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "leggings": { "armor": 6, "toughness": 5, - "knockback-resistance": 2, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 2, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 }, "boots": { "armor": 3, "toughness": 5, - "knockback-resistance": 2, - "speed-percentage": 0, - "attack-speed-percentage": 0, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 0 + "knockbackResistance": 2, + "speedPercentage": 0, + "attackSpeedPercentage": 0, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 0 } } }, { "name": "cobalt", "display": "/ab&lCOBALT", - "requires-tiers": [ + "requiresTiers": [ "iron" ], - "crystal-craftable": true, - "crystal-name": "/abCobalt Upgrade Crystal", - "crystal-recipe": [ + "crystalCraftable": true, + "crystalName": "/abCobalt Upgrade Crystal", + "crystalRecipe": [ "air", "obsidian", "air", @@ -391,8 +391,8 @@ "obsidian", "air" ], - "recipe-give-amount": 1, - "crystal-lore": [ + "recipeGiveAmount": 1, + "crystalLore": [ "&8Drop this onto an armor piece", "&8to set its tier to:", "/ab&lCOBALT", @@ -403,59 +403,59 @@ "helmet": { "armor": 3, "toughness": 4, - "knockback-resistance": 1, - "speed-percentage": -10, - "attack-speed-percentage": -10, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 10 + "knockbackResistance": 1, + "speedPercentage": -10, + "attackSpeedPercentage": -10, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 10 }, "chestplate": { "armor": 8, "toughness": 4, - "knockback-resistance": 1, - "speed-percentage": -10, - "attack-speed-percentage": -10, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 10 + "knockbackResistance": 1, + "speedPercentage": -10, + "attackSpeedPercentage": -10, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 10 }, "elytra": { "armor": 6, "toughness": 2, - "knockback-resistance": 1, - "speed-percentage": -10, - "attack-speed-percentage": -10, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 10 + "knockbackResistance": 1, + "speedPercentage": -10, + "attackSpeedPercentage": -10, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 10 }, "leggings": { "armor": 6, "toughness": 4, - "knockback-resistance": 1, - "speed-percentage": -10, - "attack-speed-percentage": -1, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 10 + "knockbackResistance": 1, + "speedPercentage": -10, + "attackSpeedPercentage": -1, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 10 }, "boots": { "armor": 3, "toughness": 4, - "knockback-resistance": 1, - "speed-percentage": -10, - "attack-speed-percentage": -10, - "attack-damage-percentage": 0, - "attack-knockback-percentage": 10 + "knockbackResistance": 1, + "speedPercentage": -10, + "attackSpeedPercentage": -10, + "attackDamagePercentage": 0, + "attackKnockbackPercentage": 10 } } }, { "name": "osmium", "display": "&b&k!!&r &lOSMIUM&r &b&k!!", - "requires-tiers": [ + "requiresTiers": [ "cobalt" ], - "crystal-craftable": true, - "crystal-name": "Osmium upgrade crystal", - "crystal-recipe": [ + "crystalCraftable": true, + "crystalName": "Osmium upgrade crystal", + "crystalRecipe": [ "air", "netherite_block", "air", @@ -466,8 +466,8 @@ "netherite_block", "air" ], - "recipe-give-amount": 1, - "crystal-lore": [ + "recipeGiveAmount": 1, + "crystalLore": [ "&8Drop this onto an armor piece", "&8to set its tier to:", "&b&k!!&r &lOSMIUM&r &b&k!!", @@ -478,59 +478,59 @@ "helmet": { "armor": 3, "toughness": 6, - "knockback-resistance": 3, - "speed-percentage": -15, - "attack-speed-percentage": -15, - "attack-damage-percentage": 5, - "attack-knockback-percentage": 25 + "knockbackResistance": 3, + "speedPercentage": -15, + "attackSpeedPercentage": -15, + "attackDamagePercentage": 5, + "attackKnockbackPercentage": 25 }, "chestplate": { "armor": 8, "toughness": 6, - "knockback-resistance": 3, - "speed-percentage": -15, - "attack-speed-percentage": -15, - "attack-damage-percentage": 5, - "attack-knockback-percentage": 25 + "knockbackResistance": 3, + "speedPercentage": -15, + "attackSpeedPercentage": -15, + "attackDamagePercentage": 5, + "attackKnockbackPercentage": 25 }, "elytra": { "armor": 8, "toughness": 6, - "knockback-resistance": 3, - "speed-percentage": -15, - "attack-speed-percentage": -15, - "attack-damage-percentage": 5, - "attack-knockback-percentage": 25 + "knockbackResistance": 3, + "speedPercentage": -15, + "attackSpeedPercentage": -15, + "attackDamagePercentage": 5, + "attackKnockbackPercentage": 25 }, "leggings": { "armor": 6, "toughness": 6, - "knockback-resistance": 3, - "speed-percentage": -15, - "attack-speed-percentage": -15, - "attack-damage-percentage": 5, - "attack-knockback-percentage": 25 + "knockbackResistance": 3, + "speedPercentage": -15, + "attackSpeedPercentage": -15, + "attackDamagePercentage": 5, + "attackKnockbackPercentage": 25 }, "boots": { "armor": 3, "toughness": 6, - "knockback-resistance": 3, - "speed-percentage": -15, - "attack-speed-percentage": -15, - "attack-damage-percentage": 5, - "attack-knockback-percentage": 25 + "knockbackResistance": 3, + "speedPercentage": -15, + "attackSpeedPercentage": -15, + "attackDamagePercentage": 5, + "attackKnockbackPercentage": 25 } } }, { "name": "exotic", "display": "&6&k!!&r &lEXOTIC&r &6&k!!&r", - "requires-tiers": [ + "requiresTiers": [ "netherite" ], - "crystal-craftable": true, - "crystal-name": "Exotic Upgrade Crystal", - "crystal-recipe": [ + "crystalCraftable": true, + "crystalName": "Exotic Upgrade Crystal", + "crystalRecipe": [ "ecoarmor:upgrade_crystal_netherite", "turtle_egg", "ecoarmor:upgrade_crystal_netherite", @@ -541,8 +541,8 @@ "turtle_egg", "ecoarmor:upgrade_crystal_netherite" ], - "recipe-give-amount": 1, - "crystal-lore": [ + "recipeGiveAmount": 1, + "crystalLore": [ "&8Drop this onto an armor piece", "&8to set its tier to:", "&6&k!!&r &lEXOTIC&r &6&k!!&r", @@ -553,47 +553,47 @@ "helmet": { "armor": 3, "toughness": 2, - "knockback-resistance": 0, - "speed-percentage": 5, - "attack-speed-percentage": 10, - "attack-damage-percentage": -5, - "attack-knockback-percentage": -20 + "knockbackResistance": 0, + "speedPercentage": 5, + "attackSpeedPercentage": 10, + "attackDamagePercentage": -5, + "attackKnockbackPercentage": -20 }, "chestplate": { "armor": 8, "toughness": 2, - "knockback-resistance": 0, - "speed-percentage": 5, - "attack-speed-percentage": 10, - "attack-damage-percentage": -5, - "attack-knockback-percentage": -20 + "knockbackResistance": 0, + "speedPercentage": 5, + "attackSpeedPercentage": 10, + "attackDamagePercentage": -5, + "attackKnockbackPercentage": -20 }, "elytra": { "armor": 3, "toughness": 0, - "knockback-resistance": 0, - "speed-percentage": 5, - "attack-speed-percentage": 10, - "attack-damage-percentage": -5, - "attack-knockback-percentage": -20 + "knockbackResistance": 0, + "speedPercentage": 5, + "attackSpeedPercentage": 10, + "attackDamagePercentage": -5, + "attackKnockbackPercentage": -20 }, "leggings": { "armor": 6, "toughness": 2, - "knockback-resistance": 0, - "speed-percentage": 5, - "attack-speed-percentage": 10, - "attack-damage-percentage": -5, - "attack-knockback-percentage": -20 + "knockbackResistance": 0, + "speedPercentage": 5, + "attackSpeedPercentage": 10, + "attackDamagePercentage": -5, + "attackKnockbackPercentage": -20 }, "boots": { "armor": 3, "toughness": 2, - "knockback-resistance": 0, - "speed-percentage": 5, - "attack-speed-percentage": 10, - "attack-damage-percentage": -5, - "attack-knockback-percentage": -20 + "knockbackResistance": 0, + "speedPercentage": 5, + "attackSpeedPercentage": 10, + "attackDamagePercentage": -5, + "attackKnockbackPercentage": -20 } } } @@ -612,7 +612,7 @@ "args": 10 } ], - "advanced-effects": [ + "advancedEffects": [ { "id": "warp-chance", "args": 30 @@ -622,24 +622,24 @@ "args": 20 } ], - "potion-effects": [ + "potionEffects": [ ], - "advanced-potion-effects": [ + "advancedPotionEffects": [ ], - "advanced-lore": [ + "advancedLore": [ "", "&lADVANCED BONUS", "&8» &330% Chance to warp behind your opponent", "&8» &320% Chance to evade attacks", "&8&oRequires full set to be worn" ], - "advancement-shard-name": "Advancement Shard: &3Ender", - "advancement-shard-lore": [ + "advancementShardName": "Advancement Shard: &3Ender", + "advancementShardLore": [ "&8Drop this onto &3Ender Armor", "&8to make it Advanced." ], - "shard-craftable": true, - "shard-recipe": [ + "shardCraftable": true, + "shardRecipe": [ "prismarine_shard", "ecoarmor:set_ender_helmet", "prismarine_shard", @@ -662,13 +662,13 @@ } ], "material": "player_head", - "skull-texture": "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGFhOGZjOGRlNjQxN2I0OGQ0OGM4MGI0NDNjZjUzMjZlM2Q5ZGE0ZGJlOWIyNWZjZDQ5NTQ5ZDk2MTY4ZmMwIn19fQ==", + "skullTexture": "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGFhOGZjOGRlNjQxN2I0OGQ0OGM4MGI0NDNjZjUzMjZlM2Q5ZGE0ZGJlOWIyNWZjZDQ5NTQ5ZDk2MTY4ZmMwIn19fQ==", "name": "&bEnder Helmet", - "advanced-name": "Advanced&3 Ender Helmet", - "effective-durability": 1024, + "advancedName": "Advanced&3 Ender Helmet", + "effectiveDurability": 1024, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&3&lENDER SET BONUS", "&8» &320% Chance to warp behind your opponent", @@ -679,7 +679,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "ender_eye", "ender_eye", @@ -704,13 +704,13 @@ } ], "material": "leather_chestplate", - "leather-color": "#0d6961", + "leatherColor": "#0d6961", "name": "&3Ender Chestplate", - "advanced-name": "Advanced&3 Ender Chestplate", - "effective-durability": 1024, + "advancedName": "Advanced&3 Ender Chestplate", + "effectiveDurability": 1024, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&3&lENDER SET BONUS", "&8» &320% Chance to warp behind your opponent", @@ -721,7 +721,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "diamond", + "defaultTier": "diamond", "recipe": [ "ender_eye", "ender_eye", @@ -743,11 +743,11 @@ ], "material": "elytra", "name": "&3Ender Elytra", - "advanced-name": "Advanced&3 Ender Elytra", - "effective-durability": 1024, + "advancedName": "Advanced&3 Ender Elytra", + "effectiveDurability": 1024, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&3&lENDER SET BONUS", "&8» &320% Chance to warp behind your opponent", @@ -758,7 +758,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "ender_eye", "ender_eye", @@ -783,13 +783,13 @@ } ], "material": "leather_leggings", - "leather-color": "#0d6961", + "leatherColor": "#0d6961", "name": "&3Ender Leggings", - "advanced-name": "Advanced&3 Ender Leggings", - "effective-durability": 1024, + "advancedName": "Advanced&3 Ender Leggings", + "effectiveDurability": 1024, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&3&lENDER SET BONUS", "&8» &320% Chance to warp behind your opponent", @@ -800,7 +800,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "ender_eye", "ender_eye", @@ -825,13 +825,13 @@ } ], "material": "leather_boots", - "leather-color": "#0d6961", + "leatherColor": "#0d6961", "name": "&3Ender Boots", - "advanced-name": "Advanced&3 Ender Boots", - "effective-durability": 1024, + "advancedName": "Advanced&3 Ender Boots", + "effectiveDurability": 1024, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&3&lENDER SET BONUS", "&8» &320% Chance to warp behind your opponent", @@ -842,7 +842,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "ender_eye", "ender_eye", @@ -865,38 +865,38 @@ "args": 1.25 } ], - "advanced-effects": [ + "advancedEffects": [ { "id": "hunger-loss-multiplier", "args": 0.5 } ], - "potion-effects": [ + "potionEffects": [ { "id": "FAST_DIGGING", "args": 2 } ], - "advanced-potion-effects": [ + "advancedPotionEffects": [ { "id": "FAST_DIGGING", "args": 3 } ], - "advanced-lore": [ + "advancedLore": [ "", "&lADVANCED BONUS", "&8» &6Lose 50% less hunger", "&8» &6Permanent Haste III", "&8&oRequires full set to be worn" ], - "advancement-shard-name": "Advancement Shard: &9Miner", - "advancement-shard-lore": [ + "advancementShardName": "Advancement Shard: &9Miner", + "advancementShardLore": [ "&8Drop this onto &9Miner Armor", "&8to make it Advanced." ], - "shard-craftable": true, - "shard-recipe": [ + "shardCraftable": true, + "shardRecipe": [ "prismarine_shard", "ecoarmor:set_miner_helmet", "prismarine_shard", @@ -919,13 +919,13 @@ } ], "material": "leather_helmet", - "leather-color": "#6699cc", + "leatherColor": "#6699cc", "name": "&9Miner Helmet", - "advanced-name": "Advanced&9 Miner Helmet", - "effective-durability": 1024, + "advancedName": "Advanced&9 Miner Helmet", + "effectiveDurability": 1024, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&9&lMINER SET BONUS", "&8» &9Gain 50% more experience", @@ -936,7 +936,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "air", "diamond_pickaxe", @@ -961,13 +961,13 @@ } ], "material": "leather_chestplate", - "leather-color": "#6699cc", + "leatherColor": "#6699cc", "name": "&9Miner Chestplate", - "advanced-name": "Advanced&9 Miner Chestplate", - "effective-durability": 1024, + "advancedName": "Advanced&9 Miner Chestplate", + "effectiveDurability": 1024, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&9&lMINER SET BONUS", "&8» &9Gain 50% more experience", @@ -978,7 +978,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "air", "diamond_pickaxe", @@ -1000,11 +1000,11 @@ ], "material": "elytra", "name": "&9Miner Elytra", - "advanced-name": "Advanced&9 Miner Elytra", - "effective-durability": 1024, + "advancedName": "Advanced&9 Miner Elytra", + "effectiveDurability": 1024, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&9&lMINER SET BONUS", "&8» &9Gain 50% more experience", @@ -1015,7 +1015,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "air", "diamond_pickaxe", @@ -1040,13 +1040,13 @@ } ], "material": "leather_leggings", - "leather-color": "#6699cc", + "leatherColor": "#6699cc", "name": "&9Miner Leggings", - "advanced-name": "Advanced&9 Miner Leggings", - "effective-durability": 1024, + "advancedName": "Advanced&9 Miner Leggings", + "effectiveDurability": 1024, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&9&lMINER SET BONUS", "&8» &9Gain 50% more experience", @@ -1057,7 +1057,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "air", "diamond_pickaxe", @@ -1082,13 +1082,13 @@ } ], "material": "leather_boots", - "leather-color": "#6699cc", + "leatherColor": "#6699cc", "name": "&9Miner Boots", - "advanced-name": "Advanced&9 Miner Boots", - "effective-durability": 1024, + "advancedName": "Advanced&9 Miner Boots", + "effectiveDurability": 1024, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModeldata": -1, "lore": [ "&9&lMINER SET BONUS", "&8» &9Gain 50% more experience", @@ -1099,7 +1099,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "air", "diamond_pickaxe", @@ -1122,29 +1122,29 @@ "args": 1.25 } ], - "advanced-effects": [ + "advancedEffects": [ { "id": "damage-taken-multiplier", "args": 0.9 } ], - "potion-effects": [ + "potionEffects": [ ], - "advanced-potion-effects": [ + "advancedPotionEffects": [ ], - "advanced-lore": [ + "advancedLore": [ "", "&lADVANCED BONUS", "&8» &6Take 10% less damage", "&8&oRequires full set to be worn" ], - "advancement-shard-name": "Advancement Shard: &cReaper", - "advancement-shard-lore": [ + "advancementShardName": "Advancement Shard: &cReaper", + "advancementShardLore": [ "&8Drop this onto &cReaper Armor", "&8to make it Advanced." ], - "shard-craftable": true, - "shard-recipe": [ + "shardCraftable": true, + "shardRecipe": [ "prismarine_shard", "ecoarmor:set_reaper_helmet", "prismarine_shard", @@ -1167,13 +1167,13 @@ } ], "material": "leather_helmet", - "leather-color": "#303030", + "leatherColor": "#303030", "name": "&cReaper Helmet", - "advanced-name": "Advanced&c Reaper Helmet", - "effective-durability": 2048, + "advancedName": "Advanced&c Reaper Helmet", + "effectiveDurability": 2048, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&c&lREAPER SET BONUS", "&8» &cDeal 25% more damage", @@ -1183,7 +1183,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "air", "nether_star", @@ -1208,13 +1208,13 @@ } ], "material": "leather_chestplate", - "leather-color": "#303030", + "leatherColor": "#303030", "name": "&cReaper Chestplate", - "advanced-name": "Advanced&c Reaper Chestplate", - "effective-durability": 2048, + "advancedName": "Advanced&c Reaper Chestplate", + "effectiveDurability": 2048, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&c&lREAPER SET BONUS", "&8» &cDeal 25% more damage", @@ -1224,7 +1224,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "air", "nether_star", @@ -1246,11 +1246,11 @@ ], "material": "elytra", "name": "&cReaper Elytra", - "advanced-name": "Advanced&c Reaper Elytra", - "effective-durability": 2048, + "advancedName": "Advanced&c Reaper Elytra", + "effectiveDurability": 2048, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&c&lREAPER SET BONUS", "&8» &cDeal 25% more damage", @@ -1260,7 +1260,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "air", "nether_star", @@ -1285,13 +1285,13 @@ } ], "material": "leather_leggings", - "leather-color": "#303030", + "leatherColor": "#303030", "name": "&cReaper Leggings", - "advanced-name": "Advanced&c Reaper Leggings", - "effective-durability": 2048, + "advancedName": "Advanced&c Reaper Leggings", + "effectiveDurability": 2048, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&c&lREAPER SET BONUS", "&8» &cDeal 25% more damage", @@ -1301,7 +1301,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "air", "nether_star", @@ -1326,13 +1326,13 @@ } ], "material": "leather_boots", - "leather-color": "#303030", + "leatherColor": "#303030", "name": "&cReaper Boots", - "advanced-name": "Advanced&c Reaper Boots", - "effective-durability": 2048, + "advancedName": "Advanced&c Reaper Boots", + "effectiveDurability": 2048, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&c&lREAPER SET BONUS", "&8» &cDeal 25% more damage", @@ -1342,7 +1342,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "air", "nether_star", @@ -1370,34 +1370,34 @@ "args": 1.25 } ], - "advanced-effects": [ + "advancedEffects": [ { "id": "speed-multiplier", "args": 1.5 } ], - "potion-effects": [ + "potionEffects": [ ], - "advanced-potion-effects": [ + "advancedPotionEffects": [ { "id": "jump", "args": 2 } ], - "advanced-lore": [ + "advancedLore": [ "", "&lADVANCED BONUS", "&8» &bPermanent Jump Boost II", "&8» &bMove 50% faster", "&8&oRequires full set to be worn above 50% health" ], - "advancement-shard-name": "Advancement Shard: &bYoung", - "advancement-shard-lore": [ + "advancementShardName": "Advancement Shard: &bYoung", + "advancementShardLore": [ "&8Drop this onto &bYoung Armor", "&8to make it Advanced." ], - "shard-craftable": true, - "shard-recipe": [ + "shardCraftable": true, + "shardRecipe": [ "prismarine_shard", "ecoarmor:set_young_helmet", "prismarine_shard", @@ -1420,13 +1420,13 @@ } ], "material": "player_head", - "skull-texture": "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNWM0ODZhZjNiODgyNzY2ZTgyYTBiYzE2NjVmZjAyZWI2ZTg3M2I2ZTBkNzcxZjNhZGFiYzc1OWI3MjAyMjZhIn19fQ==", + "skullTexture": "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNWM0ODZhZjNiODgyNzY2ZTgyYTBiYzE2NjVmZjAyZWI2ZTg3M2I2ZTBkNzcxZjNhZGFiYzc1OWI3MjAyMjZhIn19fQ==", "name": "&bYoung Helmet", - "advanced-name": "Advanced&b Young Helmet", - "effective-durability": 768, + "advancedName": "Advanced&b Young Helmet", + "effectiveDurability": 768, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&b&lYOUNG SET BONUS", "&8» &bMove 25% faster", @@ -1436,7 +1436,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "diamond", "redstone", @@ -1461,13 +1461,13 @@ } ], "material": "leather_chestplate", - "leather-color": "#DDE4F0", + "leatherColor": "#DDE4F0", "name": "&bYoung Chestplate", - "advanced-name": "Advanced&b Young Chestplate", - "effective-durability": 768, + "advancedName": "Advanced&b Young Chestplate", + "effectiveDurability": 768, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&b&lYOUNG SET BONUS", "&8» &bMove 25% faster", @@ -1477,7 +1477,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "diamond", "air", @@ -1499,11 +1499,11 @@ ], "material": "elytra", "name": "&bYoung Elytra", - "advanced-name": "Advanced&b Young Elytra", - "effective-durability": 768, + "advancedName": "Advanced&b Young Elytra", + "effectiveDurability": 768, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&b&lYOUNG SET BONUS", "&8» &bMove 25% faster", @@ -1513,7 +1513,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "air", "redstone", @@ -1538,13 +1538,13 @@ } ], "material": "leather_leggings", - "leather-color": "#DDE4F0", + "leatherColor": "#DDE4F0", "name": "&bYoung Leggings", - "advanced-name": "Advanced&b Young Leggings", - "effective-durability": 768, + "advancedName": "Advanced&b Young Leggings", + "effectiveDurability": 768, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&b&lYOUNG SET BONUS", "&8» &bMove 25% faster", @@ -1554,7 +1554,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "diamond", "redstone", @@ -1583,13 +1583,13 @@ } ], "material": "leather_boots", - "leather-color": "#DDE4F0", + "leatherColor": "#DDE4F0", "name": "&bYoung Boots", - "advanced-name": "Advanced&b Young Boots", - "effective-durability": 768, + "advancedName": "Advanced&b Young Boots", + "effectiveDurability": 768, "unbreakable": false, "flags": [], - "custom-model-data": -1, + "customModelData": -1, "lore": [ "&b&lYOUNG SET BONUS", "&8» &bMove 25% faster", @@ -1599,7 +1599,7 @@ "&8&oUpgrade with an Upgrade Crystal" ], "craftable": true, - "default-tier": "default", + "defaultTier": "default", "recipe": [ "air", "air", From ad92a61382bd363d81a004c6414314c4e6147192 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 19 Jun 2021 11:56:55 +0100 Subject: [PATCH 13/25] Changed to parse JSON camelcase --- .../com/willfp/ecoarmor/sets/ArmorSet.java | 34 +++++++++---------- .../com/willfp/ecoarmor/upgrades/Tier.java | 24 ++++++------- 2 files changed, 29 insertions(+), 29 deletions(-) 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 de38186..2a8ea0c 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 @@ -138,19 +138,19 @@ public class ArmorSet { effects.put(effect, value); } - for (JSONConfig cfg : this.getConfig().getSubsections("advanced-effects")) { + for (JSONConfig cfg : this.getConfig().getSubsections("advancedEffects")) { Effect effect = Effects.getByName(cfg.getString("id")); Object value = cfg.get("args"); advancedEffects.put(effect, value); } - for (JSONConfig cfg : this.getConfig().getSubsections("potion-effects")) { + for (JSONConfig cfg : this.getConfig().getSubsections("potionEffects")) { 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")) { + for (JSONConfig cfg : this.getConfig().getSubsections("advancedPotionEffects")) { PotionEffectType effect = PotionEffectType.getByName(cfg.getString("id").toUpperCase()); int level = cfg.getInt("level"); advancedPotionEffects.put(effect, level); @@ -171,19 +171,19 @@ public class ArmorSet { } 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")) + ItemStack shard = new ItemStackBuilder(Objects.requireNonNull(Material.getMaterial(this.getPlugin().getConfigYml().getString("advancementShardMaterial").toUpperCase()))) + .setDisplayName(this.getConfig().getString("advancementShardName")) .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) + .addLoreLines(this.getConfig().getStrings("advancementShardLore")) + .writeMetaKey(this.getPlugin().getNamespacedKeyFactory().create("advancementShard"), PersistentDataType.STRING, name) .build(); - if (this.getConfig().getBool("shard-craftable")) { + if (this.getConfig().getBool("shardCraftable")) { Recipes.createAndRegisterRecipe(this.getPlugin(), this.getName() + "_shard", shard, - this.getConfig().getStrings("shard-recipe")); + this.getConfig().getStrings("shardRecipe")); } return shard; @@ -204,7 +204,7 @@ public class ArmorSet { default -> new ItemStackBuilder(material); }; - builder.setDisplayName(advanced ? slotConfig.getString("advanced-name") : slotConfig.getString("name")) + builder.setDisplayName(advanced ? slotConfig.getString("advancedName") : slotConfig.getString("name")) .addItemFlag( slotConfig.getStrings("flags").stream() .map(s -> ItemFlag.valueOf(s.toUpperCase())) @@ -214,25 +214,25 @@ public class ArmorSet { .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()); + return slotConfig.getStrings("advancedLore").stream().map(s -> Display.PREFIX + s).collect(Collectors.toList()); } else { return null; } }) .setCustomModelData(() -> { - int data = slotConfig.getInt("custom-model-data"); + int data = slotConfig.getInt("customModelData"); return data != -1 ? data : null; }) - .setDisplayName(() -> advanced ? slotConfig.getString("advanced-name") : slotConfig.getString("name")); + .setDisplayName(() -> advanced ? slotConfig.getString("advancedName") : slotConfig.getString("name")); if (builder instanceof SkullBuilder skullBuilder) { - this.skullBase64 = slotConfig.getString("skull-texture"); + this.skullBase64 = slotConfig.getString("skullTexture"); skullBuilder.setSkullTexture(skullBase64); } if (builder instanceof LeatherArmorBuilder leatherArmorBuilder) { - String colorString = slotConfig.getString("leather-color"); + String colorString = slotConfig.getString("leatherColor"); java.awt.Color awtColor = java.awt.Color.decode(colorString); leatherArmorBuilder.setColor(awtColor); builder.addItemFlag(ItemFlag.HIDE_DYE); @@ -256,13 +256,13 @@ public class ArmorSet { ).writeMetaKey( this.getPlugin().getNamespacedKeyFactory().create("effective-durability"), PersistentDataType.INTEGER, - slotConfig.getInt("effective-durability") + slotConfig.getInt("effectiveDurability") ); ItemStack itemStack = builder.build(); ArmorUtils.setAdvanced(itemStack, advanced); - Tier defaultTier = Tiers.getByName(slotConfig.getString("default-tier")); + Tier defaultTier = Tiers.getByName(slotConfig.getString("defaultTier")); 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()); 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 c08948a..84bf170 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 @@ -96,21 +96,21 @@ public class Tier extends PluginDependent { * Update the tracker's crafting recipe. */ public void update() { - this.enabled = this.getConfig().getBool("crystal-craftable"); + this.enabled = this.getConfig().getBool("crystalCraftable"); this.displayName = this.getConfig().getString("display"); - this.requiredTiersForApplication = this.getConfig().getStrings("requires-tiers"); + this.requiredTiersForApplication = this.getConfig().getStrings("requiresTiers"); NamespacedKey key = this.getPlugin().getNamespacedKeyFactory().create("upgrade_crystal"); - ItemStack out = new ItemStack(Objects.requireNonNull(Material.getMaterial(this.getPlugin().getConfigYml().getString("upgrade-crystal-material").toUpperCase()))); + ItemStack out = new ItemStack(Objects.requireNonNull(Material.getMaterial(this.getPlugin().getConfigYml().getString("upgradeCrystalMaterial").toUpperCase()))); ItemMeta outMeta = out.getItemMeta(); assert outMeta != null; PersistentDataContainer container = outMeta.getPersistentDataContainer(); container.set(key, PersistentDataType.STRING, name); - outMeta.setDisplayName(this.getConfig().getString("crystal-name")); + outMeta.setDisplayName(this.getConfig().getString("crystalName")); List lore = new ArrayList<>(); - for (String loreLine : this.getConfig().getStrings("crystal-lore")) { + for (String loreLine : this.getConfig().getStrings("crystalLore")) { lore.add(Display.PREFIX + StringUtils.translate(loreLine)); } outMeta.setLore(lore); @@ -123,21 +123,21 @@ public class Tier extends PluginDependent { properties.put(slot, new TierProperties( this.getConfig().getInt("properties." + slot.name().toLowerCase() + ".armor"), this.getConfig().getInt("properties." + slot.name().toLowerCase() + ".toughness"), - this.getConfig().getInt("properties." + slot.name().toLowerCase() + ".knockback-resistance"), - this.getConfig().getInt("properties." + slot.name().toLowerCase() + ".speed-percentage"), - this.getConfig().getInt("properties." + slot.name().toLowerCase() + ".attack-speed-percentage"), - this.getConfig().getInt("properties." + slot.name().toLowerCase() + ".attack-damage-percentage"), - this.getConfig().getInt("properties." + slot.name().toLowerCase() + ".attack-knockback-percentage") + this.getConfig().getInt("properties." + slot.name().toLowerCase() + ".knockbackResistance"), + this.getConfig().getInt("properties." + slot.name().toLowerCase() + ".speedPercentage"), + this.getConfig().getInt("properties." + slot.name().toLowerCase() + ".attackSpeedPercentage"), + this.getConfig().getInt("properties." + slot.name().toLowerCase() + ".attackDamagePercentage"), + this.getConfig().getInt("properties." + slot.name().toLowerCase() + ".attackKnockbackPercentage") )); } if (this.isEnabled()) { ItemStack recipeOut = out.clone(); - recipeOut.setAmount(this.getConfig().getInt("recipe-give-amount")); + recipeOut.setAmount(this.getConfig().getInt("recipeGiveAmount")); ShapedCraftingRecipe.Builder builder = ShapedCraftingRecipe.builder(this.getPlugin(), "upgrade_crystal_" + name) .setOutput(recipeOut); - List recipeStrings = this.getConfig().getStrings("crystal-recipe"); + List recipeStrings = this.getConfig().getStrings("crystalRecipe"); new CustomItem(this.getPlugin().getNamespacedKeyFactory().create("upgrade_crystal_" + name), test -> { if (test == null) { From 8885ab61e6ec58a30854dfb1be00af4c6024776d Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 19 Jun 2021 11:58:10 +0100 Subject: [PATCH 14/25] Fixed camelCase --- eco-core/core-plugin/src/main/resources/ecoarmor.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eco-core/core-plugin/src/main/resources/ecoarmor.json b/eco-core/core-plugin/src/main/resources/ecoarmor.json index 670daa0..42cdb55 100644 --- a/eco-core/core-plugin/src/main/resources/ecoarmor.json +++ b/eco-core/core-plugin/src/main/resources/ecoarmor.json @@ -3,7 +3,7 @@ { "name": "default", "display": "&8&lDEFAULT", - "requires-tiers": [], + "requiresTiers": [], "crystalCraftable": false, "crystalName": "&8Default Upgrade Crystal", "crystalRecipe": [ @@ -74,7 +74,7 @@ { "name": "iron", "display": "&7&lIRON", - "requires-tiers": [ + "requiresTiers": [ "default" ], "crystalCraftable": true, From 3e0ac767a1c3c1a186ef8352765a8d471f49a915 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 24 Jun 2021 13:32:57 +0100 Subject: [PATCH 15/25] Added enchantments to json token --- .../com/willfp/ecoarmor/commands/CommandEaeditor.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java index 6b14615..0da2889 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java @@ -2,12 +2,17 @@ package com.willfp.ecoarmor.commands; import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.command.AbstractCommand; +import com.willfp.eco.core.config.JSONConfig; import com.willfp.eco.core.web.Paste; import com.willfp.ecoarmor.EcoArmorPlugin; +import org.bukkit.NamespacedKey; import org.bukkit.command.CommandSender; +import org.bukkit.enchantments.Enchantment; import org.jetbrains.annotations.NotNull; +import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; public class CommandEaeditor extends AbstractCommand { /** @@ -22,7 +27,10 @@ public class CommandEaeditor extends AbstractCommand { @Override public void onExecute(@NotNull final CommandSender sender, @NotNull final List args) { - String token = new Paste(((EcoArmorPlugin) this.getPlugin()).getEcoArmorJson().toPlaintext()).getHastebinToken(); + JSONConfig config = ((EcoArmorPlugin) this.getPlugin()).getEcoArmorJson().clone(); + List enchantKeys = Arrays.stream(Enchantment.values()).map(Enchantment::getKey).map(NamespacedKey::getKey).collect(Collectors.toList()); + config.set("meta.enchants", enchantKeys); + String token = new Paste(config.toPlaintext()).getHastebinToken(); String message = this.getPlugin().getLangYml().getMessage("open-editor") .replace("%url%", "https://auxilor.io/editor/ecoarmor?token=" + token); sender.sendMessage(message); From 46b2761e740f1f46723c184dbfc0506ba53ac22c Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 24 Jun 2021 13:34:51 +0100 Subject: [PATCH 16/25] Fixed bug --- .../src/main/java/com/willfp/ecoarmor/upgrades/Tier.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 84bf170..b75a3f7 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 @@ -101,7 +101,7 @@ public class Tier extends PluginDependent { this.requiredTiersForApplication = this.getConfig().getStrings("requiresTiers"); NamespacedKey key = this.getPlugin().getNamespacedKeyFactory().create("upgrade_crystal"); - ItemStack out = new ItemStack(Objects.requireNonNull(Material.getMaterial(this.getPlugin().getConfigYml().getString("upgradeCrystalMaterial").toUpperCase()))); + ItemStack out = new ItemStack(Objects.requireNonNull(Material.getMaterial(this.getPlugin().getConfigYml().getString("upgrade-crystal-material").toUpperCase()))); ItemMeta outMeta = out.getItemMeta(); assert outMeta != null; PersistentDataContainer container = outMeta.getPersistentDataContainer(); From b250e289c0256438e5e2a7762b85c9009132b560 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 24 Jun 2021 13:35:55 +0100 Subject: [PATCH 17/25] Fixed bug --- .../src/main/java/com/willfp/ecoarmor/sets/ArmorSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2a8ea0c..3e0fdb7 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 @@ -171,7 +171,7 @@ public class ArmorSet { } private ItemStack constructShard() { - ItemStack shard = new ItemStackBuilder(Objects.requireNonNull(Material.getMaterial(this.getPlugin().getConfigYml().getString("advancementShardMaterial").toUpperCase()))) + ItemStack shard = new ItemStackBuilder(Objects.requireNonNull(Material.getMaterial(this.getPlugin().getConfigYml().getString("advancement-shard-material").toUpperCase()))) .setDisplayName(this.getConfig().getString("advancementShardName")) .addEnchantment(Enchantment.DURABILITY, 3) .addItemFlag(ItemFlag.HIDE_ENCHANTS) From fe15256678ca8a0f2681d4310174c92281798e46 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 24 Jun 2021 13:39:19 +0100 Subject: [PATCH 18/25] Added meta --- .../java/com/willfp/ecoarmor/commands/CommandEaeditor.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java index 0da2889..c37a292 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java @@ -11,7 +11,9 @@ import org.bukkit.enchantments.Enchantment; import org.jetbrains.annotations.NotNull; import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; public class CommandEaeditor extends AbstractCommand { @@ -29,7 +31,9 @@ public class CommandEaeditor extends AbstractCommand { @NotNull final List args) { JSONConfig config = ((EcoArmorPlugin) this.getPlugin()).getEcoArmorJson().clone(); List enchantKeys = Arrays.stream(Enchantment.values()).map(Enchantment::getKey).map(NamespacedKey::getKey).collect(Collectors.toList()); - config.set("meta.enchants", enchantKeys); + Map meta = new HashMap<>(); + meta.put("enchants", enchantKeys); + config.set("meta", meta); String token = new Paste(config.toPlaintext()).getHastebinToken(); String message = this.getPlugin().getLangYml().getMessage("open-editor") .replace("%url%", "https://auxilor.io/editor/ecoarmor?token=" + token); From dc7ed331087f40d19eae2edf68c2ddab7135df29 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 24 Jun 2021 14:33:18 +0100 Subject: [PATCH 19/25] Added more to meta --- .../ecoarmor/commands/CommandEaeditor.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java index c37a292..f18e712 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java @@ -5,9 +5,14 @@ import com.willfp.eco.core.command.AbstractCommand; import com.willfp.eco.core.config.JSONConfig; import com.willfp.eco.core.web.Paste; 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 org.bukkit.NamespacedKey; import org.bukkit.command.CommandSender; import org.bukkit.enchantments.Enchantment; +import org.bukkit.potion.PotionEffectType; import org.jetbrains.annotations.NotNull; import java.util.Arrays; @@ -30,9 +35,20 @@ public class CommandEaeditor extends AbstractCommand { public void onExecute(@NotNull final CommandSender sender, @NotNull final List args) { JSONConfig config = ((EcoArmorPlugin) this.getPlugin()).getEcoArmorJson().clone(); - List enchantKeys = Arrays.stream(Enchantment.values()).map(Enchantment::getKey).map(NamespacedKey::getKey).collect(Collectors.toList()); Map meta = new HashMap<>(); - meta.put("enchants", enchantKeys); + + List enchants = Arrays.stream(Enchantment.values()).map(Enchantment::getKey).map(NamespacedKey::getKey).collect(Collectors.toList()); + meta.put("enchants", enchants); + + List potionEffects = Arrays.stream(PotionEffectType.values()).map(PotionEffectType::getName).collect(Collectors.toList()); + meta.put("potion-effects", potionEffects); + + List effects = Effects.values().stream().map(Effect::getName).collect(Collectors.toList()); + meta.put("effects", effects); + + List conditions = Conditions.values().stream().map(Condition::getName).collect(Collectors.toList()); + meta.put("conditions", conditions); + config.set("meta", meta); String token = new Paste(config.toPlaintext()).getHastebinToken(); String message = this.getPlugin().getLangYml().getMessage("open-editor") From d348b2636cefdd067832d1697ffc64b774b501d2 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 26 Jun 2021 20:36:56 +0100 Subject: [PATCH 20/25] Updated eco to 5.5.1 to fix build issue --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9a42c3c..1335fc3 100644 --- a/build.gradle +++ b/build.gradle @@ -46,7 +46,7 @@ allprojects { } dependencies { - compileOnly 'com.willfp:eco:5.5.0' + compileOnly 'com.willfp:eco:5.5.1' compileOnly 'org.jetbrains:annotations:19.0.0' From 28eb237be2bd3967e20a9d6407fc9131cc84768c Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 4 Jul 2021 13:14:06 +0200 Subject: [PATCH 21/25] Updated to eco 5.6.0 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1335fc3..cbb6749 100644 --- a/build.gradle +++ b/build.gradle @@ -46,7 +46,7 @@ allprojects { } dependencies { - compileOnly 'com.willfp:eco:5.5.1' + compileOnly 'com.willfp:eco:5.6.0' compileOnly 'org.jetbrains:annotations:19.0.0' From 794121b20e727dba9e81f11f989a0a8202585c8f Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 4 Jul 2021 13:15:27 +0200 Subject: [PATCH 22/25] Migrated changes from master --- .../src/main/java/com/willfp/ecoarmor/EcoArmorPlugin.java | 1 + .../main/java/com/willfp/ecoarmor/conditions/Condition.java | 6 +++--- .../com/willfp/ecoarmor/effects/util/EffectWatcher.java | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) 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 a3893b7..b8a513c 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 @@ -96,6 +96,7 @@ public class EcoArmorPlugin extends EcoPlugin { public void onReload() { Effects.values().forEach(effect -> this.getEventManager().unregisterListener(effect)); Effects.values().stream().filter(Effect::isEnabled).forEach(effect -> this.getEventManager().registerListener(effect)); + this.getLogger().info(Tiers.values().size() + " Tiers Loaded"); this.getLogger().info(ArmorSets.values().size() + " Sets Loaded"); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/conditions/Condition.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/conditions/Condition.java index 570e146..47a722d 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/conditions/Condition.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/conditions/Condition.java @@ -80,19 +80,19 @@ public abstract class Condition implements Listener { } set.getPotionEffects().forEach((potionEffectType, integer) -> { - player.addPotionEffect(new PotionEffect(potionEffectType, 0x6fffffff, integer - 1, false, false, true)); + player.addPotionEffect(new PotionEffect(potionEffectType, 0x6ffffff, integer - 1, false, false, true)); }); if (ArmorUtils.isWearingAdvanced(player)) { set.getAdvancedPotionEffects().forEach((potionEffectType, integer) -> { - player.addPotionEffect(new PotionEffect(potionEffectType, 0x6fffffff, integer - 1, false, false, true)); + player.addPotionEffect(new PotionEffect(potionEffectType, 0x6ffffff, integer - 1, false, false, true)); }); } } else { set.getEffects().keySet().forEach(effect -> effect.disable(player)); for (PotionEffect effect : player.getActivePotionEffects()) { - if (effect.getDuration() >= 500000000) { + if (effect.getDuration() >= 0x5ffffff && effect.getDuration() <= 0x6ffffff) { player.removePotionEffect(effect.getType()); } } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/effects/util/EffectWatcher.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/effects/util/EffectWatcher.java index 21b67cb..0a20dcb 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/effects/util/EffectWatcher.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/effects/util/EffectWatcher.java @@ -71,18 +71,18 @@ public class EffectWatcher extends PluginDependent implements Listener { if (set == null || !conditionsMet) { for (PotionEffect effect : player.getActivePotionEffects()) { - if (effect.getDuration() >= 500000000) { + if (effect.getDuration() >= 0x5ffffff && effect.getDuration() <= 0x6ffffff) { player.removePotionEffect(effect.getType()); } } } else { set.getPotionEffects().forEach((potionEffectType, integer) -> { - player.addPotionEffect(new PotionEffect(potionEffectType, 0x6fffffff, integer - 1, false, false, true)); + player.addPotionEffect(new PotionEffect(potionEffectType, 0x6ffffff, integer - 1, false, false, true)); }); if (ArmorUtils.isWearingAdvanced(player)) { set.getAdvancedPotionEffects().forEach((potionEffectType, integer) -> { - player.addPotionEffect(new PotionEffect(potionEffectType, 0x6fffffff, integer - 1, false, false, true)); + player.addPotionEffect(new PotionEffect(potionEffectType, 0x6ffffff, integer - 1, false, false, true)); }); } } From 994da87e3fcba9a16372ad558a99170a5e89869b Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 4 Jul 2021 13:17:14 +0200 Subject: [PATCH 23/25] Added coming soon message to /eaeditor --- .../ecoarmor/commands/CommandEaeditor.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java index f18e712..de0d991 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/commands/CommandEaeditor.java @@ -2,24 +2,11 @@ package com.willfp.ecoarmor.commands; import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.command.AbstractCommand; -import com.willfp.eco.core.config.JSONConfig; -import com.willfp.eco.core.web.Paste; -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 org.bukkit.NamespacedKey; +import com.willfp.eco.util.StringUtils; import org.bukkit.command.CommandSender; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.potion.PotionEffectType; import org.jetbrains.annotations.NotNull; -import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; public class CommandEaeditor extends AbstractCommand { /** @@ -34,6 +21,7 @@ public class CommandEaeditor extends AbstractCommand { @Override public void onExecute(@NotNull final CommandSender sender, @NotNull final List args) { + /* JSONConfig config = ((EcoArmorPlugin) this.getPlugin()).getEcoArmorJson().clone(); Map meta = new HashMap<>(); @@ -54,5 +42,8 @@ public class CommandEaeditor extends AbstractCommand { String message = this.getPlugin().getLangYml().getMessage("open-editor") .replace("%url%", "https://auxilor.io/editor/ecoarmor?token=" + token); sender.sendMessage(message); + */ + + sender.sendMessage(StringUtils.translate("&cThe editor is coming soon!")); } } From 6d669178a939cb77f168cce07a7e2e9056e944e0 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 4 Jul 2021 13:27:02 +0200 Subject: [PATCH 24/25] JSON refactoring --- .../com/willfp/ecoarmor/upgrades/Tier.java | 14 +- .../src/main/resources/ecoarmor.json | 348 +++++++++--------- 2 files changed, 189 insertions(+), 173 deletions(-) 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 b75a3f7..aaa3cd5 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 @@ -57,7 +57,7 @@ public class Tier extends PluginDependent { * If the crafting recipe is enabled. */ @Getter - private boolean enabled; + private boolean craftable; /** * The ItemStack of the crystal. @@ -96,7 +96,7 @@ public class Tier extends PluginDependent { * Update the tracker's crafting recipe. */ public void update() { - this.enabled = this.getConfig().getBool("crystalCraftable"); + this.craftable = this.getConfig().getBool("crystal.craftable"); this.displayName = this.getConfig().getString("display"); this.requiredTiersForApplication = this.getConfig().getStrings("requiresTiers"); NamespacedKey key = this.getPlugin().getNamespacedKeyFactory().create("upgrade_crystal"); @@ -107,10 +107,10 @@ public class Tier extends PluginDependent { PersistentDataContainer container = outMeta.getPersistentDataContainer(); container.set(key, PersistentDataType.STRING, name); - outMeta.setDisplayName(this.getConfig().getString("crystalName")); + outMeta.setDisplayName(this.getConfig().getString("crystal.name")); List lore = new ArrayList<>(); - for (String loreLine : this.getConfig().getStrings("crystalLore")) { + for (String loreLine : this.getConfig().getStrings("crystal.lore")) { lore.add(Display.PREFIX + StringUtils.translate(loreLine)); } outMeta.setLore(lore); @@ -131,13 +131,13 @@ public class Tier extends PluginDependent { )); } - if (this.isEnabled()) { + if (this.isCraftable()) { ItemStack recipeOut = out.clone(); - recipeOut.setAmount(this.getConfig().getInt("recipeGiveAmount")); + recipeOut.setAmount(this.getConfig().getInt("crystal.giveAmount")); ShapedCraftingRecipe.Builder builder = ShapedCraftingRecipe.builder(this.getPlugin(), "upgrade_crystal_" + name) .setOutput(recipeOut); - List recipeStrings = this.getConfig().getStrings("crystalRecipe"); + List recipeStrings = this.getConfig().getStrings("crystal.recipe"); new CustomItem(this.getPlugin().getNamespacedKeyFactory().create("upgrade_crystal_" + name), test -> { if (test == null) { diff --git a/eco-core/core-plugin/src/main/resources/ecoarmor.json b/eco-core/core-plugin/src/main/resources/ecoarmor.json index 42cdb55..8fac11b 100644 --- a/eco-core/core-plugin/src/main/resources/ecoarmor.json +++ b/eco-core/core-plugin/src/main/resources/ecoarmor.json @@ -4,25 +4,27 @@ "name": "default", "display": "&8&lDEFAULT", "requiresTiers": [], - "crystalCraftable": false, - "crystalName": "&8Default Upgrade Crystal", - "crystalRecipe": [ - "air", - "leather", - "air", - "leather", - "leather_chestplate", - "leather", - "air", - "leather", - "air" - ], - "recipeGiveAmount": 1, - "crystalLore": [ - "&8Drop this onto an armor piece", - "&8to set its tier to:", - "&8&lDEFAULT" - ], + "crystal": { + "craftable": false, + "name": "&8Default Upgrade Crystal", + "recipe": [ + "air", + "leather", + "air", + "leather", + "leather_chestplate", + "leather", + "air", + "leather", + "air" + ], + "giveAmount": 1, + "lore": [ + "&8Drop this onto an armor piece", + "&8to set its tier to:", + "&8&lDEFAULT" + ] + }, "properties": { "helmet": { "armor": 1, @@ -77,27 +79,29 @@ "requiresTiers": [ "default" ], - "crystalCraftable": true, - "crystalName": "&7Iron Upgrade Crystal", - "crystalRecipe": [ - "air", - "iron_block", - "air", - "iron_block", - "leather_chestplate", - "iron_block", - "air", - "iron_block", - "air" - ], - "recipeGiveAmount": 1, - "crystalLore": [ - "&8Drop this onto an armor piece", - "&8to set its tier to:", - "&7&lIRON", - "", - "&8&oRequires the armor to already have default tier" - ], + "crystal": { + "craftable": true, + "name": "&7Iron Upgrade Crystal", + "recipe": [ + "air", + "iron_block", + "air", + "iron_block", + "leather_chestplate", + "iron_block", + "air", + "iron_block", + "air" + ], + "giveAmount": 1, + "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, @@ -152,27 +156,29 @@ "requiresTiers": [ "iron" ], - "crystalCraftable": true, - "crystalName": "&bDiamond Upgrade Crystal", - "crystalRecipe": [ - "air", - "diamond_block", - "air", - "diamond_block", - "ecoarmor:upgrade_crystal_iron", - "diamond_block", - "air", - "diamond_block", - "air" - ], - "recipeGiveAmount": 1, - "crystalLore": [ - "&8Drop this onto an armor piece", - "&8to set its tier to:", - "&b&lDIAMOND", - "", - "&8&oRequires the armor to already have Iron tier" - ], + "crystal": { + "craftable": true, + "name": "&bDiamond Upgrade Crystal", + "recipe": [ + "air", + "diamond_block", + "air", + "diamond_block", + "ecoarmor:upgrade_crystal_iron", + "diamond_block", + "air", + "diamond_block", + "air" + ], + "giveAmount": 1, + "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, @@ -227,27 +233,29 @@ "requiresTiers": [ "diamond" ], - "crystalCraftable": true, - "crystalName": "&cNetherite Upgrade Crystal", - "crystalRecipe": [ - "air", - "netherite_ingot", - "air", - "netherite_ingot", - "ecoarmor:upgrade_crystal_diamond", - "netherite_ingot", - "air", - "netherite_ingot", - "air" - ], - "recipeGiveAmount": 1, - "crystalLore": [ - "&8Drop this onto an armor piece", - "&8to set its tier to:", - "&c&lNETHERITE", - "", - "&8&oRequires the armor to already have Diamond tier" - ], + "crystal": { + "craftable": true, + "name": "&cNetherite Upgrade Crystal", + "recipe": [ + "air", + "netherite_ingot", + "air", + "netherite_ingot", + "ecoarmor:upgrade_crystal_diamond", + "netherite_ingot", + "air", + "netherite_ingot", + "air" + ], + "giveAmount": 1, + "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, @@ -303,27 +311,29 @@ "requiresTiers": [ "netherite" ], - "crystalCraftable": true, - "crystalName": "Manyullyn Upgrade Crystal", - "crystalRecipe": [ - "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" - ], - "recipeGiveAmount": 1, - "crystalLore": [ - "&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" - ], + "crystal": { + "craftable": true, + "name": "Manyullyn Upgrade 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" + ], + "giveAmount": 1, + "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, @@ -378,27 +388,29 @@ "requiresTiers": [ "iron" ], - "crystalCraftable": true, - "crystalName": "/abCobalt Upgrade Crystal", - "crystalRecipe": [ - "air", - "obsidian", - "air", - "obsidian", - "ecoarmor:upgrade_crystal_iron", - "obsidian", - "air", - "obsidian", - "air" - ], - "recipeGiveAmount": 1, - "crystalLore": [ - "&8Drop this onto an armor piece", - "&8to set its tier to:", - "/ab&lCOBALT", - "", - "&8&oRequires the armor to already have Iron tier" - ], + "crystal": { + "craftable": true, + "name": "/abCobalt Upgrade Crystal", + "recipe": [ + "air", + "obsidian", + "air", + "obsidian", + "ecoarmor:upgrade_crystal_iron", + "obsidian", + "air", + "obsidian", + "air" + ], + "giveAmount": 1, + "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, @@ -453,27 +465,29 @@ "requiresTiers": [ "cobalt" ], - "crystalCraftable": true, - "crystalName": "Osmium upgrade crystal", - "crystalRecipe": [ - "air", - "netherite_block", - "air", - "netherite_block", - "ecoarmor:upgrade_crystal_cobalt", - "netherite_block", - "air", - "netherite_block", - "air" - ], - "recipeGiveAmount": 1, - "crystalLore": [ - "&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" - ], + "crystal": { + "craftable": true, + "name": "Osmium upgrade crystal", + "recipe": [ + "air", + "netherite_block", + "air", + "netherite_block", + "ecoarmor:upgrade_crystal_cobalt", + "netherite_block", + "air", + "netherite_block", + "air" + ], + "giveAmount": 1, + "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, @@ -528,27 +542,29 @@ "requiresTiers": [ "netherite" ], - "crystalCraftable": true, - "crystalName": "Exotic Upgrade Crystal", - "crystalRecipe": [ - "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" - ], - "recipeGiveAmount": 1, - "crystalLore": [ - "&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" - ], + "crystal": { + "craftable": true, + "name": "Exotic Upgrade 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" + ], + "giveAmount": 1, + "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, From 94028f6d7fb0fefbea2cc09f14ba2a509a91917b Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 4 Jul 2021 13:28:44 +0200 Subject: [PATCH 25/25] Updated to 5.0.0-pre1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 3205854..40ad033 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version = 5.0.0 +version = 5.0.0-pre1 plugin-name = EcoArmor \ No newline at end of file