Fixed artifact/spell required to extend bug

This commit is contained in:
Auxilor 2022-02-28 09:54:38 +00:00
parent cc96b9d6ba
commit b861ab40c0
2 changed files with 6 additions and 8 deletions

View File

@ -8,6 +8,7 @@ import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.config.configs.BaseEnchantmentConfig;
import com.willfp.ecoenchants.config.configs.EnchantmentConfig;
import com.willfp.ecoenchants.display.EnchantmentCache;
import com.willfp.ecoenchants.enchantments.custom.CustomEcoEnchant;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
@ -205,7 +206,7 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Watche
Bukkit.getPluginManager().addPermission(permission);
}
if (type.getRequiredToExtend() != null && !type.getRequiredToExtend().isInstance(this)) {
if (type.getRequiredToExtend() != null && !type.getRequiredToExtend().isInstance(this) && !(this instanceof CustomEcoEnchant)) {
return;
}

View File

@ -1,8 +1,6 @@
package com.willfp.ecoenchants.sprintartifacts;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -37,15 +35,14 @@ public class SprintArtifactsListener implements Listener {
return;
}
Optional<EcoEnchant> matching = bootsMeta.getEnchants().keySet().stream()
.filter(enchantment -> enchantment instanceof EcoEnchant)
.map(enchant -> (EcoEnchant) enchant)
.filter(enchantment -> enchantment.getType().equals(EnchantmentType.ARTIFACT))
Optional<Artifact> matching = bootsMeta.getEnchants().keySet().stream()
.filter(enchantment -> enchantment instanceof Artifact)
.map(enchant -> (Artifact) enchant)
.findFirst();
if (matching.isEmpty()) {
return;
}
Artifact artifact = (Artifact) matching.get();
Artifact artifact = matching.get();
if (!artifact.areRequirementsMet(player)) {
return;