Added checker for invalid targets

This commit is contained in:
Auxilor 2021-03-29 21:13:30 +01:00
parent 2bda3b26c1
commit 00c6f6d494
2 changed files with 3 additions and 1 deletions

View File

@ -3,7 +3,7 @@ version rootProject.version
dependencies {
compileOnly project(":eco-core:core-proxy")
compileOnly 'org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT'
compileOnly 'org.spigotmc:spigot:1.16.4-R0.1-SNAPSHOT'
compileOnly 'commons-io:commons-io:2.8.0'
compileOnly 'com.comphenix.protocol:ProtocolLib:4.6.0-SNAPSHOT'
compileOnly 'net.ess3:EssentialsX:2.18.1'

View File

@ -7,6 +7,7 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.jetbrains.annotations.NotNull;
@ -74,6 +75,7 @@ public class EnchantmentConfig extends ExtendableConfig {
targetNames.forEach((s -> {
if (EnchantmentTarget.getByName(s) == null) {
Bukkit.getLogger().warning("Target specified in " + name + " is invalid!");
return;
}
targets.add(EnchantmentTarget.getByName(s));