From 8ebb2b1529f879395e2eee00de129fb6d2942e0c Mon Sep 17 00:00:00 2001 From: 0ft3n Date: Sat, 15 Jan 2022 21:59:36 +0300 Subject: [PATCH 1/3] Added a warning for not having a slot defined for a target in target.yml --- .../com/willfp/ecoenchants/config/TargetYml.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/TargetYml.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/TargetYml.java index dd62ed8f..93a8469d 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/TargetYml.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/TargetYml.java @@ -3,7 +3,9 @@ package com.willfp.ecoenchants.config; import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.config.BaseConfig; import com.willfp.eco.core.config.ConfigType; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.jetbrains.annotations.NotNull; @@ -62,6 +64,20 @@ public class TargetYml extends BaseConfig { ); } } + EcoEnchantsPlugin.getInstance().getLogger().warning(""); + EcoEnchantsPlugin.getInstance().getLogger().warning(""); + EcoEnchantsPlugin.getInstance().getLogger().warning("WARNING! could not found slot for target " + target); + EcoEnchantsPlugin.getInstance().getLogger().warning("Go to your target.yml config in EcoEnchants/ folder "); + EcoEnchantsPlugin.getInstance().getLogger().warning("And add a slot for " + target); + EcoEnchantsPlugin.getInstance().getLogger().warning("Example: "); + EcoEnchantsPlugin.getInstance().getLogger().warning(target+":"); + EcoEnchantsPlugin.getInstance().getLogger().warning(" - slot:hands"); + EcoEnchantsPlugin.getInstance().getLogger().warning(" - material1"); + EcoEnchantsPlugin.getInstance().getLogger().warning(" - material2"); + EcoEnchantsPlugin.getInstance().getLogger().warning(" - material3"); + EcoEnchantsPlugin.getInstance().getLogger().warning("Otherwise, you will have Custom Enchantments broken!"); + EcoEnchantsPlugin.getInstance().getLogger().warning(""); + EcoEnchantsPlugin.getInstance().getLogger().warning(""); return EnchantmentTarget.Slot.ANY; } From b4fa4a0f9811a23bca3b6241570f7999a0649813 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 15 Jan 2022 19:06:15 +0000 Subject: [PATCH 2/3] PR change --- .../willfp/ecoenchants/config/TargetYml.java | 16 ------------- .../enchantments/custom/CustomEcoEnchant.java | 23 +++++++++++++++++++ 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/TargetYml.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/TargetYml.java index 93a8469d..dd62ed8f 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/TargetYml.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/TargetYml.java @@ -3,9 +3,7 @@ package com.willfp.ecoenchants.config; import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.config.BaseConfig; import com.willfp.eco.core.config.ConfigType; -import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.jetbrains.annotations.NotNull; @@ -64,20 +62,6 @@ public class TargetYml extends BaseConfig { ); } } - EcoEnchantsPlugin.getInstance().getLogger().warning(""); - EcoEnchantsPlugin.getInstance().getLogger().warning(""); - EcoEnchantsPlugin.getInstance().getLogger().warning("WARNING! could not found slot for target " + target); - EcoEnchantsPlugin.getInstance().getLogger().warning("Go to your target.yml config in EcoEnchants/ folder "); - EcoEnchantsPlugin.getInstance().getLogger().warning("And add a slot for " + target); - EcoEnchantsPlugin.getInstance().getLogger().warning("Example: "); - EcoEnchantsPlugin.getInstance().getLogger().warning(target+":"); - EcoEnchantsPlugin.getInstance().getLogger().warning(" - slot:hands"); - EcoEnchantsPlugin.getInstance().getLogger().warning(" - material1"); - EcoEnchantsPlugin.getInstance().getLogger().warning(" - material2"); - EcoEnchantsPlugin.getInstance().getLogger().warning(" - material3"); - EcoEnchantsPlugin.getInstance().getLogger().warning("Otherwise, you will have Custom Enchantments broken!"); - EcoEnchantsPlugin.getInstance().getLogger().warning(""); - EcoEnchantsPlugin.getInstance().getLogger().warning(""); return EnchantmentTarget.Slot.ANY; } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchant.java index ae4659ef..4d5e3fea 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchant.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchant.java @@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.custom; import com.willfp.eco.core.config.interfaces.Config; import com.willfp.ecoenchants.enchantments.EcoEnchant; +import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; import org.jetbrains.annotations.NotNull; @@ -9,6 +10,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.logging.Logger; public class CustomEcoEnchant extends EcoEnchant { /** @@ -35,6 +37,27 @@ public class CustomEcoEnchant extends EcoEnchant { } } + @Override + protected void postUpdate() { + for (EnchantmentTarget target : this.getTargets()) { + if (target.getSlot() == null) { + Logger logger = this.getPlugin().getLogger(); + logger.warning(""); + logger.warning("Problem with target " + target.getName() + "!"); + logger.warning("Go to target.yml and specify a slot for enchants to activate on!"); + logger.warning("Example:"); + logger.warning(target.getName() + ":"); + logger.warning(" - slot:hands"); + logger.warning(" - material1"); + logger.warning(" - material2"); + logger.warning(""); + logger.warning("Read the wiki to see available slots!"); + logger.warning("Custom Enchantment " + this.getKey().getKey() + " will not work until then"); + logger.warning(""); + } + } + } + /** * Get the level. * From 15afcf1c42df30e90391a4358aa366027556e6fd Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 15 Jan 2022 19:06:27 +0000 Subject: [PATCH 3/3] Updated to 8.23.2 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 5dd199b4..70c13ff7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version = 8.23.1 +version = 8.23.2 plugin-name = EcoEnchants \ No newline at end of file