From 9c0a320eeceb23d686118dde3a040db7a17dc271 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 8 May 2022 16:11:21 +0100 Subject: [PATCH] Updated libreforge --- eco-core/build.gradle | 2 +- .../custom/CustomEcoEnchantLevel.java | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/eco-core/build.gradle b/eco-core/build.gradle index 08838fff..1761bf59 100644 --- a/eco-core/build.gradle +++ b/eco-core/build.gradle @@ -3,6 +3,6 @@ version rootProject.version subprojects { dependencies { - implementation 'com.willfp:libreforge:3.40.0' + implementation 'com.willfp:libreforge:3.40.1' } } \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchantLevel.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchantLevel.java index c28b20db..5d9c080f 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchantLevel.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchantLevel.java @@ -10,10 +10,15 @@ import com.willfp.libreforge.conditions.ConfiguredCondition; import com.willfp.libreforge.effects.ConfiguredEffect; import com.willfp.libreforge.effects.Effects; import lombok.Getter; +import lombok.val; +import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; +import java.util.Objects; import java.util.Set; public class CustomEcoEnchantLevel implements Holder { @@ -104,7 +109,21 @@ public class CustomEcoEnchantLevel implements Holder { + '}'; } - @Nullable + @NotNull + @Override + public List getNotMetLines(@NotNull final Player player) { + List lines = new ArrayList<>(); + + for (ConfiguredCondition condition : this.getConditions()) { + if (!condition.isMet(player)) { + lines.addAll(Objects.requireNonNullElse(condition.getNotMetLines(), new ArrayList<>())); + } + } + + return lines; + } + + @NotNull @Override public String getId() { return this.parent.getKey().getKey() + "_" + this.level;