> entry : requirements.entrySet()) {
if (!entry.getKey().doesPlayerMeet(player, entry.getValue())) {
cachedRequirements.put(player.getUniqueId(), false);
return false;
@@ -443,4 +447,110 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Watche
public boolean canEnchantItem(@NotNull final ItemStack itemStack) {
return targetMaterials.contains(itemStack.getType()) || itemStack.getType().equals(Material.BOOK) || itemStack.getType().equals(Material.ENCHANTED_BOOK);
}
+
+ /**
+ * Paper parity.
+ *
+ * You should use EnchantmentCache instead.
+ *
+ * @param level The level.
+ * @return The display name.
+ * @deprecated Use {@link EnchantmentCache#getEntry(Enchantment)} instead.
+ */
+ @Deprecated
+ @Override
+ public @NotNull Component displayName(final int level) {
+ return PaperHelper.toComponent(EnchantmentCache.getEntry(this).getNameWithLevel(level));
+ }
+
+ /**
+ * Paper parity.
+ *
+ * You should use {@link EcoEnchant#isAvailableFromVillager()} instead.
+ *
+ * @return If tradeable.
+ * @deprecated Use {@link EcoEnchant#isAvailableFromVillager()} instead.
+ */
+ @Deprecated
+ @Override
+ public boolean isTradeable() {
+ return this.isAvailableFromVillager();
+ }
+
+ /**
+ * Paper parity.
+ *
+ * You should use {@link EcoEnchant#isAvailableFromLoot()} instead.
+ *
+ * @return If discoverable.
+ * @deprecated Use {@link EcoEnchant#isAvailableFromLoot()} instead.
+ */
+ @Deprecated
+ @Override
+ public boolean isDiscoverable() {
+ return this.isAvailableFromLoot();
+ }
+
+ /**
+ * Paper parity.
+ *
+ * EcoEnchants has its own systems for everything like this. Will always return 0.
+ *
+ * @param level The level.
+ * @param entityCategory The category.
+ * @return 0
+ * @deprecated EcoEnchants has its own systems for this.
+ */
+ @Deprecated
+ @Override
+ public float getDamageIncrease(final int level,
+ @NotNull final EntityCategory entityCategory) {
+ return 0;
+ }
+
+ /**
+ * Paper parity.
+ *
+ * EcoEnchants has its own systems for targets.
+ *
+ * Use {@link EcoEnchant#getTargets()} instead.
+ *
+ * @return An empty set.
+ * @deprecated Use {@link EcoEnchant#getTargets()}.
+ */
+ @Deprecated
+ @Override
+ public @NotNull Set getActiveSlots() {
+ return new HashSet<>();
+ }
+
+ /**
+ * Paper parity.
+ *
+ * eco / EcoEnchants recodes display entirely.
+ *
+ * @return A translation key.
+ * @deprecated Useless method, all items will be display differently using eco.
+ */
+ @Deprecated
+ @Override
+ public @NotNull String translationKey() {
+ return "ecoenchants:enchantment." + this.getKey().getKey();
+ }
+
+ /**
+ * Paper parity.
+ *
+ * EcoEnchants has its own systems for rarity.
+ *
+ * Use {@link EcoEnchant#getEnchantmentRarity()} instead.
+ *
+ * @return {@link io.papermc.paper.enchantments.EnchantmentRarity#COMMON}.
+ * @deprecated Use {@link EcoEnchant#getEnchantmentRarity()}.
+ */
+ @Deprecated
+ @Override
+ public @NotNull io.papermc.paper.enchantments.EnchantmentRarity getRarity() {
+ return io.papermc.paper.enchantments.EnchantmentRarity.COMMON;
+ }
}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Artifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Artifact.java
index 5d528498..b0e40957 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Artifact.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Artifact.java
@@ -108,18 +108,20 @@ public abstract class Artifact extends EcoEnchant {
return;
}
- Vector point1 = player.getLocation().getDirection().clone();
- point1.rotateAroundY(Math.toRadians(90));
- point1.multiply(1.2);
- Location location1 = player.getLocation().clone().add(point1);
+ this.getPlugin().getScheduler().runAsync(() -> {
+ Vector point1 = player.getLocation().getDirection().clone();
+ point1.rotateAroundY(Math.toRadians(90));
+ point1.multiply(1.2);
+ Location location1 = player.getLocation().clone().add(point1);
- Vector point2 = player.getLocation().getDirection().clone();
- point2.rotateAroundY(Math.toRadians(-90));
- point2.multiply(1.2);
- Location location2 = player.getLocation().clone().add(point2);
+ Vector point2 = player.getLocation().getDirection().clone();
+ point2.rotateAroundY(Math.toRadians(-90));
+ point2.multiply(1.2);
+ Location location2 = player.getLocation().clone().add(point2);
- player.getWorld().spawnParticle(particle, location1, 1, 0, 0, 0, 0, extra, true);
- player.getWorld().spawnParticle(particle, location2, 1, 0, 0, 0, 0, extra, true);
+ player.getWorld().spawnParticle(particle, location1, 1, 0, 0, 0, 0, extra, true);
+ player.getWorld().spawnParticle(particle, location2, 1, 0, 0, 0, 0, extra, true);
+ });
}
@Override
@@ -178,6 +180,6 @@ public abstract class Artifact extends EcoEnchant {
bukkitRunnable.cancel();
}
projectile.getLocation().getWorld().spawnParticle(particle, projectile.getLocation(), 1, 0, 0, 0, finalColor, extra, true);
- }).runTaskTimer(4, ticks);
+ }).runTaskTimerAsynchronously(4, ticks);
}
}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java
index 21e440a1..79e670ea 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java
@@ -37,6 +37,7 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
+@SuppressWarnings("deprecation")
public abstract class Spell extends EcoEnchant {
/**
* Items that must be left-clicked to activate spells for.
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/EnchantmentRequirement.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/EnchantmentRequirement.java
deleted file mode 100644
index 3eef6341..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/EnchantmentRequirement.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.willfp.ecoenchants.enchantments.meta.requirements;
-
-import lombok.Getter;
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-public abstract class EnchantmentRequirement {
- /**
- * The ID of the requirement.
- */
- @Getter
- private final String id;
-
- protected EnchantmentRequirement(@NotNull final String id) {
- this.id = id;
-
- EnchantmentRequirements.addNewRequirement(this);
- }
-
- /**
- * Test if the player meets the requirement.
- *
- * @param player The player.
- * @param args The arguments.
- * @return The requirement.
- */
- public abstract boolean doesPlayerMeet(@NotNull Player player,
- @NotNull List args);
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/EnchantmentRequirements.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/EnchantmentRequirements.java
deleted file mode 100644
index e7907519..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/EnchantmentRequirements.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.willfp.ecoenchants.enchantments.meta.requirements;
-
-import com.google.common.collect.BiMap;
-import com.google.common.collect.HashBiMap;
-import com.google.common.collect.ImmutableList;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.requirements.requirements.RequirementHasPermission;
-import com.willfp.ecoenchants.enchantments.meta.requirements.requirements.RequirementPlaceholderEquals;
-import com.willfp.ecoenchants.enchantments.meta.requirements.requirements.RequirementPlaceholderGreaterThan;
-import com.willfp.ecoenchants.enchantments.meta.requirements.requirements.RequirementPlaceholderLessThan;
-import lombok.experimental.UtilityClass;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-@UtilityClass
-@SuppressWarnings({"unused", "checkstyle:JavadocVariable"})
-public class EnchantmentRequirements {
- /**
- * All registered requirements.
- */
- private static final BiMap BY_ID = HashBiMap.create();
-
- public static final EnchantmentRequirement HAS_PERMISSION = new RequirementHasPermission();
- public static final EnchantmentRequirement PLACEHOLDER_EQUALS = new RequirementPlaceholderEquals();
- public static final EnchantmentRequirement PLACEHOLDER_GREATER_THAN = new RequirementPlaceholderGreaterThan();
- public static final EnchantmentRequirement PLACEHOLDER_LESS_THAN = new RequirementPlaceholderLessThan();
-
- /**
- * Get all registered {@link EcoEnchant}s.
- *
- * @return A list of all {@link EcoEnchant}s.
- */
- public static List values() {
- return ImmutableList.copyOf(BY_ID.values());
- }
-
- /**
- * Get {@link EnchantmentRequirement} matching ID.
- *
- * @param name The ID to search for.
- * @return The matching {@link EnchantmentRequirement}, or null if not found.
- */
- public static EnchantmentRequirement getByID(@NotNull final String name) {
- return BY_ID.get(name);
- }
-
- /**
- * Add new {@link EnchantmentRequirement} to EcoEnchants.
- *
- * Only for internal use, requirements are automatically added in the constructor.
- *
- * @param req The {@link EnchantmentRequirement} to add.
- */
- public static void addNewRequirement(@NotNull final EnchantmentRequirement req) {
- BY_ID.inverse().remove(req);
- BY_ID.put(req.getId(), req);
- }
-
- /**
- * Remove {@link EnchantmentRequirement} from EcoEnchants.
- *
- * @param req The {@link EnchantmentRequirement} to remove.
- */
- public static void removeRequirement(@NotNull final EnchantmentRequirement req) {
- BY_ID.inverse().remove(req);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementHasPermission.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementHasPermission.java
deleted file mode 100644
index 671833d0..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementHasPermission.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.willfp.ecoenchants.enchantments.meta.requirements.requirements;
-
-import com.willfp.ecoenchants.enchantments.meta.requirements.EnchantmentRequirement;
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-public class RequirementHasPermission extends EnchantmentRequirement {
- /**
- * Create new requirement.
- */
- public RequirementHasPermission() {
- super("has-permission");
- }
-
- @Override
- public boolean doesPlayerMeet(@NotNull final Player player,
- @NotNull final List args) {
- String permission = args.get(0);
- return player.hasPermission(permission);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementPlaceholderEquals.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementPlaceholderEquals.java
deleted file mode 100644
index cd76e1be..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementPlaceholderEquals.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.willfp.ecoenchants.enchantments.meta.requirements.requirements;
-
-import com.willfp.eco.core.integrations.placeholder.PlaceholderManager;
-import com.willfp.ecoenchants.enchantments.meta.requirements.EnchantmentRequirement;
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-public class RequirementPlaceholderEquals extends EnchantmentRequirement {
- /**
- * Create new requirement.
- */
- public RequirementPlaceholderEquals() {
- super("placeholder-equals");
- }
-
- @Override
- public boolean doesPlayerMeet(@NotNull final Player player,
- @NotNull final List args) {
- String placeholder = args.get(0);
- String equals = args.get(1);
-
- return PlaceholderManager.translatePlaceholders(placeholder, player).equalsIgnoreCase(equals);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementPlaceholderGreaterThan.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementPlaceholderGreaterThan.java
deleted file mode 100644
index 4e9d24ec..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementPlaceholderGreaterThan.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.willfp.ecoenchants.enchantments.meta.requirements.requirements;
-
-import com.willfp.eco.core.integrations.placeholder.PlaceholderManager;
-import com.willfp.ecoenchants.enchantments.meta.requirements.EnchantmentRequirement;
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-public class RequirementPlaceholderGreaterThan extends EnchantmentRequirement {
- /**
- * Create new requirement.
- */
- public RequirementPlaceholderGreaterThan() {
- super("placeholder-greater-than");
- }
-
- @Override
- public boolean doesPlayerMeet(@NotNull final Player player,
- @NotNull final List args) {
- String placeholder = args.get(0);
- double equals = Double.parseDouble(args.get(1));
-
- try {
- return Double.parseDouble(PlaceholderManager.translatePlaceholders(placeholder, player)) >= equals;
- } catch (NumberFormatException e) {
- return false;
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementPlaceholderLessThan.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementPlaceholderLessThan.java
deleted file mode 100644
index 41ab9dbb..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementPlaceholderLessThan.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.willfp.ecoenchants.enchantments.meta.requirements.requirements;
-
-import com.willfp.eco.core.integrations.placeholder.PlaceholderManager;
-import com.willfp.ecoenchants.enchantments.meta.requirements.EnchantmentRequirement;
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-public class RequirementPlaceholderLessThan extends EnchantmentRequirement {
- /**
- * Create new requirement.
- */
- public RequirementPlaceholderLessThan() {
- super("placeholder-less-than");
- }
-
- @Override
- public boolean doesPlayerMeet(@NotNull final Player player,
- @NotNull final List args) {
- String placeholder = args.get(0);
- double equals = Double.parseDouble(args.get(1));
-
- try {
- return Double.parseDouble(PlaceholderManager.translatePlaceholders(placeholder, player)) < equals;
- } catch (NumberFormatException e) {
- return false;
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilMerge.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilMerge.java
index bd0ef1ba..040518ee 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilMerge.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilMerge.java
@@ -22,6 +22,7 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
+@SuppressWarnings("deprecation")
@UtilityClass
public class AnvilMerge {
/**
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/EnchantingListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/EnchantingListeners.java
index 4ff77892..be25e8b6 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/EnchantingListeners.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/EnchantingListeners.java
@@ -125,10 +125,10 @@ public class EnchantingListeners extends PluginDependent implements L
if (!enchantment.canEnchantItem(item)) {
continue;
}
- if (NumberUtils.randFloat(0, 1) > enchantment.getRarity().getTableProbability() * multiplier) {
+ if (NumberUtils.randFloat(0, 1) > enchantment.getEnchantmentRarity().getTableProbability() * multiplier) {
continue;
}
- if (enchantment.getRarity().getMinimumLevel() > cost) {
+ if (enchantment.getEnchantmentRarity().getMinimumLevel() > cost) {
continue;
}
if (!enchantment.isEnabled()) {
@@ -172,7 +172,7 @@ public class EnchantingListeners extends PluginDependent implements L
level = (int) Math.ceil(enchantlevel2 / enchantlevel3);
} else {
int maxLevel = this.getPlugin().getConfigYml().getInt("enchanting-table.maximum-obtainable-level");
- double enchantlevel1 = (cost / (double) enchantment.getRarity().getMinimumLevel()) / (maxLevel / (double) enchantment.getRarity().getMinimumLevel());
+ double enchantlevel1 = (cost / (double) enchantment.getEnchantmentRarity().getMinimumLevel()) / (maxLevel / (double) enchantment.getEnchantmentRarity().getMinimumLevel());
double enchantlevel2 = NumberUtils.triangularDistribution(0, 1, enchantlevel1);
double enchantlevel3 = 1 / maxLevelDouble;
level = (int) Math.ceil(enchantlevel2 / enchantlevel3);
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/LootPopulator.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/LootPopulator.java
index 400b741a..a9ec9b0f 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/LootPopulator.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/LootPopulator.java
@@ -27,6 +27,7 @@ import java.util.Map;
import java.util.Random;
import java.util.concurrent.atomic.AtomicBoolean;
+@SuppressWarnings("deprecation")
public class LootPopulator extends BlockPopulator {
/**
* Instance of ecoenchants.
@@ -92,11 +93,11 @@ public class LootPopulator extends BlockPopulator {
int cap = 0;
for (EcoEnchant enchantment : enchantments) {
- if (enchantment == null || enchantment.getRarity() == null) {
+ if (enchantment == null || enchantment.getEnchantmentRarity() == null) {
continue;
}
- if (NumberUtils.randFloat(0, 1) > enchantment.getRarity().getLootProbability() * multiplier) {
+ if (NumberUtils.randFloat(0, 1) > enchantment.getEnchantmentRarity().getLootProbability() * multiplier) {
continue;
}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java
index 9e0bf8e8..a57264ef 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java
@@ -73,7 +73,7 @@ public class VillagerListeners extends PluginDependent implements Lis
EcoEnchant applied = null;
for (EcoEnchant enchantment : enchantments) {
- if (NumberUtils.randFloat(0, 1) > enchantment.getRarity().getVillagerProbability() * multiplier) {
+ if (NumberUtils.randFloat(0, 1) > enchantment.getEnchantmentRarity().getVillagerProbability() * multiplier) {
continue;
}
@@ -167,7 +167,7 @@ public class VillagerListeners extends PluginDependent implements Lis
double multiplier = 0.01;
for (EcoEnchant enchantment : enchantments) {
- if (NumberUtils.randFloat(0, 1) > enchantment.getRarity().getVillagerProbability() * multiplier) {
+ if (NumberUtils.randFloat(0, 1) > enchantment.getEnchantmentRarity().getVillagerProbability() * multiplier) {
continue;
}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/ItemConversions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/ItemConversions.java
index c27a4b36..7ae02f0f 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/ItemConversions.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/ItemConversions.java
@@ -32,6 +32,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
+@SuppressWarnings("deprecation")
public class ItemConversions extends PluginDependent implements Listener {
/**
* Pass an {@link EcoPlugin} in order to interface with it.
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/PaperHelper.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/PaperHelper.java
new file mode 100644
index 00000000..2048ecba
--- /dev/null
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/PaperHelper.java
@@ -0,0 +1,25 @@
+package com.willfp.ecoenchants.enchantments.util;
+
+import lombok.experimental.UtilityClass;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+import org.jetbrains.annotations.NotNull;
+
+@UtilityClass
+public class PaperHelper {
+ private static final LegacyComponentSerializer SERIALIZER = LegacyComponentSerializer.builder()
+ .hexColors()
+ .useUnusualXRepeatedCharacterHexFormat()
+ .character('ยง')
+ .build();
+
+ /**
+ * Convert string to a component.
+ *
+ * @param string The string.
+ * @return The component.
+ */
+ public static Component toComponent(@NotNull final String string) {
+ return SERIALIZER.deserialize(string);
+ }
+}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/plugins/IntegrationEssentials.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/plugins/IntegrationEssentials.java
index 70927125..14398661 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/plugins/IntegrationEssentials.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/plugins/IntegrationEssentials.java
@@ -9,17 +9,12 @@ import org.bukkit.enchantments.Enchantment;
import java.util.Map;
-@SuppressWarnings("unchecked")
public class IntegrationEssentials implements RegistrationWrapper {
@Override
public void registerAllEnchantments() {
- try {
- for (EcoEnchant enchantment : EcoEnchants.values()) {
- ((Map) FieldUtils.readDeclaredStaticField(Enchantments.class, "ENCHANTMENTS", true)).put(enchantment.getKey().getKey(), enchantment);
- ((Map) FieldUtils.readDeclaredStaticField(Enchantments.class, "ENCHANTMENTS", true)).put(enchantment.getPermissionName(), enchantment);
- }
- } catch (IllegalAccessException ignored) {
- // Ignore reflective errors that won't happen.
+ for (EcoEnchant enchantment : EcoEnchants.values()) {
+ Enchantments.registerEnchantment(enchantment.getKey().getKey(), enchantment);
+ Enchantments.registerAlias(enchantment.getPermissionName(), enchantment);
}
}
diff --git a/gradle.properties b/gradle.properties
index 765d8e82..2fee8c1a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,2 +1,2 @@
-version = 8.10.13
+version = 8.11.0
plugin-name = EcoEnchants
\ No newline at end of file