mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-26 15:45:12 +01:00
Fixed target issues
This commit is contained in:
parent
2a6c7c5067
commit
47144832c0
@ -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();
|
||||
|
||||
|
@ -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<EnchantmentTarget> targets = new HashSet<>();
|
||||
|
||||
targetNames.forEach((s -> {
|
||||
if(EnchantmentTarget.getByName(s) == null)
|
||||
Bukkit.getLogger().severe(s + " is an invalid target!");
|
||||
targets.add(EnchantmentTarget.getByName(s));
|
||||
}));
|
||||
|
||||
|
@ -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("");
|
||||
|
||||
|
@ -21,7 +21,6 @@ general-config:
|
||||
- shovel
|
||||
- hoe
|
||||
- sword
|
||||
- axe
|
||||
- bow
|
||||
- crossbow
|
||||
- trident
|
||||
|
@ -16,7 +16,10 @@ obtaining:
|
||||
|
||||
general-config:
|
||||
targets:
|
||||
- armor
|
||||
- helmet
|
||||
- chestplate
|
||||
- leggings
|
||||
- boots
|
||||
grindstoneable: true
|
||||
conflicts:
|
||||
- protection
|
||||
|
Loading…
Reference in New Issue
Block a user