diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/commands/CommandEcoreload.java b/Plugin/src/main/java/com/willfp/ecoenchants/commands/CommandEcoreload.java index 1afc0325..702b24b6 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/commands/CommandEcoreload.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/commands/CommandEcoreload.java @@ -5,6 +5,7 @@ import com.willfp.ecoenchants.config.ConfigManager; import com.willfp.ecoenchants.display.EnchantDisplay; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.EnchantmentRarity; +import com.willfp.ecoenchants.enchantments.EnchantmentTarget; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -31,6 +32,7 @@ public class CommandEcoreload implements CommandExecutor { public static void reload() { ConfigManager.updateConfigs(); EnchantmentRarity.update(); + EnchantmentTarget.update(); EcoEnchants.update(); EnchantDisplay.update(); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java b/Plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java index 10b1e182..a132e993 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java @@ -5,6 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.EnchantmentRarity; import com.willfp.ecoenchants.enchantments.EnchantmentTarget; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.enchantments.Enchantment; @@ -91,6 +92,8 @@ public class EnchantmentConfig extends EnchantmentYamlConfig { Set targets = new HashSet<>(); targetNames.forEach((s -> { + if(EnchantmentTarget.getByName(s) == null) + Bukkit.getLogger().severe(s + " is an invalid target!"); targets.add(EnchantmentTarget.getByName(s)); })); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java b/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java index 40225f16..9d94dd5a 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java @@ -11,10 +11,7 @@ import com.willfp.ecoenchants.commands.CommandEnchantinfo; import com.willfp.ecoenchants.config.ConfigManager; import com.willfp.ecoenchants.display.DisplayPacketAdapter; import com.willfp.ecoenchants.display.EnchantDisplay; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.EcoRunnable; -import com.willfp.ecoenchants.enchantments.EnchantmentRarity; +import com.willfp.ecoenchants.enchantments.*; import com.willfp.ecoenchants.listeners.ArrowListeners; import com.willfp.ecoenchants.events.armorequip.ArmorListener; import com.willfp.ecoenchants.events.armorequip.DispenserArmorListener; @@ -275,13 +272,14 @@ public class Loader { Bukkit.getLogger().info(""); /* - Load all enchantments and rarities + Load all enchantments, rarities, and targets */ Bukkit.getLogger().info("Adding Enchantments to API..."); EnchantmentRarity.update(); - if(EnchantmentRarity.getAll().size() == 0) { - Bukkit.getLogger().severe("§cError loading rarities! Aborting..."); + EnchantmentTarget.update(); + if(EnchantmentRarity.getAll().size() == 0 || EnchantmentTarget.getAll().size() == 0) { + Bukkit.getLogger().severe("§cError loading rarities or targets! Aborting..."); Bukkit.getPluginManager().disablePlugin(EcoEnchantsPlugin.getInstance()); return; } else { @@ -289,6 +287,13 @@ public class Loader { EnchantmentRarity.getAll().forEach((rarity -> { Bukkit.getLogger().info("- " + rarity.getName() + ": Table Probability=" + rarity.getProbability() + ", Minimum Level=" + rarity.getMinimumLevel() + ", Villager Probability=" + rarity.getVillagerProbability() + ", Loot Probability=" + rarity.getLootProbability()); })); + + Bukkit.getLogger().info(""); + + Bukkit.getLogger().info(EnchantmentTarget.getAll().size() + " Targets Loaded:"); + EnchantmentTarget.getAll().forEach((target) -> { + Bukkit.getLogger().info("- " + target.getName() + ": Materials=" + target.getMaterials().toString()); + }); } Bukkit.getLogger().info(""); diff --git a/Plugin/src/main/resources/enchants/normal/telekinesis.yml b/Plugin/src/main/resources/enchants/normal/telekinesis.yml index d11cee2f..6d2013bb 100644 --- a/Plugin/src/main/resources/enchants/normal/telekinesis.yml +++ b/Plugin/src/main/resources/enchants/normal/telekinesis.yml @@ -21,7 +21,6 @@ general-config: - shovel - hoe - sword - - axe - bow - crossbow - trident diff --git a/Plugin/src/main/resources/enchants/special/preservation.yml b/Plugin/src/main/resources/enchants/special/preservation.yml index 0bacf388..ea3e36e2 100644 --- a/Plugin/src/main/resources/enchants/special/preservation.yml +++ b/Plugin/src/main/resources/enchants/special/preservation.yml @@ -16,7 +16,10 @@ obtaining: general-config: targets: - - armor + - helmet + - chestplate + - leggings + - boots grindstoneable: true conflicts: - protection