loadListeners() {
- return Arrays.asList(
- new EnchantingListeners(this),
- new GrindstoneListeners(this),
- new AnvilListeners(this),
- new WatcherTriggers(this),
- new VillagerListeners(this),
- new ItemConversions(this),
- new CustomEnchantEnableListeners(this),
- new CustomEcoEnchantRequirementListeners(this),
- new LazyHealthFixListener(this),
- new LootGenerateListeners(this)
- );
- }
-
- @Override
- @Nullable
- protected DisplayModule createDisplayModule() {
- return new EnchantDisplay(this);
- }
-
- @Override
- @NotNull
- public EnchantDisplay getDisplayModule() {
- return (EnchantDisplay) Objects.requireNonNull(super.getDisplayModule());
- }
-
- @NotNull
- @Override
- public String getMinimumEcoVersion() {
- return "6.37.1";
- }
-
- /**
- * Get the instance of EcoEnchants.
- *
- * Bad practice to use this.
- *
- * @return The instance.
- */
- public static EcoEnchantsPlugin getInstance() {
- return instance;
- }
-
- /**
- * Get rarity.yml.
- *
- * @return rarity.yml.
- */
- public RarityYml getRarityYml() {
- return this.rarityYml;
- }
-
- /**
- * Get target.yml.
- *
- * @return target.yml.
- */
- public TargetYml getTargetYml() {
- return this.targetYml;
- }
-
- /**
- * Get vanillaenchants.yml.
- *
- * @return vanillaenchants.yml.
- */
- public VanillaEnchantsYml getVanillaEnchantsYml() {
- return this.vanillaEnchantsYml;
- }
-
- /**
- * Get customenchants.yml
- *
- * @return customenchants.yml.
- */
- public CustomEnchantsYml getCustomEnchantsYml() {
- return customEnchantsYml;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandDebug.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandDebug.java
deleted file mode 100644
index d24479fb..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandDebug.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.willfp.ecoenchants.command;
-
-import com.willfp.eco.core.command.impl.Subcommand;
-import com.willfp.eco.core.fast.FastItemStack;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import org.bukkit.Bukkit;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.meta.ItemMeta;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@SuppressWarnings("deprecation")
-public class CommandDebug extends Subcommand {
- /**
- * Instantiate a new /ecoenchants debug command handler.
- *
- * @param plugin The plugin for the commands to listen for.
- */
- public CommandDebug(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin, "debug", "ecoenchants.command.debug", true);
- }
-
- @Override
- public void onExecute(@NotNull final CommandSender sender,
- @NotNull final List args) {
- Player player = (Player) sender;
- player.sendMessage("Held Item: " + player.getInventory().getItemInMainHand());
- player.sendMessage("Lore: ");
- Bukkit.getLogger().info("");
-
- Bukkit.getLogger().info("Held Item: " + player.getInventory().getItemInMainHand());
- Bukkit.getLogger().info("Lore: ");
- ItemMeta meta = player.getInventory().getItemInMainHand().getItemMeta();
- if (meta != null) {
- for (String s : new ArrayList<>(meta.hasLore() ? meta.getLore() : new ArrayList<>())) {
- Bukkit.getLogger().info(s);
- player.sendMessage(s);
- }
- }
- Bukkit.getLogger().info("");
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEcoEnchants.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEcoEnchants.java
deleted file mode 100644
index e18ac68f..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEcoEnchants.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.willfp.ecoenchants.command;
-
-import com.willfp.eco.core.command.impl.PluginCommand;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import org.bukkit.command.CommandSender;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-public class CommandEcoEnchants extends PluginCommand {
- /**
- * Instantiate a new /ecoenchants command handler.
- *
- * @param plugin The plugin for the commands to listen for.
- */
- public CommandEcoEnchants(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin, "ecoenchants", "ecoenchants.command.ecoenchants", false);
-
- this.addSubcommand(new CommandDebug(plugin))
- .addSubcommand(new CommandReload(plugin))
- .addSubcommand(new CommandGiverandombook(plugin))
- .addSubcommand(new CommandRandomenchant(plugin))
- .addSubcommand(new CommandLocale(plugin))
- .addSubcommand(new CommandToggleDescriptions(plugin));
- }
-
- @Override
- public void onExecute(@NotNull final CommandSender sender,
- @NotNull final List args) {
- sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-command"));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEnchantinfo.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEnchantinfo.java
deleted file mode 100644
index a13add06..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEnchantinfo.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package com.willfp.ecoenchants.command;
-
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.command.impl.PluginCommand;
-import com.willfp.eco.core.config.updating.ConfigUpdater;
-import com.willfp.eco.util.StringUtils;
-import com.willfp.ecoenchants.display.EnchantmentCache;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
-import org.apache.commons.lang.WordUtils;
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.util.StringUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-public class CommandEnchantinfo extends PluginCommand {
- /**
- * Instantiate a new /enchantinfo command handler.
- *
- * @param plugin The plugin for the commands to listen for.
- */
- public CommandEnchantinfo(@NotNull final EcoPlugin plugin) {
- super(plugin, "enchantinfo", "ecoenchants.command.enchantinfo", false);
- }
-
- @Override
- public void onExecute(@NotNull final CommandSender sender,
- @NotNull final List args) {
- if (args.isEmpty()) {
- sender.sendMessage(this.getPlugin().getLangYml().getMessage("missing-enchant"));
- return;
- }
- StringBuilder nameBuilder = new StringBuilder();
-
- args.forEach(arg -> nameBuilder.append(arg).append(" "));
- String searchName = nameBuilder.toString();
- searchName = searchName.substring(0, searchName.length() - 1);
-
- EcoEnchant enchantment = EcoEnchants.getByName(searchName);
-
- if (enchantment == null) {
- String finalSearchName = searchName;
- enchantment = EcoEnchants.values().stream().filter(ecoEnchant -> ChatColor.stripColor(ecoEnchant.getDisplayName()).equalsIgnoreCase(finalSearchName)).findFirst().orElse(null);
- }
-
- if (enchantment == null || !enchantment.isEnabled()) {
- String message = this.getPlugin().getLangYml().getMessage("not-found").replace("%name%", searchName);
- sender.sendMessage(message);
- return;
- }
-
- Set conflictNames = new HashSet<>();
-
- Set conflicts = enchantment.getConflicts();
-
- new HashSet<>(conflicts).forEach(enchantment1 -> {
- if (enchantment1 instanceof EcoEnchant ecoEnchant) {
- if (!ecoEnchant.isEnabled()) {
- conflicts.remove(enchantment1);
- }
- }
- });
-
- conflicts.forEach((enchantment1 -> {
- if (enchantment1 instanceof EcoEnchant enchant) {
- conflictNames.add(enchant.getDisplayName());
- } else {
- conflictNames.add(this.getPlugin().getLangYml().getFormattedString("enchantments." + enchantment1.getKey().getKey() + ".name"));
- }
- }));
-
- StringBuilder conflictNamesBuilder = new StringBuilder();
- conflictNames.forEach(name1 -> conflictNamesBuilder.append(name1).append(", "));
- String allConflicts = conflictNamesBuilder.toString();
- if (allConflicts.length() >= 2) {
- allConflicts = allConflicts.substring(0, allConflicts.length() - 2);
- } else {
- allConflicts = this.getPlugin().getLangYml().getFormattedString("no-conflicts");
- }
-
- Set targets = enchantment.getTargetMaterials();
-
- Set applicableItemsSet = new HashSet<>();
-
- if (this.getPlugin().getConfigYml().getBool("commands.enchantinfo.show-target-group")) {
- enchantment.getTargets().forEach(target -> {
- String targetName = target.getName();
- targetName = targetName.toLowerCase();
- targetName = targetName.replace("_", " ");
- targetName = WordUtils.capitalize(targetName);
- applicableItemsSet.add(targetName);
- });
- } else {
- targets.forEach(material -> {
- String matName = material.toString();
- matName = matName.toLowerCase();
- matName = matName.replace("_", " ");
- matName = WordUtils.capitalize(matName);
- applicableItemsSet.add(matName);
- });
- }
-
- StringBuilder targetNamesBuilder = new StringBuilder();
- applicableItemsSet.forEach(name1 -> targetNamesBuilder.append(name1).append(", "));
- String allTargets = targetNamesBuilder.toString();
- if (allTargets.length() >= 2) {
- allTargets = allTargets.substring(0, allTargets.length() - 2);
- } else {
- allTargets = this.getPlugin().getLangYml().getFormattedString("no-targets");
- }
-
- String maxLevel = String.valueOf(enchantment.getMaxLevel());
-
- final String finalName = EnchantmentCache.getEntry(enchantment).getName();
- final String finalDescription = EnchantmentCache.getEntry(enchantment).getStringDescription(1);
- final EnchantmentRarity finalRarity = enchantment.getEnchantmentRarity();
- final String finalTargets = allTargets;
- final String finalConflicts = allConflicts;
- final String finalMaxLevel = maxLevel;
- Arrays.asList(this.getPlugin().getLangYml().getMessage("enchantinfo").split("\\r?\\n")).forEach((string -> {
- string = string.replace("%name%", finalName)
- .replace("%description%", finalDescription)
- .replace("%rarity%", finalRarity.getName())
- .replace("%target%", finalTargets)
- .replace("%conflicts%", finalConflicts)
- .replace("%maxlevel%", finalMaxLevel);
- sender.sendMessage(string);
- }));
- }
-
- @Override
- public List tabComplete(@NotNull final CommandSender sender,
- @NotNull final List args) {
- List completions = new ArrayList<>();
-
- List names = EcoEnchants.values().stream().filter(EcoEnchant::isEnabled).map(EcoEnchant::getDisplayName).map(ChatColor::stripColor).toList();
-
- if (args.isEmpty()) {
- // Currently, this case is not ever reached
- return names;
- }
-
- StringUtil.copyPartialMatches(String.join(" ", args), names, completions);
-
- if (args.size() > 1) { // Remove all previous words from the candidate of completions
- ArrayList finishedArgs = new ArrayList<>(args);
- finishedArgs.remove(args.size() - 1);
-
- String prefix = String.join(" ", finishedArgs);
- completions = completions.stream().map(enchantName -> StringUtils.removePrefix(enchantName, prefix).trim()).collect(Collectors.toList());
- }
-
- Collections.sort(completions);
- return completions;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandGiverandombook.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandGiverandombook.java
deleted file mode 100644
index c07ca62b..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandGiverandombook.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package com.willfp.ecoenchants.command;
-
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.command.impl.Subcommand;
-import com.willfp.eco.core.config.updating.ConfigUpdater;
-import com.willfp.eco.core.items.builder.EnchantedBookBuilder;
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.display.EnchantmentCache;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.Bukkit;
-import org.bukkit.command.CommandSender;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.StringUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class CommandGiverandombook extends Subcommand {
- /**
- * The cached enchantment names.
- */
- private static final List RARITY_NAMES = EnchantmentRarity.values().stream().map(EnchantmentRarity::getName).collect(Collectors.toList());
-
- /**
- * The cached type names.
- */
- private static final List TYPE_NAMES = EnchantmentType.values().stream().map(EnchantmentType::getName).collect(Collectors.toList());
-
- /**
- * Instantiate a new command handler.
- *
- * @param plugin The plugin for the commands to listen for.
- */
- public CommandGiverandombook(@NotNull final EcoPlugin plugin) {
- super(plugin, "giverandombook", "ecoenchants.command.giverandombook", false);
- }
-
- /**
- * Called on /reload.
- */
- @ConfigUpdater
- public static void reload() {
- RARITY_NAMES.clear();
- RARITY_NAMES.addAll(EnchantmentRarity.values().stream().map(EnchantmentRarity::getName).toList());
- }
-
- @Override
- public void onExecute(@NotNull final CommandSender sender,
- @NotNull final List args) {
- if (args.isEmpty()) {
- sender.sendMessage(this.getPlugin().getLangYml().getMessage("requires-player"));
- return;
- }
- Player player = Bukkit.getServer().getPlayer(args.get(0));
-
- EnchantmentRarity rarity = args.size() >= 2 ? EnchantmentRarity.getByName(args.get(1).toLowerCase()) : null;
-
- EnchantmentType type = rarity == null && args.size() >= 2 ? EnchantmentType.getByName(args.get(1).toLowerCase()) : null;
-
-
- if (player == null) {
- sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-player"));
- return;
- }
-
- List allowed = Arrays.stream(Enchantment.values()).filter(enchantment -> {
- if (enchantment instanceof EcoEnchant) {
- return ((EcoEnchant) enchantment).isEnabled();
- }
- return true;
- }).filter(enchantment -> {
- if (rarity != null) {
- if (!(enchantment instanceof EcoEnchant ecoEnchant)) {
- return false;
- }
- return ecoEnchant.getEnchantmentRarity().equals(rarity);
- } else if (type != null) {
- if (!(enchantment instanceof EcoEnchant ecoEnchant)) {
- return false;
- }
- return ecoEnchant.getType().equals(type);
- }
- return true;
- }).toList();
-
- Enchantment enchantment = allowed.get(NumberUtils.randInt(0, allowed.size() - 1));
- int level = NumberUtils.randInt(1, enchantment.getMaxLevel());
-
- ItemStack itemStack = new EnchantedBookBuilder()
- .addStoredEnchantment(enchantment, level)
- .build();
-
- for (ItemStack stack : player.getInventory().addItem(itemStack).values()) {
- player.getWorld().dropItem(player.getLocation(), stack);
- }
-
- String message = this.getPlugin().getLangYml().getMessage("gave-random-book");
- message = message.replace("%enchantment%", EnchantmentCache.getEntry(enchantment).getName() + " " + NumberUtils.toNumeral(level) + "§r");
- sender.sendMessage(message);
-
- String message2 = this.getPlugin().getLangYml().getMessage("received-random-book");
- message2 = message2.replace("%enchantment%", EnchantmentCache.getEntry(enchantment).getName() + " " + NumberUtils.toNumeral(level) + "§r");
- player.sendMessage(message2);
- }
-
- @Override
- public List tabComplete(@NotNull final CommandSender sender,
- @NotNull final List args) {
- List completions = new ArrayList<>();
-
- List playerNames = Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList());
-
- if (args.isEmpty()) {
- // Currently, this case is not ever reached
- return playerNames;
- }
-
- if (args.size() == 1) {
- StringUtil.copyPartialMatches(String.join(" ", args.get(0)), playerNames, completions);
- }
-
- if (args.size() == 2) {
- StringUtil.copyPartialMatches(String.join(" ", args.get(1)), RARITY_NAMES, completions);
- StringUtil.copyPartialMatches(String.join(" ", args.get(1)), TYPE_NAMES, completions);
- }
-
- Collections.sort(completions);
- return completions;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocale.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocale.java
deleted file mode 100644
index 5d8ef4ce..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocale.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.willfp.ecoenchants.command;
-
-import com.willfp.eco.core.command.impl.Subcommand;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import org.bukkit.command.CommandSender;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-public class CommandLocale extends Subcommand {
- /**
- * Instantiate a new /ecoenchants locale command handler.
- *
- * @param plugin The plugin for the commands to listen for.
- */
- public CommandLocale(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin, "locale", "ecoenchants.command.locale", false);
-
- this.addSubcommand(new CommandLocaleExport(plugin))
- .addSubcommand(new CommandLocaleDownload(plugin));
- }
-
- @Override
- public void onExecute(@NotNull final CommandSender sender,
- @NotNull final List args) {
- sender.sendMessage(this.getPlugin().getLangYml().getMessage("specify-locale-subcommand"));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocaleDownload.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocaleDownload.java
deleted file mode 100644
index a8a0c60c..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocaleDownload.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.willfp.ecoenchants.command;
-
-import com.willfp.eco.core.command.impl.Subcommand;
-import com.willfp.eco.core.config.ConfigType;
-import com.willfp.eco.core.config.TransientConfig;
-import com.willfp.eco.core.config.interfaces.Config;
-import com.willfp.eco.core.web.Paste;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import org.bukkit.command.CommandSender;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.IOException;
-import java.util.List;
-
-public class CommandLocaleDownload extends Subcommand {
- /**
- * Instantiate a new /ecoenchants locale download command handler.
- *
- * @param plugin The plugin for the commands to listen for.
- */
- public CommandLocaleDownload(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin, "download", "ecoenchants.command.locale.download", false);
- }
-
- @Override
- public void onExecute(@NotNull final CommandSender sender,
- @NotNull final List args) {
- if (args.isEmpty()) {
- sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-locale"));
- return;
- }
-
- Paste paste = Paste.getFromHastebin(args.get(0));
- if (paste == null) {
- sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-locale"));
- return;
- }
-
- String contents = paste.getContents();
- Config configuration = new TransientConfig(contents, ConfigType.YAML);
-
- for (String key : configuration.getKeys(true)) {
- this.getPlugin().getLangYml().set(key, configuration.get(key));
- }
-
- try {
- this.getPlugin().getLangYml().save();
-
- for (EcoEnchant value : EcoEnchants.values()) {
- value.getConfig().loadFromLang();
- value.getConfig().save();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- sender.sendMessage(this.getPlugin().getLangYml().getMessage("downloaded-locale"));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocaleExport.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocaleExport.java
deleted file mode 100644
index c9dc7b9a..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocaleExport.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.willfp.ecoenchants.command;
-
-import com.willfp.eco.core.command.impl.Subcommand;
-import com.willfp.eco.core.web.Paste;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import org.bukkit.command.CommandSender;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.StringReader;
-import java.util.List;
-
-public class CommandLocaleExport extends Subcommand {
- /**
- * Instantiate a new /ecoenchants locale export command handler.
- *
- * @param plugin The plugin for the commands to listen for.
- */
- public CommandLocaleExport(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin, "export", "ecoenchants.command.locale.export", false);
- }
-
- @Override
- public void onExecute(@NotNull final CommandSender sender,
- @NotNull final List args) {
- YamlConfiguration configuration = YamlConfiguration.loadConfiguration(new StringReader(this.getPlugin().getLangYml().toPlaintext()));
- for (EcoEnchant enchant : EcoEnchants.values()) {
- configuration.set("enchantments." + enchant.getKey().getKey() + ".name", enchant.getConfig().getHandle().getString("name"));
- configuration.set("enchantments." + enchant.getKey().getKey() + ".description", enchant.getConfig().getHandle().getString("description"));
- }
-
- Paste paste = new Paste(configuration.saveToString());
-
- paste.getHastebinToken(token -> {
- if (token.length() > 15) {
- sender.sendMessage(
- this.getPlugin().getLangYml().getMessage("export-failed")
- );
- } else {
- sender.sendMessage(
- this.getPlugin().getLangYml().getMessage("link-to-locale").replace(
- "%token%", token
- )
- );
- }
- });
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandRandomenchant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandRandomenchant.java
deleted file mode 100644
index fc203209..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandRandomenchant.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package com.willfp.ecoenchants.command;
-
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.command.impl.Subcommand;
-import com.willfp.ecoenchants.display.EnchantmentCache;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.EnchantmentStorageMeta;
-import org.bukkit.inventory.meta.ItemMeta;
-import org.bukkit.util.StringUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class CommandRandomenchant extends Subcommand {
- /**
- * Instantiate a new /ecoreload command handler.
- *
- * @param plugin The plugin for the commands to listen for.
- */
- public CommandRandomenchant(@NotNull final EcoPlugin plugin) {
- super(plugin, "randomenchant", "ecoenchants.command.randomenchant", false);
- }
-
- @Override
- public void onExecute(@NotNull final CommandSender sender,
- @NotNull final List args) {
- Player player;
-
- if ((args.isEmpty() && sender instanceof Player) || !sender.hasPermission("ecoenchants.command.randomenchant.others")) {
- player = (Player) sender;
- } else if (!args.isEmpty()) {
- player = Bukkit.getServer().getPlayer(args.get(0));
- } else {
- player = null;
- }
-
- if (player == null) {
- sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-player"));
- return;
- }
-
- ItemStack itemStack = player.getInventory().getItemInMainHand();
- ItemMeta meta = itemStack.getItemMeta();
-
- if (itemStack.getType() == Material.AIR || meta == null || !EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) {
- if (player.equals(sender)) {
- player.sendMessage(this.getPlugin().getLangYml().getMessage("must-hold-item"));
- } else {
- sender.sendMessage(this.getPlugin().getLangYml().getMessage("must-hold-item-other"));
- }
- return;
- }
-
- List ecoEnchants = new ArrayList<>(EcoEnchants.values());
- Collections.shuffle(ecoEnchants);
- EcoEnchant enchant = null;
-
- List onItem = new ArrayList<>();
-
- if (meta instanceof EnchantmentStorageMeta) {
- onItem.addAll(((EnchantmentStorageMeta) meta).getStoredEnchants().keySet());
- } else {
- onItem.addAll(meta.getEnchants().keySet());
- }
-
- for (EcoEnchant ecoEnchant : ecoEnchants) {
- if (ecoEnchant.canEnchantItem(itemStack)) {
- if (!ecoEnchant.conflictsWithAny(onItem)) {
- if (ecoEnchant.isEnabled()) {
- if (onItem.stream().noneMatch(enchantment -> enchantment.conflictsWith(ecoEnchant))) {
- if (!onItem.contains(ecoEnchant)) {
- boolean conflicts = false;
- for (Enchantment enchantment : onItem) {
- if (enchantment instanceof EcoEnchant ecoEnchantOnItem) {
- if (ecoEnchantOnItem.getType().equals(ecoEnchant.getType()) && ecoEnchantOnItem.getType().isSingular()) {
- conflicts = true;
- }
- }
- }
- if (this.getPlugin().getConfigYml().getBool("anvil.hard-cap.enabled")
- && !player.hasPermission("ecoenchants.command.randomenchant.bypasshardcap")
- && onItem.size() >= this.getPlugin().getConfigYml().getInt("anvil.hard-cap.cap")) {
- conflicts = true;
- }
- if (!conflicts) {
- enchant = ecoEnchant;
- }
- }
- }
- }
- }
- }
- }
-
- if (enchant == null) {
- player.sendMessage(this.getPlugin().getLangYml().getMessage("no-enchants-available"));
- return;
- }
-
- if (meta instanceof EnchantmentStorageMeta) {
- ((EnchantmentStorageMeta) meta).addStoredEnchant(enchant, enchant.getMaxLevel(), true);
- } else {
- meta.addEnchant(enchant, enchant.getMaxLevel(), true);
- }
-
- itemStack.setItemMeta(meta);
- String message = this.getPlugin().getLangYml().getMessage("applied-random-enchant");
- message = message.replace("%enchantment%", EnchantmentCache.getEntry(enchant).getName() + "§r");
- player.sendMessage(message);
- }
-
- @Override
- public List tabComplete(@NotNull final CommandSender sender,
- @NotNull final List args) {
- List completions = new ArrayList<>();
-
- List playerNames = Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList());
-
- if (args.isEmpty() || !sender.hasPermission("ecoenchants.command.randomenchant.others")) {
- // Currently, this case is not ever reached
- return playerNames;
- }
-
- if (args.size() == 1) {
- StringUtil.copyPartialMatches(String.join(" ", args), playerNames, completions);
- Collections.sort(completions);
- return completions;
- }
-
- return new ArrayList<>();
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandReload.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandReload.java
deleted file mode 100644
index 42e6dc7f..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandReload.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.willfp.ecoenchants.command;
-
-import com.willfp.eco.core.command.impl.Subcommand;
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.eco.util.StringUtils;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import org.bukkit.command.CommandSender;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-public class CommandReload extends Subcommand {
- /**
- * Instantiate a new command handler.
- *
- * @param plugin The plugin for the commands to listen for.
- */
- public CommandReload(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin, "reload", "ecoenchants.command.reload", false);
- }
-
- @Override
- public void onExecute(@NotNull final CommandSender sender,
- @NotNull final List args) {
- sender.sendMessage(this.getPlugin().getLangYml().getMessage("reloaded", StringUtils.FormatOption.WITHOUT_PLACEHOLDERS)
- .replace("%time%", NumberUtils.format(this.getPlugin().reloadWithTime())));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandToggleDescriptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandToggleDescriptions.java
deleted file mode 100644
index 2cb95ad9..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandToggleDescriptions.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.willfp.ecoenchants.command;
-
-import com.willfp.eco.core.command.impl.Subcommand;
-import com.willfp.eco.core.data.PlayerProfile;
-import com.willfp.eco.core.data.keys.PersistentDataKey;
-import com.willfp.eco.core.data.keys.PersistentDataKeyType;
-import com.willfp.eco.util.NamespacedKeyUtils;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-public class CommandToggleDescriptions extends Subcommand {
- /**
- * Persistent data key for descriptions.
- */
- public static final PersistentDataKey DESCRIPTIONS_KEY = new PersistentDataKey<>(
- NamespacedKeyUtils.create("ecoenchants", "descriptions_enabled"),
- PersistentDataKeyType.BOOLEAN,
- true
- ).player();
-
- /**
- * Instantiate a new command handler.
- *
- * @param plugin The plugin for the commands to listen for.
- */
- public CommandToggleDescriptions(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin, "toggledescriptions", "ecoenchants.command.toggledescriptions", true);
- }
-
- @Override
- public void onExecute(@NotNull final CommandSender sender,
- @NotNull final List args) {
- if (!((EcoEnchantsPlugin) this.getPlugin()).getDisplayModule().getOptions().getDescriptionOptions().isEnabled()) {
- sender.sendMessage(this.getPlugin().getLangYml().getMessage("descriptions-disabled"));
- return;
- }
- Player player = (Player) sender;
- PlayerProfile profile = PlayerProfile.load(player);
- boolean currentStatus = profile.read(DESCRIPTIONS_KEY);
- currentStatus = !currentStatus;
- profile.write(DESCRIPTIONS_KEY, currentStatus);
- if (currentStatus) {
- player.sendMessage(this.getPlugin().getLangYml().getMessage("enabled-descriptions"));
- } else {
- player.sendMessage(this.getPlugin().getLangYml().getMessage("disabled-descriptions"));
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/CustomEnchantsYml.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/CustomEnchantsYml.java
deleted file mode 100644
index eaf5720b..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/CustomEnchantsYml.java
+++ /dev/null
@@ -1,17 +0,0 @@
-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 org.jetbrains.annotations.NotNull;
-
-public class CustomEnchantsYml extends BaseConfig {
- /**
- * Instantiate target.yml.
- *
- * @param plugin Instance of EcoEnchants.
- */
- public CustomEnchantsYml(@NotNull final EcoPlugin plugin) {
- super("customenchants", plugin, true, ConfigType.YAML);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/RarityYml.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/RarityYml.java
deleted file mode 100644
index 95cdecfb..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/RarityYml.java
+++ /dev/null
@@ -1,28 +0,0 @@
-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 org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-public class RarityYml extends BaseConfig {
- /**
- * Instantiate rarity.yml.
- *
- * @param plugin Instance of EcoEnchants.
- */
- public RarityYml(@NotNull final EcoPlugin plugin) {
- super("rarity", plugin, false, ConfigType.YAML);
- }
-
- /**
- * Get all rarity names.
- *
- * @return Set of all rarity names.
- */
- public List getRarities() {
- return this.getSubsection("rarities").getKeys(false);
- }
-}
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
deleted file mode 100644
index dd62ed8f..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/TargetYml.java
+++ /dev/null
@@ -1,68 +0,0 @@
-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.enchantments.meta.EnchantmentTarget;
-import org.bukkit.Material;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-
-public class TargetYml extends BaseConfig {
- /**
- * Instantiate target.yml.
- *
- * @param plugin Instance of EcoEnchants.
- */
- public TargetYml(@NotNull final EcoPlugin plugin) {
- super("target", plugin, false, ConfigType.YAML);
- }
-
- /**
- * Get all target names.
- *
- * @return Set of all names.
- */
- public List getTargets() {
- return this.getSubsection("targets").getKeys(false);
- }
-
- /**
- * Get all materials from a target name.
- *
- * @param target The name of the target.
- * @return All materials.
- */
- public Set getTargetMaterials(@NotNull final String target) {
- Set materials = new HashSet<>();
- this.getStrings("targets." + target).forEach(materialName -> {
- materials.add(Material.getMaterial(materialName.toUpperCase()));
- });
-
- materials.removeIf(Objects::isNull);
-
- return materials;
- }
-
- /**
- * Get the slot for a target name.
- *
- * @param target The target.
- * @return The slot, or {@link com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget.Slot#ANY}
- */
- public EnchantmentTarget.Slot getSlot(@NotNull final String target) {
- for (String str : this.getStrings("targets." + target)) {
- if (str.startsWith("slot:")) {
- return EnchantmentTarget.Slot.valueOf(
- str.replace("slot:", "").toUpperCase()
- );
- }
- }
-
- return EnchantmentTarget.Slot.ANY;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/VanillaEnchantsYml.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/VanillaEnchantsYml.java
deleted file mode 100644
index cc71a265..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/VanillaEnchantsYml.java
+++ /dev/null
@@ -1,17 +0,0 @@
-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 org.jetbrains.annotations.NotNull;
-
-public class VanillaEnchantsYml extends BaseConfig {
- /**
- * Instantiate target.yml.
- *
- * @param plugin Instance of EcoEnchants.
- */
- public VanillaEnchantsYml(@NotNull final EcoPlugin plugin) {
- super("vanillaenchants", plugin, true, ConfigType.YAML);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/BaseEnchantmentConfig.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/BaseEnchantmentConfig.java
deleted file mode 100644
index 760ee7d8..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/BaseEnchantmentConfig.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.willfp.ecoenchants.config.configs;
-
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.config.ConfigType;
-import com.willfp.eco.core.config.ExtendableConfig;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import org.jetbrains.annotations.NotNull;
-
-public class BaseEnchantmentConfig extends ExtendableConfig {
- /**
- * Instantiate a new config for an enchantment.
- *
- * @param name The name of the config.
- * @param source The class in the jar where the config is contained.
- * @param plugin The provider of the enchantment.
- * @param enchant The enchantment.
- */
- public BaseEnchantmentConfig(@NotNull final String name,
- @NotNull final Class> source,
- @NotNull final EcoEnchant enchant,
- @NotNull final EcoPlugin plugin) {
- super(name, true, plugin, source, "enchants/" + enchant.getType().getName() + "/", ConfigType.YAML);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java
deleted file mode 100644
index 9b467249..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package com.willfp.ecoenchants.config.configs;
-
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.config.interfaces.Config;
-import com.willfp.eco.core.config.interfaces.LoadableConfig;
-import com.willfp.eco.core.config.wrapper.ConfigWrapper;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
-import lombok.Getter;
-import org.bukkit.Bukkit;
-import org.bukkit.NamespacedKey;
-import org.bukkit.enchantments.Enchantment;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class EnchantmentConfig extends ConfigWrapper {
- /**
- * The name of the config.
- */
- @Getter
- private final String name;
-
- /**
- * The enchantment.
- */
- @Getter
- private final EcoEnchant enchant;
-
- /**
- * Instance of EcoEnchants.
- */
- @Getter
- private final EcoPlugin plugin;
-
- /**
- * Instantiate a new config for an enchantment.
- *
- * @param handle The handle.
- * @param name The config name.
- * @param enchant The enchant.
- * @param plugin Instance of EcoEnchants.
- */
- public EnchantmentConfig(@NotNull final Config handle,
- @NotNull final String name,
- @NotNull final EcoEnchant enchant,
- @NotNull final EcoPlugin plugin) {
- super(handle);
- this.name = name;
- this.enchant = enchant;
- this.plugin = plugin;
- }
-
- /**
- * Get a set of enchantments stored by key.
- *
- * @param path The location of the enchantments in the config.
- * @return A set of all enchantments.
- */
- public Set getEnchantments(@NotNull final String path) {
- Set enchantments = new HashSet<>();
- List enchantmentKeys = this.getStrings(path);
- for (String key : enchantmentKeys) {
- if (Enchantment.getByKey(NamespacedKey.minecraft(key)) != null) {
- enchantments.add(Enchantment.getByKey(NamespacedKey.minecraft(key)));
- }
- }
- return enchantments;
- }
-
- /**
- * Get the rarity of the enchantment.
- *
- * @return The rarity, or null if invalid.
- */
- public EnchantmentRarity getRarity() {
- String rarityName = this.getString("obtaining.rarity");
- return EnchantmentRarity.getByName(rarityName);
- }
-
- /**
- * Get all applicable targets.
- *
- * @return The targets.
- */
- public Set getTargets() {
- List targetNames = this.getStrings(EcoEnchants.GENERAL_LOCATION + "targets");
- if (targetNames.isEmpty()) {
- return new HashSet<>();
- }
- Set targets = new HashSet<>();
-
- targetNames.forEach((s -> {
- if (EnchantmentTarget.getByName(s) == null) {
- Bukkit.getLogger().warning("Target specified in " + name + " is invalid!");
- return;
- }
- targets.add(EnchantmentTarget.getByName(s));
- }));
-
- return targets;
- }
-
- /**
- * Load config values from lang.yml.
- */
- public void loadFromLang() {
- if (!this.getPlugin().getLangYml().has("enchantments." + this.getEnchant().getKey().getKey())) {
- return;
- }
-
- this.set("name", this.getPlugin().getLangYml().getString("enchantments." + this.getEnchant().getKey().getKey() + ".name"));
- this.set("description", this.getPlugin().getLangYml().getString("enchantments." + this.getEnchant().getKey().getKey() + ".description"));
-
- this.getPlugin().getLangYml().set("enchantments." + this.getEnchant().getKey().getKey(), null);
-
- try {
- this.save();
- this.getPlugin().getLangYml().save();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Save if savable config.
- */
- public void save() {
- try {
- if (this.getHandle() instanceof LoadableConfig loadableConfig) {
- loadableConfig.save();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java
deleted file mode 100644
index 60204743..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java
+++ /dev/null
@@ -1,275 +0,0 @@
-package com.willfp.ecoenchants.display;
-
-import com.google.common.collect.Lists;
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.display.Display;
-import com.willfp.eco.core.display.DisplayModule;
-import com.willfp.eco.core.display.DisplayPriority;
-import com.willfp.eco.core.fast.FastItemStack;
-import com.willfp.eco.util.StringUtils;
-import com.willfp.ecoenchants.display.options.DisplayOptions;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.custom.CustomEcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
-import com.willfp.ecoenchants.enchantments.util.ItemConversionOptions;
-import lombok.Getter;
-import org.bukkit.Material;
-import org.bukkit.NamespacedKey;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemFlag;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.persistence.PersistentDataContainer;
-import org.bukkit.persistence.PersistentDataType;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * All methods and fields pertaining to showing players the enchantments on their items.
- */
-@SuppressWarnings("DeprecatedIsStillUsed")
-public class EnchantDisplay extends DisplayModule {
- /**
- * The meta key to hide enchantments in lore.
- *
- * EcoEnchants packet lore implementation of HideEnchants.
- */
- @Getter
- private final NamespacedKey keySkip;
-
- /**
- * The legacy V key.
- *
- * Exists for backwards compatibility.
- */
- @Getter
- @Deprecated
- private final NamespacedKey legacyV;
-
- /**
- * The configurable options for displaying enchantments.
- */
- @Getter
- private final DisplayOptions options;
-
- /**
- * Create EcoEnchants display module.
- *
- * @param plugin Instance of EcoEnchants.
- */
- public EnchantDisplay(@NotNull final EcoPlugin plugin) {
- super(plugin, DisplayPriority.LOW);
- keySkip = this.getPlugin().getNamespacedKeyFactory().create("ecoenchantlore-skip");
- legacyV = this.getPlugin().getNamespacedKeyFactory().create("ecoenchantlore-v");
- options = new DisplayOptions(this.getPlugin());
- }
-
- /**
- * Update config values.
- */
- public void update() {
- options.update();
- EnchantmentCache.update();
- }
-
- @Override
- public void display(@NotNull final ItemStack itemStack,
- @Nullable final Player player,
- @NotNull final Object... args) {
- if (options.isRequireTarget()) {
- if (!EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) {
- return;
- }
- }
-
- FastItemStack fastItemStack = FastItemStack.wrap(itemStack);
-
- boolean hide = (boolean) args[0];
-
- if (hide || fastItemStack.getPersistentDataContainer().has(keySkip, PersistentDataType.INTEGER)) {
- fastItemStack.addItemFlags(ItemFlag.HIDE_ENCHANTS);
- if (itemStack.getType() == Material.ENCHANTED_BOOK) {
- fastItemStack.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
- }
- fastItemStack.getPersistentDataContainer().set(keySkip, PersistentDataType.INTEGER, 1);
- return;
- }
-
- List itemLore = fastItemStack.getLore();
-
- List lore = new ArrayList<>();
- List requirementLore = new ArrayList<>();
-
- LinkedHashMap enchantments = new LinkedHashMap<>(fastItemStack.getEnchants(true));
-
- enchantments.entrySet().removeIf(enchantmentIntegerEntry -> enchantmentIntegerEntry.getValue().equals(0));
-
- List unsorted = new ArrayList<>();
- enchantments.forEach((enchantment, integer) -> unsorted.add(enchantment));
-
- Map tempEnchantments = new HashMap<>(enchantments);
-
- options.getSorter().sortEnchantments(unsorted);
-
- enchantments.clear();
- unsorted.forEach(enchantment -> enchantments.put(enchantment, tempEnchantments.get(enchantment)));
- enchantments.forEach((enchantment, level) -> {
- if (enchantment instanceof EcoEnchant ecoEnchant && ecoEnchant.hasFlag("hide-in-lore")) {
- return;
- }
-
- String name = player == null
- ? EnchantmentCache.getEntry(enchantment).getNameWithLevel(level)
- : EnchantmentCache.getEntry(enchantment).getNameWithLevel(level, player);
-
- lore.add(Display.PREFIX + name);
- if (!options.getDescriptionOptions().isShowingAtBottom()) {
- if (enchantments.size() <= options.getDescriptionOptions().getThreshold()
- && options.getDescriptionOptions().isEnabled()
- && options.getDescriptionOptions().enabledForPlayer(player)
- ) {
- if (options.getDescriptionOptions().isOnlyOnBooks() && itemStack.getType() != Material.ENCHANTED_BOOK) {
- return;
- }
-
- lore.addAll(EnchantmentCache.getEntry(enchantment).getDescription(level));
- }
- }
-
- if (player != null && enchantment instanceof EcoEnchant ecoEnchant) {
- if (ecoEnchant instanceof CustomEcoEnchant custom) {
- requirementLore.addAll(custom.getLevel(level).getNotMetLines(player).stream().map(l -> Display.PREFIX + l).toList());
- }
-
- if (!ecoEnchant.areRequirementsMet(player)) {
- requirementLore.addAll(StringUtils.formatList(EnchantmentCache.getEntry(enchantment).getRequirementLore(), player));
- }
- }
- });
-
- if (options.getShrinkOptions().isEnabled() && (enchantments.size() > options.getShrinkOptions().getThreshold())) {
- List> partitionedCombinedLoreList = Lists.partition(lore, options.getShrinkOptions().getShrinkPerLine());
- List newLore = new ArrayList<>();
- partitionedCombinedLoreList.forEach(list -> {
- StringBuilder builder = new StringBuilder();
- for (String s : list) {
- builder.append(s);
- builder.append(", ");
- }
- String line = builder.toString();
- line = line.substring(0, line.length() - 2);
- newLore.add(line);
- });
- lore.clear();
- lore.addAll(newLore);
- }
-
- if (options.getDescriptionOptions().isShowingAtBottom()) {
- if (enchantments.size() <= options.getDescriptionOptions().getThreshold()
- && options.getDescriptionOptions().isEnabled()
- && options.getDescriptionOptions().enabledForPlayer(player)
- ) {
- for (Map.Entry entry : enchantments.entrySet()) {
- lore.addAll(EnchantmentCache.getEntry(entry.getKey()).getDescription(entry.getValue()));
- }
- }
- }
-
- if (!(itemStack.getType() == Material.ENCHANTED_BOOK && !options.isPrefixOnBooks())) {
- if (!enchantments.isEmpty()) {
- lore.addAll(0, options.getLorePrefix());
- lore.addAll(options.getLoreSuffix());
- }
- }
-
- if (this.getOptions().isAboveLore()) {
- lore.addAll(itemLore);
- } else {
- lore.addAll(0, itemLore);
- }
- lore.addAll(requirementLore);
-
- if (!lore.isEmpty()) {
- fastItemStack.setLore(lore);
- }
-
- if (itemStack.getType() == Material.ENCHANTED_BOOK) {
- fastItemStack.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_POTION_EFFECTS);
- } else {
- fastItemStack.addItemFlags(ItemFlag.HIDE_ENCHANTS);
- }
- if (itemStack.getType() == Material.ENCHANTED_BOOK) {
- fastItemStack.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
- }
- }
-
- @Override
- public void revert(@NotNull final ItemStack itemStack) {
- if (options.isRequireTarget()) {
- if (!EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) {
- return;
- }
- }
-
- FastItemStack fastItemStack = FastItemStack.wrap(itemStack);
-
- PersistentDataContainer pdc = fastItemStack.getPersistentDataContainer();
-
- // Fixes weird bug. Apparently nullable.
- //noinspection ConstantConditions
- if (pdc == null) {
- return;
- }
-
- pdc.remove(legacyV);
-
- if (!pdc.has(keySkip, PersistentDataType.INTEGER)) {
- fastItemStack.removeItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
- fastItemStack.removeItemFlags(ItemFlag.HIDE_ENCHANTS);
- }
-
- pdc.remove(keySkip);
- }
-
- @Override
- public Object[] generateVarArgs(@NotNull final ItemStack itemStack) {
- if (options.isRequireTarget()) {
- if (!EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) {
- return new Object[]{false};
- }
- }
-
- FastItemStack fastItemStack = FastItemStack.wrap(itemStack);
-
- if (!itemStack.hasItemMeta()) {
- return new Object[]{false};
- }
-
- boolean hideEnchants = fastItemStack.hasItemFlag(ItemFlag.HIDE_ENCHANTS) || fastItemStack.hasItemFlag(ItemFlag.HIDE_POTION_EFFECTS);
-
- if (fastItemStack.getPersistentDataContainer().has(legacyV, PersistentDataType.INTEGER)) {
- hideEnchants = false;
- }
-
- if (Display.isFinalized(itemStack)) {
- hideEnchants = false;
- }
-
- if (ItemConversionOptions.isUsingExperimentalHideFixer() && ItemConversionOptions.isUsingForceHideFixer()) {
- hideEnchants = false;
- }
-
- if (ItemConversionOptions.isUsingExperimentalHideFixer() && fastItemStack.hasItemFlag(ItemFlag.HIDE_ENCHANTS) && fastItemStack.hasItemFlag(ItemFlag.HIDE_POTION_EFFECTS)) {
- hideEnchants = false;
- }
-
- return new Object[]{hideEnchants};
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java
deleted file mode 100644
index cafc9bee..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java
+++ /dev/null
@@ -1,405 +0,0 @@
-package com.willfp.ecoenchants.display;
-
-import com.google.common.collect.ImmutableMap;
-import com.willfp.eco.core.config.updating.ConfigUpdater;
-import com.willfp.eco.core.display.Display;
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.eco.util.StringUtils;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.display.options.NumbersOptions;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import lombok.Getter;
-import lombok.ToString;
-import lombok.experimental.UtilityClass;
-import org.apache.commons.lang.WordUtils;
-import org.bukkit.Bukkit;
-import org.bukkit.NamespacedKey;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.enchantments.EnchantmentWrapper;
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.JProgressBar;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@UtilityClass
-public class EnchantmentCache {
- /**
- * Instance of EcoEnchants.
- */
- public static final EcoEnchantsPlugin PLUGIN = EcoEnchantsPlugin.getInstance();
-
- /**
- * The physical cache.
- */
- private static final Map CACHE = new HashMap<>();
-
- /**
- * Get the {@link CacheEntry} for a specific enchantment.
- *
- * Returns a default "broken" cache entry if not cached.
- *
- * @param enchantment The enchantment to query.
- * @return The found cache entry.
- */
- public static CacheEntry getEntry(@NotNull final Enchantment enchantment) {
- CacheEntry matching = CACHE.get(enchantment.getKey());
- if (matching != null) {
- return matching;
- } else {
- updateEnchantment(enchantment);
- Bukkit.getLogger().warning(enchantment.getKey() + " (from class " + enchantment.getClass() + ") was not cached! Trying to fix...");
- return getEntry(enchantment);
- }
- }
-
- /**
- * Get the entire cache.
- *
- * @return An immutable map of the cache.
- */
- public static Map getCache() {
- return ImmutableMap.copyOf(CACHE);
- }
-
- /**
- * Update the cache.
- */
- @ConfigUpdater
- public static void update() {
- CACHE.clear();
- Arrays.asList(Enchantment.values()).forEach(EnchantmentCache::updateEnchantment);
- }
-
- private static void updateEnchantment(@NotNull final Enchantment enchantment) {
- CACHE.remove(enchantment.getKey());
-
- if (enchantment instanceof EnchantmentWrapper) {
- Bukkit.getLogger().severe("Found erroneous enchantment registration!");
- Bukkit.getLogger().severe("Enchantment " + enchantment.getKey()
- + " (Found in class " + enchantment.getClass().getName() + ", Path: " + enchantment.getClass().getProtectionDomain().getCodeSource().getLocation().getPath() + ")"
- );
- Bukkit.getLogger().severe("Tell the author to lean how enchantments are stored internally.");
- Bukkit.getLogger().severe("Hint: Extend Enchantment instead of EnchantmentWrapper.");
- CACHE.put(enchantment.getKey(), new CacheEntry(
- enchantment,
- "&4INVALID ENCHANTMENT",
- new HashMap<>(Map.of(1, Collections.singletonList(Display.PREFIX + "INVALID ENCHANTMENT: " + enchantment.getClass().getName()))),
- EnchantmentType.NORMAL,
- EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-rarity")),
- "&7"
- ));
- return;
- }
-
- String name;
- String color;
- EnchantmentType type;
- EnchantmentRarity rarity;
- List description;
- if (enchantment instanceof EcoEnchant ecoEnchant) {
- description = StringUtils.formatList(ecoEnchant.getWrappedDescription());
- name = ecoEnchant.getDisplayName();
- type = ecoEnchant.getType();
- rarity = ecoEnchant.getEnchantmentRarity();
- } else {
- description = Arrays.asList(
- WordUtils.wrap(
- PLUGIN.getLangYml().getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".description"),
- PLUGIN.getConfigYml().getInt("lore.describe.wrap"),
- "\n", false
- ).split("\\r?\\n")
- );
- name = PLUGIN.getLangYml().getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".name");
- type = enchantment.isCursed() ? EnchantmentType.CURSE : EnchantmentType.NORMAL;
- if (enchantment.isTreasure()) {
- rarity = EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-treasure-rarity"));
- } else {
- rarity = EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-rarity"));
- }
- }
-
- color = type.getColor();
-
-
- if (rarity == null) {
- rarity = EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-rarity"));
- }
-
- if (rarity.hasCustomColor() && type != EnchantmentType.CURSE) {
- color = rarity.getCustomColor();
- }
-
- description.replaceAll(line -> line.replace("§r", "§r" + PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor()));
- description.replaceAll(line -> line.replace("&r", "&r" + PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor()));
- description.replaceAll(line -> Display.PREFIX + PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor() + line);
-
- Map> levelDescription = new HashMap<>();
-
- if (enchantment instanceof EcoEnchant ecoEnchant) {
- for (int i = 1; i <= ecoEnchant.getMaxLevel(); i++) {
- List levelDesc = new ArrayList<>();
- for (String s : description) {
- levelDesc.add(s.replace("%value%", ecoEnchant.getPlaceholder(i)));
- }
-
- levelDescription.put(
- i,
- levelDesc
- );
- }
- } else {
- for (int i = 1; i <= enchantment.getMaxLevel(); i++) {
- levelDescription.put(i, description);
- }
- }
- CACHE.put(enchantment.getKey(), new CacheEntry(enchantment, name, levelDescription, type, rarity, color));
- }
-
- @ToString
- public static final class CacheEntry {
- /**
- * The enchantment that this cache is for.
- */
- @Getter
- private final Enchantment enchantment;
-
- /**
- * The name of the enchantment.
- */
- private final String name;
-
- /**
- * The default color of the enchantment.
- */
- @Getter
- private final String color;
-
- /**
- * The description, line-wrapped.
- */
- private final Map> description;
-
- /**
- * The description, not line-wrapped or colorized.
- */
- private final Map stringDescription;
-
- /**
- * The type of the enchantment.
- */
- @Getter
- private final EnchantmentType type;
-
- /**
- * The requirement lore.
- */
- @Getter
- private final List requirementLore;
-
- /**
- * The rarity of the enchantment.
- */
- @Getter
- private final EnchantmentRarity rarity;
-
- private CacheEntry(@NotNull final Enchantment enchantment,
- @NotNull final String name,
- @NotNull final Map> description,
- @NotNull final EnchantmentType type,
- @NotNull final EnchantmentRarity rarity,
- @NotNull final String color) {
- this.enchantment = enchantment;
- this.name = name;
- this.description = description;
- this.type = type;
- this.rarity = rarity;
- this.color = color;
- this.stringDescription = new HashMap<>();
- this.requirementLore = new ArrayList<>();
- if (enchantment instanceof EcoEnchant ecoEnchant) {
- for (String s : ecoEnchant.getRequirementLore()) {
- requirementLore.add(Display.PREFIX + s);
- }
- }
-
- for (Integer level : description.keySet()) {
- StringBuilder descriptionBuilder = new StringBuilder();
-
- for (String s : description.get(level)) {
- descriptionBuilder.append(s);
- descriptionBuilder.append(" ");
- }
-
- String processedStringDescription = descriptionBuilder.toString();
- processedStringDescription = processedStringDescription.replace(Display.PREFIX, "");
- stringDescription.put(level, processedStringDescription.replaceAll(PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor(), ""));
- }
- }
-
- /**
- * Get the name with the level.
- *
- * @param level The level.
- * @return The name with the level.
- */
- public String getNameWithLevel(final int level) {
- return getNameWithLevel(level, null);
- }
-
- /**
- * Get enchantment with level.
- *
- * @param level The level.
- * @param player The player.
- * @return The name with the level.
- */
- public String getNameWithLevel(final int level,
- @Nullable final Player player) {
- StringBuilder builder = new StringBuilder();
- builder.append(name);
-
- if (enchantment instanceof EcoEnchant enchant && player != null) {
- if (!enchant.areRequirementsMet(player)) {
- builder.insert(0, PLUGIN.getDisplayModule().getOptions().getRequirementsOptions().getRequirementColor());
- }
- }
-
- if (!(enchantment.getMaxLevel() == 1 && level == 1) && level != 0) {
- StringBuilder numberString = new StringBuilder();
- numberString.append(" ");
-
- NumbersOptions numbersOptions = PLUGIN.getDisplayModule().getOptions().getNumbersOptions();
-
- if (numbersOptions.isUseNumerals() && level < numbersOptions.getThreshold()) {
- numberString.append(NumberUtils.toNumeral(level));
- } else {
- numberString.append(level);
- }
-
- if (level > enchantment.getMaxLevel() && PLUGIN.getDisplayModule().getOptions().getMaxLevelOptions().isReformatAboveMaxLevel()) {
- if (PLUGIN.getDisplayModule().getOptions().getMaxLevelOptions().isNumbersOnly()) {
- String aboveMaxLevel = PLUGIN.getDisplayModule().getOptions().getMaxLevelOptions().getAboveMaxLevelFormat();
-
- builder.append(aboveMaxLevel)
- .append(numberString);
- } else {
- String aboveMaxLevel = PLUGIN.getDisplayModule().getOptions().getMaxLevelOptions().getAboveMaxLevelFormat();
- builder.append(aboveMaxLevel)
- .append(numberString);
- }
- } else {
- builder.append(numberString);
- }
- }
-
- builder.insert(0, color);
- return StringUtils.format(builder.toString(), StringUtils.FormatOption.WITHOUT_PLACEHOLDERS);
- }
-
- /**
- * Get the description of an enchantment at a certain level.
- *
- * @param level The level.
- * @return The description, wrapped and formatted.
- */
- public List getDescription(final int level) {
- List description = this.description.get(level);
- if (description == null) {
- if (enchantment instanceof EcoEnchant enchant) {
- List levelDesc = new ArrayList<>();
- List defDesc = enchant.getWrappedDescription();
- defDesc.replaceAll(line -> line.replace("&r", "&r" + PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor()));
- defDesc.replaceAll(line -> Display.PREFIX + PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor() + line);
- for (String s : defDesc) {
- levelDesc.add(s.replace("%value%", enchant.getPlaceholder(level)));
- }
-
- this.description.put(
- level,
- StringUtils.formatList(levelDesc)
- );
- } else {
- List baseDesc = this.description.get(1);
- this.description.put(level, baseDesc);
- return baseDesc;
- }
-
- return getDescription(level);
- } else {
- return description;
- }
- }
-
- /**
- * Get the description of an enchantment at a certain level.
- *
- * @param level The level.
- * @return The description, unwrapped and unformatted.
- */
- public String getStringDescription(final int level) {
- String stringDesc = this.stringDescription.get(level);
- if (stringDesc == null) {
- StringBuilder descriptionBuilder = new StringBuilder();
-
- for (String s : description.get(level)) {
- descriptionBuilder.append(s);
- descriptionBuilder.append(" ");
- }
-
- String processedStringDescription = descriptionBuilder.toString();
- processedStringDescription = processedStringDescription.replace(Display.PREFIX, "");
- stringDescription.put(level, processedStringDescription.replaceAll(PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor(), ""));
- return getStringDescription(level);
- } else {
- return stringDesc;
- }
- }
-
- /**
- * Get the description of an enchantment at level 1.
- *
- * @return The description, wrapped and formatted.
- */
- @Deprecated
- public List getDescription() {
- return getDescription(1);
- }
-
- /**
- * Get the description of an enchantment at level 1.
- *
- * @return The description, unwrapped and unformatted.
- */
- @Deprecated
- public String getStringDescription() {
- return getStringDescription(1);
- }
-
- /**
- * Get the unformatted name of the enchantment.
- *
- * @return The raw name.
- */
- public String getRawName() {
- return name;
- }
-
- /**
- * Get the formatted name of the enchantment.
- *
- * @return The name.
- */
- public String getName() {
- return getNameWithLevel(0);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.java
deleted file mode 100644
index b6a4fc46..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.willfp.ecoenchants.display.options;
-
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.PluginDependent;
-import com.willfp.eco.core.data.PlayerProfile;
-import com.willfp.ecoenchants.command.CommandToggleDescriptions;
-import lombok.Getter;
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public class DescriptionOptions extends PluginDependent {
- /**
- * The threshold below which to describe enchantments.
- */
- @Getter
- private int threshold;
-
- /**
- * If the options are enabled.
- */
- @Getter
- private boolean enabled;
-
- /**
- * The description lines color.
- */
- @Getter
- private String color;
-
- /**
- * If enchantment descriptions should be at the bottom of the enchantment lore rather than under each enchantment.
- */
- @Getter
- private boolean showingAtBottom;
-
- /**
- * If descriptions should only be shown on books.
- */
- @Getter
- private boolean onlyOnBooks;
-
- /**
- * Create new description options.
- *
- * @param plugin EcoEnchants.
- */
- public DescriptionOptions(@NotNull final EcoPlugin plugin) {
- super(plugin);
- }
-
- /**
- * Update the options.
- */
- public void update() {
- threshold = this.getPlugin().getConfigYml().getInt("lore.describe.before-lines");
- enabled = this.getPlugin().getConfigYml().getBool("lore.describe.enabled");
- color = this.getPlugin().getLangYml().getFormattedString("description-color");
- showingAtBottom = this.getPlugin().getConfigYml().getBool("lore.describe.at-bottom");
- onlyOnBooks = this.getPlugin().getConfigYml().getBool("lore.describe.only-on-books");
- }
-
- /**
- * Get if descriptions are enabled for a player.
- *
- * @param player The player.
- * @return If enabled.
- */
- public boolean enabledForPlayer(@Nullable final Player player) {
- if (player == null) {
- return true;
- }
-
- return PlayerProfile.load(player).read(CommandToggleDescriptions.DESCRIPTIONS_KEY);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DisplayOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DisplayOptions.java
deleted file mode 100644
index e7f0c2f3..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DisplayOptions.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package com.willfp.ecoenchants.display.options;
-
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.PluginDependent;
-import com.willfp.eco.core.display.Display;
-import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter;
-import com.willfp.ecoenchants.display.options.sorting.SortParameters;
-import com.willfp.ecoenchants.display.options.sorting.SorterManager;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import lombok.Getter;
-import org.jetbrains.annotations.ApiStatus;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-public class DisplayOptions extends PluginDependent {
- /**
- * The description options being used.
- */
- @Getter
- private final DescriptionOptions descriptionOptions = new DescriptionOptions(this.getPlugin());
- /**
- * The enchantment level options being used.
- */
- @Getter
- private final NumbersOptions numbersOptions = new NumbersOptions(this.getPlugin());
- /**
- * The shrink options being used.
- */
- @Getter
- private final ShrinkOptions shrinkOptions = new ShrinkOptions(this.getPlugin());
- /**
- * The max level options being used.
- */
- @Getter
- private final MaxLevelOptions maxLevelOptions = new MaxLevelOptions(this.getPlugin());
- /**
- * The requirements options being used.
- */
- @Getter
- private final RequirementsOptions requirementsOptions = new RequirementsOptions(this.getPlugin());
- /**
- * The enchantment types, sorted according to config.
- */
- @Getter
- private final List sortedTypes = new ArrayList<>();
- /**
- * The enchantment rarities, sorted according to config.
- */
- @Getter
- private final List sortedRarities = new ArrayList<>();
- /**
- * The enchantment sorter being used.
- */
- @Getter
- private EnchantmentSorter sorter;
-
- /**
- * If item must be a target.
- */
- @Getter
- private boolean requireTarget = true;
-
- /**
- * If enchants should be displayed above lore.
- */
- @Getter
- private boolean aboveLore = true;
-
- /**
- * Lore prefix (above enchantments).
- */
- @Getter
- private List lorePrefix;
-
- /**
- * Lore suffix (below enchantments).
- */
- @Getter
- private List loreSuffix;
-
- /**
- * If prefix/suffix should show on books.
- */
- @Getter
- private boolean prefixOnBooks;
-
- /**
- * Instantiate new display options.
- *
- * @param plugin EcoEnchants.
- */
- @ApiStatus.Internal
- public DisplayOptions(@NotNull final EcoPlugin plugin) {
- super(plugin);
- update();
- }
-
- /**
- * Update all options.
- */
- public void update() {
- descriptionOptions.update();
- numbersOptions.update();
- shrinkOptions.update();
- maxLevelOptions.update();
- requirementsOptions.update();
-
- sortedTypes.clear();
- sortedTypes.addAll(this.getPlugin().getConfigYml().getStrings("lore.type-ordering").stream()
- .map(typeName -> EnchantmentType.values().stream().filter(type -> type.getName().equalsIgnoreCase(typeName)).findFirst().orElse(null))
- .filter(Objects::nonNull).toList());
- sortedTypes.addAll(EnchantmentType.values().stream().filter(enchantmentType -> !sortedTypes.contains(enchantmentType)).toList());
-
- sortedRarities.clear();
- sortedRarities.addAll(this.getPlugin().getConfigYml().getStrings("lore.rarity-ordering").stream()
- .map(rarityName -> EnchantmentRarity.values().stream().filter(rarity -> rarity.getName().equalsIgnoreCase(rarityName)).findFirst().orElse(null))
- .filter(Objects::nonNull).toList());
- sortedRarities.addAll(EnchantmentRarity.values().stream().filter(enchantmentRarity -> !sortedRarities.contains(enchantmentRarity)).toList());
-
- requireTarget = this.getPlugin().getConfigYml().getBool("lore.require-target");
- aboveLore = this.getPlugin().getConfigYml().getBool("lore.above-other-lore");
-
- lorePrefix = this.getPlugin().getConfigYml().getFormattedStrings("lore.prefix").stream().map(s -> Display.PREFIX + s).collect(Collectors.toList());
- loreSuffix = this.getPlugin().getConfigYml().getFormattedStrings("lore.suffix").stream().map(s -> Display.PREFIX + s).collect(Collectors.toList());
- prefixOnBooks = this.getPlugin().getConfigYml().getBool("lore.prefix-on-books");
-
- boolean byType = this.getPlugin().getConfigYml().getBool("lore.sort-by-type");
- boolean byLength = this.getPlugin().getConfigYml().getBool("lore.sort-by-length");
- boolean byRarity = this.getPlugin().getConfigYml().getBool("lore.sort-by-rarity");
- Set params = new HashSet<>();
- if (byType) {
- params.add(SortParameters.TYPE);
- }
- if (byLength) {
- params.add(SortParameters.LENGTH);
- }
- if (byRarity) {
- params.add(SortParameters.RARITY);
- }
-
- sorter = SorterManager.getSorter(params.toArray(new SortParameters[]{}));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/MaxLevelOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/MaxLevelOptions.java
deleted file mode 100644
index 4652f17f..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/MaxLevelOptions.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.willfp.ecoenchants.display.options;
-
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.PluginDependent;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-
-public class MaxLevelOptions extends PluginDependent {
-
- /**
- * If enchantments should have a different format above max level.
- */
- @Getter
- private boolean reformatAboveMaxLevel;
-
- /**
- * The above max level format.
- */
- @Getter
- private String aboveMaxLevelFormat;
-
- /**
- * If only the numbers should be formatted.
- */
- @Getter
- private boolean numbersOnly;
-
- /**
- * Create new description options.
- *
- * @param plugin EcoEnchants.
- */
- public MaxLevelOptions(@NotNull final EcoPlugin plugin) {
- super(plugin);
- }
-
- /**
- * Update the options.
- */
- public void update() {
- reformatAboveMaxLevel = this.getPlugin().getConfigYml().getBool("lore.above-max-level.reformat");
- numbersOnly = this.getPlugin().getConfigYml().getBool("lore.above-max-level.numbers-only");
- aboveMaxLevelFormat = this.getPlugin().getLangYml().getString("above-max-level-color");
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/NumbersOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/NumbersOptions.java
deleted file mode 100644
index cef528ba..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/NumbersOptions.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.willfp.ecoenchants.display.options;
-
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.PluginDependent;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-
-public class NumbersOptions extends PluginDependent {
- /**
- * If numerals should be used.
- *
- * If false then numbers will be used instead.
- */
- @Getter
- private boolean useNumerals;
-
- /**
- * The threshold above which numbers will be used instead.
- */
- @Getter
- private int threshold;
-
- /**
- * Create new numbers options.
- *
- * @param plugin EcoEnchants.
- */
- public NumbersOptions(@NotNull final EcoPlugin plugin) {
- super(plugin);
- }
-
- /**
- * Update the options.
- */
- public void update() {
- useNumerals = this.getPlugin().getConfigYml().getBool("lore.use-numerals");
- threshold = this.getPlugin().getConfigYml().getInt("lore.use-numbers-above-threshold");
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/RequirementsOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/RequirementsOptions.java
deleted file mode 100644
index 585530bd..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/RequirementsOptions.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.willfp.ecoenchants.display.options;
-
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.PluginDependent;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-
-public class RequirementsOptions extends PluginDependent {
- /**
- * If numerals should be used.
- *
- * If false then numbers will be used instead.
- */
- @Getter
- private String requirementColor;
-
- /**
- * Create new numbers options.
- *
- * @param plugin EcoEnchants.
- */
- public RequirementsOptions(@NotNull final EcoPlugin plugin) {
- super(plugin);
- }
-
- /**
- * Update the options.
- */
- public void update() {
- requirementColor = this.getPlugin().getLangYml().getString("missing-requirements-format");
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/ShrinkOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/ShrinkOptions.java
deleted file mode 100644
index c6139d10..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/ShrinkOptions.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.willfp.ecoenchants.display.options;
-
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.PluginDependent;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-
-public class ShrinkOptions extends PluginDependent {
- /**
- * The threshold above which enchantments will be shrunk.
- */
- @Getter
- private int threshold;
-
- /**
- * If shrinking is enabled.
- */
- @Getter
- private boolean enabled;
-
- /**
- * The amount of enchantments to have per-line.
- */
- @Getter
- private int shrinkPerLine;
-
- /**
- * Create new shrink options.
- *
- * @param plugin EcoEnchants.
- */
- public ShrinkOptions(@NotNull final EcoPlugin plugin) {
- super(plugin);
- }
-
- /**
- * Update the options.
- */
- public void update() {
- threshold = this.getPlugin().getConfigYml().getInt("lore.shrink.after-lines");
- enabled = this.getPlugin().getConfigYml().getBool("lore.shrink.enabled");
- shrinkPerLine = this.getPlugin().getConfigYml().getInt("lore.shrink.maximum-per-line");
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/EnchantmentSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/EnchantmentSorter.java
deleted file mode 100644
index 7a0a3a01..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/EnchantmentSorter.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.willfp.ecoenchants.display.options.sorting;
-
-import org.bukkit.enchantments.Enchantment;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-public interface EnchantmentSorter {
- /**
- * Sort list of enchantments.
- *
- * All implementations must treat enchantments as final or effectively final.
- *
- * @param toSort The enchantments to sort.
- */
- void sortEnchantments(@NotNull List toSort);
-
- /**
- * Get the parameters that the sorter fulfills.
- *
- * @return Array of all parameters.
- */
- SortParameters[] getParameters();
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SortParameters.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SortParameters.java
deleted file mode 100644
index cd357891..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SortParameters.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.display.options.sorting;
-
-public enum SortParameters {
- /**
- * If the sorter should sort by type or if type should be ignored.
- */
- TYPE,
-
- /**
- * If the sorter should sort by rarity or if rarity should be ignored.
- */
- RARITY,
-
- /**
- * If the sorter should sort by length or alphabetically.
- */
- LENGTH
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SorterManager.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SorterManager.java
deleted file mode 100644
index 6b2478a3..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SorterManager.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.willfp.ecoenchants.display.options.sorting;
-
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.display.options.sorting.implementations.AlphabeticSorter;
-import com.willfp.ecoenchants.display.options.sorting.implementations.LengthSorter;
-import com.willfp.ecoenchants.display.options.sorting.implementations.RarityAlphabeticSorter;
-import com.willfp.ecoenchants.display.options.sorting.implementations.RarityLengthSorter;
-import com.willfp.ecoenchants.display.options.sorting.implementations.RarityTypeAlphabeticSorter;
-import com.willfp.ecoenchants.display.options.sorting.implementations.RarityTypeLengthSorter;
-import com.willfp.ecoenchants.display.options.sorting.implementations.TypeAlphabeticSorter;
-import com.willfp.ecoenchants.display.options.sorting.implementations.TypeLengthSorter;
-import lombok.experimental.UtilityClass;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-@UtilityClass
-public class SorterManager {
- /**
- * All registered enchantment sorters.
- */
- private static final Set REGISTERED = new HashSet<>();
-
- static {
- EcoEnchantsPlugin instance = EcoEnchantsPlugin.getInstance(); // Really dirty and janky.
- REGISTERED.add(new AlphabeticSorter(instance));
- REGISTERED.add(new LengthSorter(instance));
- REGISTERED.add(new TypeAlphabeticSorter(instance));
- REGISTERED.add(new TypeLengthSorter(instance));
- REGISTERED.add(new RarityAlphabeticSorter(instance));
- REGISTERED.add(new RarityLengthSorter(instance));
- REGISTERED.add(new RarityTypeAlphabeticSorter(instance));
- REGISTERED.add(new RarityTypeLengthSorter(instance));
- }
-
- /**
- * Get a sorter based off of parameters.
- *
- * Any combination of parameters is valid.
- *
- * @param parameters The parameters to find a sorter from.
- * @return The matching sorter.
- */
- public static EnchantmentSorter getSorter(@NotNull final SortParameters... parameters) {
- return REGISTERED.stream()
- .filter(enchantmentSorter -> Arrays.asList(enchantmentSorter.getParameters()).containsAll(Arrays.asList(parameters)) && enchantmentSorter.getParameters().length == parameters.length)
- .findFirst()
- .orElse(new AlphabeticSorter(EcoEnchantsPlugin.getInstance()));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/AlphabeticSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/AlphabeticSorter.java
deleted file mode 100644
index 17d053c4..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/AlphabeticSorter.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.willfp.ecoenchants.display.options.sorting.implementations;
-
-import com.willfp.eco.core.PluginDependent;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.display.EnchantmentCache;
-import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter;
-import com.willfp.ecoenchants.display.options.sorting.SortParameters;
-import org.bukkit.enchantments.Enchantment;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-public class AlphabeticSorter extends PluginDependent implements EnchantmentSorter {
- /**
- * Instantiate sorter.
- *
- * @param plugin Instance of EcoEnchants.
- */
- public AlphabeticSorter(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin);
- }
-
- @Override
- public void sortEnchantments(@NotNull final List toSort) {
- toSort.sort(((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName())));
- }
-
- @Override
- public SortParameters[] getParameters() {
- return new SortParameters[0];
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/LengthSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/LengthSorter.java
deleted file mode 100644
index 635c97d8..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/LengthSorter.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.willfp.ecoenchants.display.options.sorting.implementations;
-
-import com.willfp.eco.core.PluginDependent;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.display.EnchantmentCache;
-import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter;
-import com.willfp.ecoenchants.display.options.sorting.SortParameters;
-import org.bukkit.enchantments.Enchantment;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Comparator;
-import java.util.List;
-
-public class LengthSorter extends PluginDependent implements EnchantmentSorter {
- /**
- * Instantiate sorter.
- *
- * @param plugin Instance of EcoEnchants.
- */
- public LengthSorter(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin);
- }
-
- @Override
- public void sortEnchantments(@NotNull final List toSort) {
- toSort.sort(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()));
- }
-
- @Override
- public SortParameters[] getParameters() {
- return new SortParameters[]{SortParameters.LENGTH};
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityAlphabeticSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityAlphabeticSorter.java
deleted file mode 100644
index f91b8396..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityAlphabeticSorter.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.willfp.ecoenchants.display.options.sorting.implementations;
-
-import com.willfp.eco.core.PluginDependent;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.display.EnchantmentCache;
-import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter;
-import com.willfp.ecoenchants.display.options.sorting.SortParameters;
-import org.bukkit.enchantments.Enchantment;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class RarityAlphabeticSorter extends PluginDependent implements EnchantmentSorter {
- /**
- * Instantiate sorter.
- *
- * @param plugin Instance of EcoEnchants.
- */
- public RarityAlphabeticSorter(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin);
- }
-
- @Override
- public void sortEnchantments(@NotNull final List toSort) {
- if (this.getPlugin().getDisplayModule().getOptions().getSortedRarities().isEmpty()
- || this.getPlugin().getDisplayModule().getOptions().getSortedTypes().isEmpty()) {
- this.getPlugin().getDisplayModule().update();
- }
-
- List sorted = new ArrayList<>();
-
- this.getPlugin().getDisplayModule().getOptions().getSortedRarities().forEach(enchantmentRarity -> {
- List rarityEnchants = new ArrayList<>();
- for (Enchantment enchantment : toSort) {
- if (EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity)) {
- rarityEnchants.add(enchantment);
- }
- }
- rarityEnchants.sort((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()));
- sorted.addAll(rarityEnchants);
- });
-
- toSort.clear();
- toSort.addAll(sorted);
- }
-
- @Override
- public SortParameters[] getParameters() {
- return new SortParameters[]{SortParameters.RARITY};
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityLengthSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityLengthSorter.java
deleted file mode 100644
index bb7d4311..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityLengthSorter.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.willfp.ecoenchants.display.options.sorting.implementations;
-
-import com.willfp.eco.core.PluginDependent;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.display.EnchantmentCache;
-import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter;
-import com.willfp.ecoenchants.display.options.sorting.SortParameters;
-import org.bukkit.enchantments.Enchantment;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-
-public class RarityLengthSorter extends PluginDependent implements EnchantmentSorter {
- /**
- * Instantiate sorter.
- *
- * @param plugin Instance of EcoEnchants.
- */
- public RarityLengthSorter(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin);
- }
-
- @Override
- public void sortEnchantments(@NotNull final List toSort) {
- if (this.getPlugin().getDisplayModule().getOptions().getSortedRarities().isEmpty()
- || this.getPlugin().getDisplayModule().getOptions().getSortedTypes().isEmpty()) {
- this.getPlugin().getDisplayModule().update();
- }
-
- List sorted = new ArrayList<>();
- this.getPlugin().getDisplayModule().getOptions().getSortedRarities().forEach(enchantmentRarity -> {
- List rarityEnchants = new ArrayList<>();
- for (Enchantment enchantment : toSort) {
- if (EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity)) {
- rarityEnchants.add(enchantment);
- }
- }
- rarityEnchants.sort(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()));
- sorted.addAll(rarityEnchants);
- });
-
- toSort.clear();
- toSort.addAll(sorted);
- }
-
- @Override
- public SortParameters[] getParameters() {
- return new SortParameters[]{SortParameters.RARITY, SortParameters.LENGTH};
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityTypeAlphabeticSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityTypeAlphabeticSorter.java
deleted file mode 100644
index 249f229c..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityTypeAlphabeticSorter.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.willfp.ecoenchants.display.options.sorting.implementations;
-
-import com.willfp.eco.core.PluginDependent;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.display.EnchantmentCache;
-import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter;
-import com.willfp.ecoenchants.display.options.sorting.SortParameters;
-import org.bukkit.enchantments.Enchantment;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class RarityTypeAlphabeticSorter extends PluginDependent implements EnchantmentSorter {
- /**
- * Instantiate sorter.
- *
- * @param plugin Instance of EcoEnchants.
- */
- public RarityTypeAlphabeticSorter(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin);
- }
-
- @Override
- public void sortEnchantments(@NotNull final List toSort) {
- if (this.getPlugin().getDisplayModule().getOptions().getSortedRarities().isEmpty()
- || this.getPlugin().getDisplayModule().getOptions().getSortedTypes().isEmpty()) {
- this.getPlugin().getDisplayModule().update();
- }
-
- List sorted = new ArrayList<>();
- this.getPlugin().getDisplayModule().getOptions().getSortedTypes().forEach(enchantmentType -> {
- List typeEnchants = new ArrayList<>();
- for (Enchantment enchantment : toSort) {
- if (EnchantmentCache.getEntry(enchantment).getType().equals(enchantmentType)) {
- typeEnchants.add(enchantment);
- }
- }
- typeEnchants.sort((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()));
-
- this.getPlugin().getDisplayModule().getOptions().getSortedRarities().forEach(enchantmentRarity -> {
- List rarityEnchants = new ArrayList<>();
- for (Enchantment enchantment : typeEnchants) {
- if (EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity)) {
- rarityEnchants.add(enchantment);
- }
- }
- rarityEnchants.sort((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()));
- sorted.addAll(rarityEnchants);
- });
- });
-
- toSort.clear();
- toSort.addAll(sorted);
- }
-
- @Override
- public SortParameters[] getParameters() {
- return new SortParameters[]{SortParameters.RARITY, SortParameters.TYPE};
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityTypeLengthSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityTypeLengthSorter.java
deleted file mode 100644
index bfa0089b..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityTypeLengthSorter.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.willfp.ecoenchants.display.options.sorting.implementations;
-
-import com.willfp.eco.core.PluginDependent;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.display.EnchantmentCache;
-import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter;
-import com.willfp.ecoenchants.display.options.sorting.SortParameters;
-import org.bukkit.enchantments.Enchantment;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-
-public class RarityTypeLengthSorter extends PluginDependent implements EnchantmentSorter {
- /**
- * Instantiate sorter.
- *
- * @param plugin Instance of EcoEnchants.
- */
- public RarityTypeLengthSorter(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin);
- }
-
- @Override
- public void sortEnchantments(@NotNull final List toSort) {
- if (this.getPlugin().getDisplayModule().getOptions().getSortedRarities().isEmpty()
- || this.getPlugin().getDisplayModule().getOptions().getSortedTypes().isEmpty()) {
- this.getPlugin().getDisplayModule().update();
- }
-
- List sorted = new ArrayList<>();
- this.getPlugin().getDisplayModule().getOptions().getSortedTypes().forEach(enchantmentType -> {
- List typeEnchants = new ArrayList<>();
- for (Enchantment enchantment : toSort) {
- if (EnchantmentCache.getEntry(enchantment).getType().equals(enchantmentType)) {
- typeEnchants.add(enchantment);
- }
- }
-
- typeEnchants.sort(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()));
-
- this.getPlugin().getDisplayModule().getOptions().getSortedRarities().forEach(enchantmentRarity -> {
- List rarityEnchants = new ArrayList<>();
- for (Enchantment enchantment : typeEnchants) {
- if (EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity)) {
- rarityEnchants.add(enchantment);
- }
- }
- rarityEnchants.sort(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()));
- sorted.addAll(rarityEnchants);
- });
- });
-
- toSort.clear();
- toSort.addAll(sorted);
- }
-
- @Override
- public SortParameters[] getParameters() {
- return new SortParameters[]{SortParameters.RARITY, SortParameters.TYPE, SortParameters.LENGTH};
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/TypeAlphabeticSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/TypeAlphabeticSorter.java
deleted file mode 100644
index c8cfe183..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/TypeAlphabeticSorter.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.willfp.ecoenchants.display.options.sorting.implementations;
-
-import com.willfp.eco.core.PluginDependent;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.display.EnchantmentCache;
-import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter;
-import com.willfp.ecoenchants.display.options.sorting.SortParameters;
-import org.bukkit.enchantments.Enchantment;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class TypeAlphabeticSorter extends PluginDependent implements EnchantmentSorter {
- /**
- * Instantiate sorter.
- *
- * @param plugin Instance of EcoEnchants.
- */
- public TypeAlphabeticSorter(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin);
- }
-
- @Override
- public void sortEnchantments(@NotNull final List toSort) {
- if (this.getPlugin().getDisplayModule().getOptions().getSortedRarities().isEmpty()
- || this.getPlugin().getDisplayModule().getOptions().getSortedTypes().isEmpty()) {
- this.getPlugin().getDisplayModule().update();
- }
-
- List sorted = new ArrayList<>();
- this.getPlugin().getDisplayModule().getOptions().getSortedTypes().forEach(enchantmentType -> {
- List typeEnchants = new ArrayList<>();
- for (Enchantment enchantment : toSort) {
- if (EnchantmentCache.getEntry(enchantment).getType().equals(enchantmentType)) {
- typeEnchants.add(enchantment);
- }
- }
-
- typeEnchants.sort((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()));
- sorted.addAll(typeEnchants);
- });
-
- toSort.clear();
- toSort.addAll(sorted);
- }
-
- @Override
- public SortParameters[] getParameters() {
- return new SortParameters[]{SortParameters.TYPE};
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/TypeLengthSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/TypeLengthSorter.java
deleted file mode 100644
index 608049ea..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/TypeLengthSorter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.willfp.ecoenchants.display.options.sorting.implementations;
-
-import com.willfp.eco.core.PluginDependent;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.display.EnchantmentCache;
-import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter;
-import com.willfp.ecoenchants.display.options.sorting.SortParameters;
-import org.bukkit.enchantments.Enchantment;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class TypeLengthSorter extends PluginDependent implements EnchantmentSorter {
- /**
- * Instantiate sorter.
- *
- * @param plugin Instance of EcoEnchants.
- */
- public TypeLengthSorter(@NotNull final EcoEnchantsPlugin plugin) {
- super(plugin);
- }
-
- @Override
- public void sortEnchantments(@NotNull final List toSort) {
- if (this.getPlugin().getDisplayModule().getOptions().getSortedRarities().isEmpty()
- || this.getPlugin().getDisplayModule().getOptions().getSortedTypes().isEmpty()) {
- this.getPlugin().getDisplayModule().update();
- }
-
- List sorted = new ArrayList<>();
- this.getPlugin().getDisplayModule().getOptions().getSortedTypes().forEach(enchantmentType -> {
- List typeEnchants = new ArrayList<>();
- for (Enchantment enchantment : toSort) {
- if (EnchantmentCache.getEntry(enchantment).getType().equals(enchantmentType)) {
- typeEnchants.add(enchantment);
- }
- }
-
- sorted.addAll(typeEnchants);
- });
-
- toSort.clear();
- toSort.addAll(sorted);
- }
-
- @Override
- public SortParameters[] getParameters() {
- return new SortParameters[]{SortParameters.TYPE, SortParameters.LENGTH};
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java
deleted file mode 100644
index b239ca28..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java
+++ /dev/null
@@ -1,597 +0,0 @@
-package com.willfp.ecoenchants.enchantments;
-
-import com.willfp.eco.core.Prerequisite;
-import com.willfp.eco.core.config.interfaces.Config;
-import com.willfp.eco.core.fast.FastItemStack;
-import com.willfp.eco.util.StringUtils;
-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;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import com.willfp.ecoenchants.enchantments.util.Watcher;
-import com.willfp.ecoenchants.enchantments.util.requirements.Requirement;
-import com.willfp.ecoenchants.enchantments.util.requirements.Requirements;
-import lombok.Getter;
-import net.kyori.adventure.text.Component;
-import org.apache.commons.lang.Validate;
-import org.apache.commons.lang.WordUtils;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.NamespacedKey;
-import org.bukkit.World;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.EntityCategory;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.Listener;
-import org.bukkit.inventory.EquipmentSlot;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.permissions.Permission;
-import org.bukkit.permissions.PermissionDefault;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.UUID;
-
-@SuppressWarnings({"deprecation", "RedundantSuppression"})
-public abstract class EcoEnchant extends Enchantment implements Listener, Watcher {
- /**
- * Instance of EcoEnchants for enchantments to be able to access.
- */
- @Getter
- private final EcoEnchantsPlugin plugin = EcoEnchantsPlugin.getInstance();
-
- /**
- * The permission/config name of the enchantment.
- */
- @Getter
- private final String permissionName;
-
- /**
- * The type of the enchantment.
- */
- @Getter
- private final EnchantmentType type;
-
- /**
- * The enchantment's config.
- */
- @Getter
- private final EnchantmentConfig config;
-
- /**
- * The targets of the enchantment.
- */
- @Getter
- private final Set targets = new HashSet<>();
-
- /**
- * The materials of the targets.
- */
- @Getter
- private final Set targetMaterials = new HashSet<>();
-
- /**
- * The names of the worlds that this enchantment is disabled in.
- */
- @Getter
- private final Set disabledWorldNames = new HashSet<>();
-
- /**
- * The worlds that this enchantment is disabled in.
- */
- @Getter
- private final List disabledWorlds = new ArrayList<>();
-
- /**
- * The display name of the enchantment.
- */
- @Getter
- private String displayName;
-
- /**
- * The description of the enchantment.
- */
- @Getter
- private String description;
-
- /**
- * If the enchantment can be removed in a grindstone.
- */
- @Getter
- private boolean grindstoneable;
-
- /**
- * If the enchantment can be obtained from an enchanting table.
- */
- @Getter
- private boolean availableFromTable;
-
- /**
- * If the enchantment can be obtained from a villager.
- */
- @Getter
- private boolean availableFromVillager;
-
- /**
- * If the enchantment can be obtained from a loot chest.
- */
- @Getter
- private boolean availableFromLoot;
-
- /**
- * The maximum level for the enchantment to be obtained naturally.
- */
- private int maxLevel;
-
- /**
- * The enchantments that conflict with this enchantment.
- */
- @Getter
- private Set conflicts;
-
- /**
- * The rarity of the enchantment.
- */
- @Getter
- private EnchantmentRarity enchantmentRarity;
-
- /**
- * If the enchantment is enabled.
- */
- private boolean enabled;
-
- /**
- * Custom option flags for the enchantment.
- */
- private final List flags = new ArrayList<>();
-
- /**
- * All the requirements needed in order to use the enchantment.
- */
- private final Map> requirements = new HashMap<>();
-
- /**
- * Cached players to see if they meet requirements.
- */
- private final Map cachedRequirements = new HashMap<>();
-
- /**
- * The requirement lore shown if the player doesn't meet the requirements.
- */
- @Getter
- private final List requirementLore = new ArrayList<>();
-
- protected EcoEnchant(@NotNull final String key,
- @NotNull final EnchantmentType type,
- @Nullable final Config overrideConfig,
- @NotNull final Prerequisite... prerequisites) {
- super(NamespacedKey.minecraft(key));
-
- this.type = type;
- this.permissionName = key.replace("_", "");
- this.config = new EnchantmentConfig(
- Objects.requireNonNullElseGet(overrideConfig, () -> new BaseEnchantmentConfig(
- this.permissionName,
- this.getClass(),
- this,
- this.getPlugin()
- )),
- this.permissionName,
- this,
- this.getPlugin()
- );
-
- if (Bukkit.getPluginManager().getPermission("ecoenchants.fromtable." + permissionName) == null) {
- Permission permission = new Permission(
- "ecoenchants.fromtable." + permissionName,
- "Allows getting " + permissionName + " from an Enchanting Table",
- PermissionDefault.TRUE
- );
- permission.addParent(Objects.requireNonNull(Bukkit.getPluginManager().getPermission("ecoenchants.fromtable.*")), true);
- Bukkit.getPluginManager().addPermission(permission);
- }
-
- if (type.getRequiredToExtend() != null && !type.getRequiredToExtend().isInstance(this) && !(this instanceof CustomEcoEnchant)) {
- return;
- }
-
- if (!Prerequisite.areMet(prerequisites)) {
- return;
- }
-
- enabled = Objects.requireNonNullElse(config.getBoolOrNull("enabled"), true);
-
- if (!this.isEnabled() && this.getPlugin().getConfigYml().getBool("advanced.hard-disable.enabled")) {
- return;
- }
-
- this.update();
-
- EcoEnchants.addNewEcoEnchant(this);
- }
-
- /**
- * Create a new EcoEnchant.
- *
- * @param key The key name of the enchantment
- * @param type The type of the enchantment
- * @param prerequisites Optional {@link Prerequisite}s that must be met
- */
- protected EcoEnchant(@NotNull final String key,
- @NotNull final EnchantmentType type,
- @NotNull final Prerequisite... prerequisites) {
- this(key, type, null, prerequisites);
- }
-
- /**
- * Update the enchantment based off config values.
- * This can be overridden but may lead to unexpected behavior.
- */
- public void update() {
- config.loadFromLang();
- enchantmentRarity = config.getRarity();
- Validate.notNull(enchantmentRarity, "Rarity specified in " + this.permissionName + " is invalid!");
- conflicts = config.getEnchantments(EcoEnchants.GENERAL_LOCATION + "conflicts");
- grindstoneable = config.getBool(EcoEnchants.GENERAL_LOCATION + "grindstoneable");
- availableFromTable = config.getBool(EcoEnchants.OBTAINING_LOCATION + "table");
- availableFromVillager = config.getBool(EcoEnchants.OBTAINING_LOCATION + "villager");
- availableFromLoot = config.getBool(EcoEnchants.OBTAINING_LOCATION + "loot");
- maxLevel = config.getInt(EcoEnchants.GENERAL_LOCATION + "maximum-level", 1);
- displayName = config.getFormattedString("name");
- description = config.getString("description");
- disabledWorldNames.clear();
- disabledWorldNames.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "disabled-in-worlds"));
- disabledWorlds.clear();
- List worldNames = new ArrayList<>();
- for (World world : Bukkit.getWorlds()) {
- worldNames.add(world.getName().toLowerCase());
- }
- List disabledExistingWorldNames = disabledWorldNames.stream().filter(s -> worldNames.contains(s.toLowerCase())).toList();
- disabledWorlds.addAll(Bukkit.getWorlds().stream().filter(world -> disabledExistingWorldNames.contains(world.getName().toLowerCase())).toList());
- targets.clear();
- targetMaterials.clear();
- targets.addAll(config.getTargets());
- targets.forEach(enchantmentTarget -> targetMaterials.addAll(enchantmentTarget.getMaterials()));
- enabled = config.getBool("enabled");
- flags.clear();
- flags.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "flags"));
- EnchantmentUtils.registerPlaceholders(this);
- for (String req : config.getStrings(EcoEnchants.GENERAL_LOCATION + "requirements.list")) {
- List split = Arrays.asList(req.split(":"));
- if (split.size() < 2) {
- continue;
- }
-
- Requirement requirement = Requirements.getByID(split.get(0).toLowerCase());
-
- this.requirements.put(requirement, split.subList(1, split.size()));
- }
- requirementLore.clear();
- requirementLore.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "requirements.not-met-lore"));
-
- postUpdate();
- this.register();
- this.clearCachedRequirements();
- }
-
- protected void postUpdate() {
- // Unused as some enchantments may have postUpdate tasks, however most won't.
- }
-
- /**
- * Register the enchantment with spigot.
- * Only used internally.
- */
- public void register() {
- EnchantmentUtils.register(this);
- }
-
- /**
- * Clear requirements cache.
- */
- public void clearCachedRequirements() {
- this.cachedRequirements.clear();
- }
-
- /**
- * Format the %value% placeholder in description lore.
- *
- * @param level The level of the enchantment.
- * @return The placeholder.
- */
- public String getPlaceholder(final int level) {
- return "unknown";
- }
-
- /**
- * Does the player meet the requirements to use this enchantment.
- *
- * @param entity The entity.
- * @return If the requirements are met.
- */
- public boolean areRequirementsMet(@NotNull final LivingEntity entity) {
- if (!(entity instanceof Player player)) {
- return true;
- }
-
- if (cachedRequirements.containsKey(player.getUniqueId())) {
- return cachedRequirements.get(player.getUniqueId());
- }
-
- for (Map.Entry> entry : requirements.entrySet()) {
- if (!entry.getKey().isMetBy(player, entry.getValue())) {
- cachedRequirements.put(player.getUniqueId(), false);
- return false;
- }
- }
-
- cachedRequirements.put(player.getUniqueId(), true);
- return true;
- }
-
- /**
- * Get description of enchantment line-wrapped.
- *
- * @return The description.
- */
- public List getWrappedDescription() {
- return Arrays.asList(WordUtils.wrap(description, this.getPlugin().getConfigYml().getInt("lore.describe.wrap"), "\n", false).split("\\r?\\n"));
- }
-
- /**
- * If enchantment conflicts with any enchantment in collection.
- *
- * @param enchantments The collection to test against.
- * @return If there are any conflicts.
- */
- public boolean conflictsWithAny(@NotNull final Collection extends Enchantment> enchantments) {
- return conflicts.stream().anyMatch(enchantments::contains);
- }
-
- /**
- * If enchantment has specified flag.
- *
- * @param flag The flag.
- * @return If the enchantment has the flag.
- */
- public boolean hasFlag(@NotNull final String flag) {
- return this.flags.contains(flag);
- }
-
- /**
- * If enchantment is enabled.
- *
- * @return If enabled.
- */
- public boolean isEnabled() {
- return enabled;
- }
-
- /**
- * Get the internal name of the enchantment.
- *
- * @return The name.
- * @deprecated Exists for parity.
- */
- @NotNull
- @Deprecated
- public String getName() {
- return this.getKey().getKey().toUpperCase();
- }
-
- /**
- * Get max level of enchantment.
- *
- * @return The max level.
- */
- @Override
- public int getMaxLevel() {
- return maxLevel;
- }
-
- /**
- * @return 1
- */
- @Override
- public int getStartLevel() {
- return 1;
- }
-
- /**
- * Do not use this method.
- * Only here for compatibility with {@link Enchantment}.
- *
- * @return Returns {@link EnchantmentTarget#ALL}. Do not use.
- * @deprecated {@link EnchantmentTarget} is not supported due to its lack of flexibility. Use {@link EcoEnchant#getTargets()} instead.
- */
- @Override
- @Deprecated
- public @NotNull org.bukkit.enchantments.EnchantmentTarget getItemTarget() {
- return org.bukkit.enchantments.EnchantmentTarget.ALL;
- }
-
- /**
- * Treasure enchantments do not exist in EcoEnchants.
- *
- * @return false.
- * @see EnchantmentType#SPECIAL
- * @deprecated Treasure enchantments do not exist. Use {@link EcoEnchant#getType()} instead.
- */
- @Override
- @Deprecated
- public boolean isTreasure() {
- return this.type.equals(EnchantmentType.SPECIAL);
- }
-
- /**
- * While this method works, it is not recommended to use it.
- *
- * @return Returns if enchantment is cursed.
- * @see EnchantmentType#CURSE
- * @deprecated Use {@link EcoEnchant#getType()} instead.
- */
- @Override
- @Deprecated
- public boolean isCursed() {
- return this.type.equals(EnchantmentType.CURSE);
- }
-
- /**
- * Get if enchantment conflicts with specified enchantment.
- *
- * @param enchantment The enchantment to test against.
- * @return If conflicts.
- */
- @Override
- public boolean conflictsWith(@NotNull final Enchantment enchantment) {
- if (enchantment instanceof EcoEnchant) {
- return conflicts.contains(enchantment) || ((EcoEnchant) enchantment).conflicts.contains(this);
- }
- return conflicts.contains(enchantment);
- }
-
- /**
- * If enchantment can be applied to item.
- *
- * @param itemStack The {@link ItemStack} to test against.
- * @return If can be applied.
- */
- @Override
- public boolean canEnchantItem(@NotNull final ItemStack itemStack) {
- if (this.type.isSingular() && EcoEnchants.hasAnyOfType(itemStack, this.type)) {
- return FastItemStack.wrap(itemStack).getEnchantmentLevel(this, true) > 0;
- }
-
- if (itemStack.getType() == Material.BOOK || itemStack.getType() == Material.ENCHANTED_BOOK) {
- return true;
- }
-
- return targetMaterials.contains(itemStack.getType());
- }
-
- /**
- * 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 StringUtils.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;
- }
-
- @Override
- public String toString() {
- return "EcoEnchant{" + this.getKey() + "}";
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchants.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchants.java
deleted file mode 100644
index 886239cf..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchants.java
+++ /dev/null
@@ -1,609 +0,0 @@
-package com.willfp.ecoenchants.enchantments;
-
-import com.google.common.collect.BiMap;
-import com.google.common.collect.HashBiMap;
-import com.google.common.collect.ImmutableList;
-import com.willfp.eco.core.config.interfaces.Config;
-import com.willfp.eco.core.config.updating.ConfigUpdater;
-import com.willfp.eco.core.fast.FastItemStack;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.enchantments.custom.CustomEcoEnchants;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.AngerArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.AshArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.CloudsArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.CopperArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.CrimsonArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.DamageArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.DragonArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.DustArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.EmeraldArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.EnchantmentArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.EndArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.FireArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.GlowArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.HeartArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.HoneyArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.InkArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.LavaArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.LimeArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.MagicArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.MagmaArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.MusicArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.NautilusArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.NetherArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.RainArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.RedstoneArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SlimeArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SmokeArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SnowArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SoulArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SoulFireArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SparkArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SparkleArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SporeArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SweepArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.TearArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.TotemArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.VillagerArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.WarpedArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.WaterArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.WaxArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.WitchArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.ZapArtifact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.curse.BreaklessnessCurse;
-import com.willfp.ecoenchants.enchantments.ecoenchants.curse.CallingCurse;
-import com.willfp.ecoenchants.enchantments.ecoenchants.curse.DecayCurse;
-import com.willfp.ecoenchants.enchantments.ecoenchants.curse.FragilityCurse;
-import com.willfp.ecoenchants.enchantments.ecoenchants.curse.HarmlessnessCurse;
-import com.willfp.ecoenchants.enchantments.ecoenchants.curse.HungerCurse;
-import com.willfp.ecoenchants.enchantments.ecoenchants.curse.InaccuracyCurse;
-import com.willfp.ecoenchants.enchantments.ecoenchants.curse.MisfortuneCurse;
-import com.willfp.ecoenchants.enchantments.ecoenchants.curse.PermanenceCurse;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Abattoir;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Abrasion;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Aerial;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Aquatic;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Arachnid;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Arborist;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Arcanic;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Atmospheric;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Backstab;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Beheading;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.BlastMining;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Bleed;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Blind;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.BlockBreather;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.BossHunter;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Buckshot;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Butchering;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Cerebral;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Chopless;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Cleave;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Collateral;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Conclude;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Corrosive;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Cranial;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Criticals;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Cubism;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Defender;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Deflection;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Defusion;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Dexterous;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Disable;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Disappear;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Diurnal;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Diverse;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Dousing;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Drill;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Dullness;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Dweller;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Economical;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Electroshock;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.EndInfusion;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.EnderSlayer;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Enderism;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Evasion;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Extinguishing;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Extract;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Famine;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Farmhand;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Fetching;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Finality;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Finishing;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.FireAffinity;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.FirstStrike;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Flinch;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Forcefield;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Freerunner;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Frozen;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Fury;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Goliath;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Graceful;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Grapple;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.GreenThumb;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Grit;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Hellish;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Hook;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Horde;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.IceShot;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Identify;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Ignite;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.IllusionAspect;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Impact;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Incandescence;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.InfernalTouch;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Inferno;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Infuriate;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Insecticide;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Instantaneous;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Introversion;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Invigoration;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Kinetic;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Launch;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Leeching;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Lesion;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Levitate;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.LiquidShot;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.LuckyCatch;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Lumberjack;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Magnetic;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Marking;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Marksman;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Necrotic;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.NetherInfusion;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Netheric;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Nocturnal;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Optics;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Oxygenate;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Pacify;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Paladin;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Paralyze;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Parasitic;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Parry;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Phantasm;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Plasmic;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Protector;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Proximity;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Puncture;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Quadrilateralism;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Radiance;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Rage;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Rapid;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Reaper;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Rebounding;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Reel;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Reinforcement;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Rejuvenation;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Replenish;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Respirator;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Revenant;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Sating;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Serrated;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Settle;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Shockwave;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.ShotAssist;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Sickening;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Slaughter;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Slicing;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Spearfishing;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Spiked;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Splash;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Stab;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Stalwart;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Stamina;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.StoneSwitcher;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.StrayAspect;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Succession;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Supercritical;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Sycophant;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Tectonic;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Telekinesis;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Thor;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Thrive;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Tornado;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Toxic;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Transfuse;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Tripleshot;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.VampireAspect;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Vein;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Venom;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.VoidAffinity;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Voltage;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.WaterAffinity;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.WaterAspect;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Weakening;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Wisdom;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.WoodSwitcher;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Wound;
-import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Zeus;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Aiming;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Annihilate;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Bladed;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Bolt;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Carve;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Confusion;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Energizing;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Force;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Frenzy;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Harpoon;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Indestructibility;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Instability;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Intellect;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.LifeSteal;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Pentashot;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Preservation;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Prosperity;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Razor;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Repairing;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Soulbound;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Spring;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Streamlining;
-import com.willfp.ecoenchants.enchantments.ecoenchants.special.Volatile;
-import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Ascend;
-import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Charge;
-import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Dynamite;
-import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Missile;
-import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Quake;
-import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Vitalize;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantments;
-import com.willfp.ecoenchants.integrations.registration.RegistrationManager;
-import com.willfp.libreforge.chains.EffectChains;
-import lombok.experimental.UtilityClass;
-import org.bukkit.NamespacedKey;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Optional;
-
-@UtilityClass
-@SuppressWarnings({"unused", "checkstyle:JavadocVariable"})
-public class EcoEnchants {
- public static final String CONFIG_LOCATION = "config.";
- public static final String OBTAINING_LOCATION = "obtaining.";
- public static final String GENERAL_LOCATION = "general-config.";
-
- private static final BiMap BY_KEY = HashBiMap.create();
- private static final BiMap BY_NAME = HashBiMap.create();
-
- public static final EcoEnchant TELEKINESIS = new Telekinesis();
- public static final EcoEnchant MARKSMAN = new Marksman();
- public static final EcoEnchant INFERNAL_TOUCH = new InfernalTouch();
- public static final EcoEnchant SPRING = new Spring();
- public static final EcoEnchant STRAY_ASPECT = new StrayAspect();
- public static final EcoEnchant ILLUSION_ASPECT = new IllusionAspect();
- public static final EcoEnchant SLICING = new Slicing();
- public static final EcoEnchant DEXTEROUS = new Dexterous();
- public static final EcoEnchant BEHEADING = new Beheading();
- public static final EcoEnchant NECROTIC = new Necrotic();
- public static final EcoEnchant TECTONIC = new Tectonic();
- public static final EcoEnchant EVASION = new Evasion();
- public static final EcoEnchant SUCCESSION = new Succession();
- public static final EcoEnchant FARMHAND = new Farmhand();
- public static final EcoEnchant WISDOM = new Wisdom();
- public static final EcoEnchant LEECHING = new Leeching();
- public static final EcoEnchant VAMPIRE_ASPECT = new VampireAspect();
- public static final EcoEnchant INSTABILITY = new Instability();
- public static final EcoEnchant THRIVE = new Thrive();
- public static final EcoEnchant DRILL = new Drill();
- public static final EcoEnchant THOR = new Thor();
- public static final EcoEnchant STREAMLINING = new Streamlining();
- public static final EcoEnchant FIRST_STRIKE = new FirstStrike();
- public static final EcoEnchant FINISHING = new Finishing();
- public static final EcoEnchant CRITICALS = new Criticals();
- public static final EcoEnchant INCANDESCENCE = new Incandescence();
- public static final EcoEnchant SUPERCRITICAL = new Supercritical();
- public static final EcoEnchant ABRASION = new Abrasion();
- public static final EcoEnchant SPLASH = new Splash();
- public static final EcoEnchant EXTINGUISHING = new Extinguishing();
- public static final EcoEnchant GOLIATH = new Goliath();
- public static final EcoEnchant OPTICS = new Optics();
- public static final EcoEnchant DEFUSION = new Defusion();
- public static final EcoEnchant CEREBRAL = new Cerebral();
- public static final EcoEnchant GRIT = new Grit();
- public static final EcoEnchant BOSS_HUNTER = new BossHunter();
- public static final EcoEnchant INVIGORATION = new Invigoration();
- public static final EcoEnchant REJUVENATION = new Rejuvenation();
- public static final EcoEnchant FRAGILITY_CURSE = new FragilityCurse();
- public static final EcoEnchant TRIPLESHOT = new Tripleshot();
- public static final EcoEnchant RAPID = new Rapid();
- public static final EcoEnchant SATING = new Sating();
- public static final EcoEnchant REINFORCEMENT = new Reinforcement();
- public static final EcoEnchant SOULBOUND = new Soulbound();
- public static final EcoEnchant RAZOR = new Razor();
- public static final EcoEnchant PROSPERITY = new Prosperity();
- public static final EcoEnchant PRESERVATION = new Preservation();
- public static final EcoEnchant FRENZY = new Frenzy();
- public static final EcoEnchant BUTCHERING = new Butchering();
- public static final EcoEnchant PROXIMITY = new Proximity();
- public static final EcoEnchant ENDER_SLAYER = new EnderSlayer();
- public static final EcoEnchant PROTECTOR = new Protector();
- public static final EcoEnchant INDESTRUCTIBILITY = new Indestructibility();
- public static final EcoEnchant ENERGIZING = new Energizing();
- public static final EcoEnchant INTELLECT = new Intellect();
- public static final EcoEnchant DEFLECTION = new Deflection();
- public static final EcoEnchant LAUNCH = new Launch();
- public static final EcoEnchant PERMANENCE_CURSE = new PermanenceCurse();
- public static final EcoEnchant SPEARFISHING = new Spearfishing();
- public static final EcoEnchant NETHER_INFUSION = new NetherInfusion();
- public static final EcoEnchant REPLENISH = new Replenish();
- public static final EcoEnchant FLINCH = new Flinch();
- public static final EcoEnchant ELECTROSHOCK = new Electroshock();
- public static final EcoEnchant NOCTURNAL = new Nocturnal();
- public static final EcoEnchant CONFUSION = new Confusion();
- public static final EcoEnchant ARCANIC = new Arcanic();
- public static final EcoEnchant PENTASHOT = new Pentashot();
- public static final EcoEnchant LUMBERJACK = new Lumberjack();
- public static final EcoEnchant STONE_SWITCHER = new StoneSwitcher();
- public static final EcoEnchant MAGNETIC = new Magnetic();
- public static final EcoEnchant REPAIRING = new Repairing();
- public static final EcoEnchant CALLING_CURSE = new CallingCurse();
- public static final EcoEnchant BLAST_MINING = new BlastMining();
- public static final EcoEnchant LIQUID_SHOT = new LiquidShot();
- public static final EcoEnchant GRAPPLE = new Grapple();
- public static final EcoEnchant HEART_ARTIFACT = new HeartArtifact();
- public static final EcoEnchant SPARKLE_ARTIFACT = new SparkleArtifact();
- public static final EcoEnchant LAVA_ARTIFACT = new LavaArtifact();
- public static final EcoEnchant DRAGON_ARTIFACT = new DragonArtifact();
- public static final EcoEnchant ENCHANTMENT_ARTIFACT = new EnchantmentArtifact();
- public static final EcoEnchant SMOKE_ARTIFACT = new SmokeArtifact();
- public static final EcoEnchant FIRE_ARTIFACT = new FireArtifact();
- public static final EcoEnchant EMERALD_ARTIFACT = new EmeraldArtifact();
- public static final EcoEnchant NETHER_ARTIFACT = new NetherArtifact();
- public static final EcoEnchant END_ARTIFACT = new EndArtifact();
- public static final EcoEnchant WATER_ARTIFACT = new WaterArtifact();
- public static final EcoEnchant TOTEM_ARTIFACT = new TotemArtifact();
- public static final EcoEnchant REDSTONE_ARTIFACT = new RedstoneArtifact();
- public static final EcoEnchant ZAP_ARTIFACT = new ZapArtifact();
- public static final EcoEnchant MUSIC_ARTIFACT = new MusicArtifact();
- public static final EcoEnchant SNOW_ARTIFACT = new SnowArtifact();
- public static final EcoEnchant WITCH_ARTIFACT = new WitchArtifact();
- public static final EcoEnchant HONEY_ARTIFACT = new HoneyArtifact();
- public static final EcoEnchant DAMAGE_ARTIFACT = new DamageArtifact();
- public static final EcoEnchant CLOUDS_ARTIFACT = new CloudsArtifact();
- public static final EcoEnchant MAGIC_ARTIFACT = new MagicArtifact();
- public static final EcoEnchant DUST_ARTIFACT = new DustArtifact();
- public static final EcoEnchant MAGMA_ARTIFACT = new MagmaArtifact();
- public static final EcoEnchant INK_ARTIFACT = new InkArtifact();
- public static final EcoEnchant ZEUS = new Zeus();
- public static final EcoEnchant KINETIC = new Kinetic();
- public static final EcoEnchant FIRE_AFFINITY = new FireAffinity();
- public static final EcoEnchant PARASITIC = new Parasitic();
- public static final EcoEnchant PARRY = new Parry();
- public static final EcoEnchant AIMING = new Aiming();
- public static final EcoEnchant HOOK = new Hook();
- public static final EcoEnchant BLEED = new Bleed();
- public static final EcoEnchant WEAKENING = new Weakening();
- public static final EcoEnchant OXYGENATE = new Oxygenate();
- public static final EcoEnchant WATER_ASPECT = new WaterAspect();
- public static final EcoEnchant STAMINA = new Stamina();
- public static final EcoEnchant COLLATERAL = new Collateral();
- public static final EcoEnchant HUNGER_CURSE = new HungerCurse();
- public static final EcoEnchant PALADIN = new Paladin();
- public static final EcoEnchant SERRATED = new Serrated();
- public static final EcoEnchant BLADED = new Bladed();
- public static final EcoEnchant INFERNO = new Inferno();
- public static final EcoEnchant STAB = new Stab();
- public static final EcoEnchant TORNADO = new Tornado();
- public static final EcoEnchant EXTRACT = new Extract();
- public static final EcoEnchant AERIAL = new Aerial();
- public static final EcoEnchant FAMINE = new Famine();
- public static final EcoEnchant ANNIHILATE = new Annihilate();
- public static final EcoEnchant RADIANCE = new Radiance();
- public static final EcoEnchant HORDE = new Horde();
- public static final EcoEnchant VEIN = new Vein();
- public static final EcoEnchant ICE_SHOT = new IceShot();
- public static final EcoEnchant PUNCTURE = new Puncture();
- public static final EcoEnchant SHOCKWAVE = new Shockwave();
- public static final EcoEnchant VOLATILE = new Volatile();
- public static final EcoEnchant INSTANTANEOUS = new Instantaneous();
- public static final EcoEnchant FREERUNNER = new Freerunner();
- public static final EcoEnchant BOLT = new Bolt();
- public static final EcoEnchant DULLNESS = new Dullness();
- public static final EcoEnchant IGNITE = new Ignite();
- public static final EcoEnchant CLEAVE = new Cleave();
- public static final EcoEnchant CARVE = new Carve();
- public static final EcoEnchant TOXIC = new Toxic();
- public static final EcoEnchant WATER_AFFINITY = new WaterAffinity();
- public static final EcoEnchant FORCEFIELD = new Forcefield();
- public static final EcoEnchant SYCOPHANT = new Sycophant();
- public static final EcoEnchant CHOPLESS = new Chopless();
- public static final EcoEnchant GREEN_THUMB = new GreenThumb();
- public static final EcoEnchant SPIKED = new Spiked();
- public static final EcoEnchant HARPOON = new Harpoon();
- public static final EcoEnchant REEL = new Reel();
- public static final EcoEnchant SHOT_ASSIST = new ShotAssist();
- public static final EcoEnchant FROZEN = new Frozen();
- public static final EcoEnchant DISAPPEAR = new Disappear();
- public static final EcoEnchant HARMLESSNESS_CURSE = new HarmlessnessCurse();
- public static final EcoEnchant FURY = new Fury();
- public static final EcoEnchant LEVITATE = new Levitate();
- public static final EcoEnchant BREAKLESSNESS_CURSE = new BreaklessnessCurse();
- public static final EcoEnchant DECAY_CURSE = new DecayCurse();
- public static final EcoEnchant MISFORTUNE_CURSE = new MisfortuneCurse();
- public static final EcoEnchant VENOM = new Venom();
- public static final EcoEnchant CRANIAL = new Cranial();
- public static final EcoEnchant AQUATIC = new Aquatic();
- public static final EcoEnchant BUCKSHOT = new Buckshot();
- public static final EcoEnchant DIVERSE = new Diverse();
- public static final EcoEnchant LIFE_STEAL = new LifeSteal();
- public static final EcoEnchant LIME_ARTIFACT = new LimeArtifact();
- public static final EcoEnchant FORCE = new Force();
- public static final EcoEnchant END_INFUSION = new EndInfusion();
- public static final EcoEnchant DIURNAL = new Diurnal();
- public static final EcoEnchant MARKING = new Marking();
- public static final EcoEnchant CORROSIVE = new Corrosive();
- public static final EcoEnchant WOUND = new Wound();
- public static final EcoEnchant FINALITY = new Finality();
- public static final EcoEnchant BLIND = new Blind();
- public static final EcoEnchant SICKENING = new Sickening();
- public static final EcoEnchant DEFENDER = new Defender();
- public static final EcoEnchant NETHERIC = new Netheric();
- public static final EcoEnchant ENDERISM = new Enderism();
- public static final EcoEnchant RAGE = new Rage();
- public static final EcoEnchant IMPACT = new Impact();
- public static final EcoEnchant PARALYZE = new Paralyze();
- public static final EcoEnchant IDENTIFY = new Identify();
- public static final EcoEnchant INFURIATE = new Infuriate();
- public static final EcoEnchant ATMOSPHERIC = new Atmospheric();
- public static final EcoEnchant REVENANT = new Revenant();
- public static final EcoEnchant INSECTICIDE = new Insecticide();
- public static final EcoEnchant SLAUGHTER = new Slaughter();
- public static final EcoEnchant SETTLE = new Settle();
- public static final EcoEnchant PHANTASM = new Phantasm();
- public static final EcoEnchant ARACHNID = new Arachnid();
- public static final EcoEnchant PACIFY = new Pacify();
- public static final EcoEnchant ABATTOIR = new Abattoir();
- public static final EcoEnchant DISABLE = new Disable();
- public static final EcoEnchant HELLISH = new Hellish();
- public static final EcoEnchant VOID_AFFINITY = new VoidAffinity();
- public static final EcoEnchant CUBISM = new Cubism();
- public static final EcoEnchant QUADRILATERALISM = new Quadrilateralism();
- public static final EcoEnchant LESION = new Lesion();
- public static final EcoEnchant CONCLUDE = new Conclude();
- public static final EcoEnchant GRACEFUL = new Graceful();
- public static final EcoEnchant BLOCK_BREATHER = new BlockBreather();
- public static final EcoEnchant VOLTAGE = new Voltage();
- public static final EcoEnchant TRANSFUSE = new Transfuse();
- public static final EcoEnchant INACCURACY_CURSE = new InaccuracyCurse();
- public static final EcoEnchant RESPIRATOR = new Respirator();
- public static final EcoEnchant FETCHING = new Fetching();
- public static final EcoEnchant ECONOMICAL = new Economical();
- public static final EcoEnchant SOUL_ARTIFACT = new SoulArtifact();
- public static final EcoEnchant SOUL_FIRE_ARTIFACT = new SoulFireArtifact();
- public static final EcoEnchant CRIMSON_ARTIFACT = new CrimsonArtifact();
- public static final EcoEnchant ASH_ARTIFACT = new AshArtifact();
- public static final EcoEnchant WARPED_ARTIFACT = new WarpedArtifact();
- public static final EcoEnchant TEAR_ARTIFACT = new TearArtifact();
- public static final EcoEnchant BACKSTAB = new Backstab();
- public static final EcoEnchant DWELLER = new Dweller();
- public static final EcoEnchant STALWART = new Stalwart();
- public static final EcoEnchant PLASMIC = new Plasmic();
- public static final EcoEnchant MISSILE = new Missile();
- public static final EcoEnchant QUAKE = new Quake();
- public static final EcoEnchant VITALIZE = new Vitalize();
- public static final EcoEnchant DYNAMITE = new Dynamite();
- public static final EcoEnchant CHARGE = new Charge();
- public static final EcoEnchant ASCEND = new Ascend();
- public static final EcoEnchant ARBORIST = new Arborist();
- public static final EcoEnchant LUCKY_CATCH = new LuckyCatch();
- public static final EcoEnchant INTROVERSION = new Introversion();
- public static final EcoEnchant VILLAGER_ARTIFACT = new VillagerArtifact();
- public static final EcoEnchant ANGER_ARTIFACT = new AngerArtifact();
- public static final EcoEnchant NAUTILUS_ARTIFACT = new NautilusArtifact();
- public static final EcoEnchant SWEEP_ARTIFACT = new SweepArtifact();
- public static final EcoEnchant REAPER = new Reaper();
- public static final EcoEnchant WOOD_SWITCHER = new WoodSwitcher();
- public static final EcoEnchant REBOUNDING = new Rebounding();
- public static final EcoEnchant COPPER_ARTIFACT = new CopperArtifact();
- public static final EcoEnchant GLOW_ARTIFACT = new GlowArtifact();
- public static final EcoEnchant SPARK_ARTIFACT = new SparkArtifact();
- public static final EcoEnchant SPORE_ARTIFACT = new SporeArtifact();
- public static final EcoEnchant WAX_ARTIFACT = new WaxArtifact();
- public static final EcoEnchant RAIN_ARTIFACT = new RainArtifact();
- public static final EcoEnchant SLIME_ARTIFACT = new SlimeArtifact();
- public static final EcoEnchant DOUSING = new Dousing();
-
- /**
- * Get all registered {@link EcoEnchant}s.
- *
- * @return A list of all {@link EcoEnchant}s.
- */
- public static List values() {
- return ImmutableList.copyOf(BY_KEY.values());
- }
-
- /**
- * Get {@link EcoEnchant} matching display name.
- *
- * @param name The display name to search for.
- * @return The matching {@link EcoEnchant}, or null if not found.
- */
- public static EcoEnchant getByName(@NotNull final String name) {
- return BY_NAME.get(name);
- }
-
- /**
- * Get {@link EcoEnchant} matching permission name.
- *
- * @param permissionName The permission name to search for.
- * @return The matching {@link EcoEnchant}, or null if not found.
- */
- public static EcoEnchant getByPermission(@NotNull final String permissionName) {
- Optional matching = values().stream().filter(enchant -> enchant.getPermissionName().equalsIgnoreCase(permissionName)).findFirst();
- return matching.orElse(null);
- }
-
- /**
- * Get {@link EcoEnchant} matching key.
- *
- * @param key The NamespacedKey to search for.
- * @return The matching {@link EcoEnchant}, or null if not found.
- */
- public static EcoEnchant getByKey(@NotNull final NamespacedKey key) {
- return BY_KEY.get(key);
- }
-
- /**
- * Get if {@link ItemStack} has any {@link EcoEnchant} matching specified {@link EnchantmentType}.
- *
- * @param item The {@link ItemStack} to check.
- * @param type The {@link EnchantmentType} to match.
- * @return True if has, false if doesn't have.
- */
- public static boolean hasAnyOfType(@NotNull final ItemStack item,
- @NotNull final EnchantmentType type) {
- return FastItemStack.wrap(item).getEnchants(true).keySet()
- .stream()
- .filter(enchantment -> enchantment instanceof EcoEnchant)
- .map(enchantment -> (EcoEnchant) enchantment)
- .anyMatch(ecoEnchant -> ecoEnchant.getType().equals(type));
- }
-
- /**
- * Update all {@link EcoEnchant}s.
- *
- * @param plugin Instance of EcoEnchants.
- */
- @ConfigUpdater
- public static void update(@NotNull final EcoEnchantsPlugin plugin) {
- for (Config config : plugin.getCustomEnchantsYml().getSubsections("chains")) {
- EffectChains.compile(config, "Custom Enchant Chains");
- }
-
- CustomEcoEnchants.update(plugin);
-
- for (EcoEnchant ecoEnchant : new HashSet<>(values())) {
- ecoEnchant.update();
- }
-
- VanillaEnchantments.update(plugin);
- RegistrationManager.registerEnchantments();
- }
-
- /**
- * Add new {@link EcoEnchant} to EcoEnchants.
- *
- * Only for internal use, enchantments are automatically added in the constructor.
- *
- * @param enchant The {@link EcoEnchant} to add.
- */
- public static void addNewEcoEnchant(@NotNull final EcoEnchant enchant) {
- BY_KEY.remove(enchant.getKey());
- BY_NAME.inverse().remove(enchant);
- BY_KEY.put(enchant.getKey(), enchant);
- BY_NAME.put(enchant.getDisplayName(), enchant);
- }
-
- /**
- * Remove {@link EcoEnchant} from EcoEnchants.
- *
- * @param enchant The {@link EcoEnchant} to remove.
- */
- public static void removeEcoEnchant(@NotNull final EcoEnchant enchant) {
- BY_KEY.remove(enchant.getKey());
- BY_NAME.inverse().remove(enchant);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/ConditionHasEcoEnchantRequirements.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/ConditionHasEcoEnchantRequirements.java
deleted file mode 100644
index 5e56fc7f..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/ConditionHasEcoEnchantRequirements.java
+++ /dev/null
@@ -1,25 +0,0 @@
-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.EcoEnchants;
-import com.willfp.libreforge.conditions.Condition;
-import org.bukkit.NamespacedKey;
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-
-public class ConditionHasEcoEnchantRequirements extends Condition {
- /**
- * Create new condition.
- */
- public ConditionHasEcoEnchantRequirements() {
- super("has_ecoenchant_requirements");
- }
-
- @Override
- public boolean isConditionMet(@NotNull final Player player,
- @NotNull final Config config) {
- EcoEnchant ecoEnchant = EcoEnchants.getByKey(NamespacedKey.minecraft(config.getString("enchant")));
- return ecoEnchant.areRequirementsMet(player);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/ConditionInEcoEnchantWorld.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/ConditionInEcoEnchantWorld.java
deleted file mode 100644
index 4e731a58..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/ConditionInEcoEnchantWorld.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.willfp.ecoenchants.enchantments.custom;
-
-import com.willfp.eco.core.config.interfaces.Config;
-import com.willfp.eco.util.ListUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.libreforge.conditions.Condition;
-import org.bukkit.NamespacedKey;
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-
-public class ConditionInEcoEnchantWorld extends Condition {
- /**
- * Create new condition.
- */
- public ConditionInEcoEnchantWorld() {
- super("in_ecoenchant_world");
- }
-
- @Override
- public boolean isConditionMet(@NotNull final Player player,
- @NotNull final Config config) {
- EcoEnchant ecoEnchant = EcoEnchants.getByKey(NamespacedKey.minecraft(config.getString("enchant")));
- return !ListUtils.containsIgnoreCase(ecoEnchant.getDisabledWorldNames(), player.getWorld().getName());
- }
-}
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
deleted file mode 100644
index 7f0ea5ef..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchant.java
+++ /dev/null
@@ -1,101 +0,0 @@
-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.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.Bukkit;
-import org.jetbrains.annotations.NotNull;
-
-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 {
- /**
- * The levels.
- */
- private final Map levels;
-
- /**
- * Create custom EcoEnchant.
- *
- * @param config The config.
- */
- public CustomEcoEnchant(@NotNull final Config config) {
- super(
- config.getString("id"), EnchantmentType.getByName(config.getString("type").toUpperCase()), config
- );
-
- this.levels = new HashMap<>();
-
- int i = 1;
- for (Config levelConfig : config.getSubsections("levels")) {
- levels.put(i, new CustomEcoEnchantLevel(this, levelConfig, i));
- i++;
- }
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return this.getLevel(level).getValuePlaceholder();
- }
-
- @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.
- *
- * @param level The level.
- * @return The level.
- */
- public CustomEcoEnchantLevel getLevel(final int level) {
- return levels.get(level);
- }
-
- /**
- * Get the levels.
- *
- * @return The levels.
- */
- public Set getLevels() {
- return new HashSet<>(levels.values());
- }
-
- @Override
- public int getMaxLevel() {
- return this.levels.size();
- }
-
- @Override
- public boolean isEnabled() {
- return true;
- }
-
- static {
- new ConditionInEcoEnchantWorld();
- new ConditionHasEcoEnchantRequirements();
- }
-}
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
deleted file mode 100644
index c9697cb4..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchantLevel.java
+++ /dev/null
@@ -1,151 +0,0 @@
-package com.willfp.ecoenchants.enchantments.custom;
-
-import com.github.benmanes.caffeine.cache.Cache;
-import com.github.benmanes.caffeine.cache.Caffeine;
-import com.willfp.eco.core.config.BuildableConfig;
-import com.willfp.eco.core.config.interfaces.Config;
-import com.willfp.eco.core.placeholder.StaticPlaceholder;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.libreforge.Holder;
-import com.willfp.libreforge.conditions.Conditions;
-import com.willfp.libreforge.conditions.ConfiguredCondition;
-import com.willfp.libreforge.effects.ConfiguredEffect;
-import com.willfp.libreforge.effects.Effects;
-import lombok.Getter;
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.TimeUnit;
-
-public class CustomEcoEnchantLevel implements Holder {
- /**
- * The parent EcoEnchant.
- */
- @Getter
- private final EcoEnchant parent;
-
- /**
- * The conditions.
- */
- private final Set conditions = new HashSet<>();
-
- /**
- * The effects.
- */
- private final Set effects = new HashSet<>();
-
- /**
- * The value placeholder.
- */
- @Getter
- private final String valuePlaceholder;
-
- /**
- * The level.
- */
- private final int level;
-
- /**
- * Create custom EcoEnchant level.
- *
- * @param parent The parent.
- * @param config The config.
- * @param level The level.
- */
- public CustomEcoEnchantLevel(@NotNull final EcoEnchant parent,
- @NotNull final Config config,
- final int level) {
- this.parent = parent;
- this.level = level;
-
- config.injectPlaceholders(new StaticPlaceholder("level", () -> String.valueOf(level)));
-
- for (Config cfg : config.getSubsections("effects")) {
- effects.add(Effects.compile(cfg, "Custom EcoEnchant ID " + parent.getKey().getKey()));
- }
-
- for (Config cfg : config.getSubsections("conditions")) {
- conditions.add(Conditions.compile(cfg, "Custom EcoEnchant ID " + parent.getKey().getKey()));
- }
-
- conditions.add(Conditions.compile(
- new BuildableConfig()
- .add("args.enchant", parent.getKey().getKey())
- .add("id", "in_ecoenchant_world"),
- "EcoEnchants Internals (world) - If you see this message, report it as a bug!"
- ));
-
- conditions.add(Conditions.compile(
- new BuildableConfig()
- .add("args.enchant", parent.getKey().getKey())
- .add("id", "has_ecoenchant_requirements"),
- "EcoEnchants Internals (requirements) - If you see this message, report it as a bug!"
- ));
-
- this.valuePlaceholder = config.getString("value-placeholder");
- }
-
- @NotNull
- @Override
- public Set getConditions() {
- return conditions;
- }
-
- @NotNull
- @Override
- public Set getEffects() {
- return effects;
- }
-
- @Override
- public String toString() {
- return "CustomEcoEnchantLevel{"
- + "parent=" + parent
- + ",level=" + level
- + '}';
- }
-
- @NotNull
- @Override
- public List getNotMetLines(@NotNull final Player player) {
- return NotMetLineCacheEntry.CACHE.get(new NotMetLineCacheEntry(player.getUniqueId(), this.getId()), (entry) -> {
- 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;
- }
-
- /**
- * Cache for not met lines.
- *
- * @param uuid The UUID.
- * @param holderID The holder ID.
- */
- private record NotMetLineCacheEntry(@NotNull UUID uuid,
- @NotNull String holderID) {
- /**
- * The cache.
- */
- static final Cache> CACHE = Caffeine.newBuilder()
- .expireAfterWrite(1, TimeUnit.SECONDS)
- .build();
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchantRequirementListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchantRequirementListeners.java
deleted file mode 100644
index e42eb48b..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchantRequirementListeners.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.willfp.ecoenchants.enchantments.custom;
-
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.PluginDependent;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.libreforge.events.EffectActivateEvent;
-import org.bukkit.event.Listener;
-import org.jetbrains.annotations.NotNull;
-
-public class CustomEcoEnchantRequirementListeners extends PluginDependent implements Listener {
- /**
- * Initialize new listeners and link them to a plugin.
- *
- * @param plugin The plugin to link to.
- */
- public CustomEcoEnchantRequirementListeners(@NotNull final EcoPlugin plugin) {
- super(plugin);
- }
-
- public void onActivate(@NotNull final EffectActivateEvent event) {
- if (!(event.getHolder() instanceof CustomEcoEnchantLevel level)) {
- return;
- }
-
- EcoEnchant enchant = level.getParent();
-
- if (!(enchant.areRequirementsMet(event.getPlayer()))) {
- event.setCancelled(true);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchants.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchants.java
deleted file mode 100644
index ebfb2f58..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchants.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.willfp.ecoenchants.enchantments.custom;
-
-import com.willfp.eco.core.config.interfaces.Config;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import lombok.experimental.UtilityClass;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.HashSet;
-import java.util.Set;
-
-@UtilityClass
-public class CustomEcoEnchants {
- /**
- * Custom EcoEnchants.
- */
- private static final Set VALUES = new HashSet<>();
-
- /**
- * Update the map.
- *
- * @param plugin Instance of EcoEnchants.
- */
- public static void update(@NotNull final EcoEnchantsPlugin plugin) {
- for (EcoEnchant enchant : VALUES) {
- EcoEnchants.removeEcoEnchant(enchant);
- EnchantmentUtils.unregister(enchant);
- }
-
- VALUES.clear();
-
- for (Config cfg : plugin.getCustomEnchantsYml().getSubsections("enchants")) {
- VALUES.add(new CustomEcoEnchant(cfg));
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEnchantEnableListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEnchantEnableListeners.java
deleted file mode 100644
index e4db5108..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEnchantEnableListeners.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package com.willfp.ecoenchants.enchantments.custom;
-
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.PluginDependent;
-import com.willfp.eco.core.events.ArmorChangeEvent;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
-import com.willfp.libreforge.LibReforgeUtils;
-import com.willfp.libreforge.effects.ConfiguredEffect;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.EntityPickupItemEvent;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.event.player.PlayerDropItemEvent;
-import org.bukkit.event.player.PlayerItemHeldEvent;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class CustomEnchantEnableListeners extends PluginDependent implements Listener {
- /**
- * Initialize new listeners and link them to a plugin.
- *
- * @param plugin The plugin to link to.
- */
- public CustomEnchantEnableListeners(@NotNull final EcoPlugin plugin) {
- super(plugin);
- }
-
- /**
- * Called on item pickup.
- *
- * @param event The event to listen for.
- */
- @EventHandler
- public void onItemPickup(@NotNull final EntityPickupItemEvent event) {
- if (!(event.getEntity() instanceof Player player)) {
- return;
- }
-
- if (!EnchantmentTarget.ALL.getMaterials().contains(event.getItem().getItemStack().getType())) {
- return;
- }
-
- refreshPlayer(player);
- }
-
- /**
- * Called on player join.
- *
- * @param event The event to listen for.
- */
- @EventHandler
- public void onPlayerJoin(@NotNull final PlayerJoinEvent event) {
- refresh();
- }
-
- /**
- * Called on player leave.
- *
- * @param event The event to listen for.
- */
- @EventHandler
- public void onPlayerLeave(@NotNull final PlayerQuitEvent event) {
- refresh();
-
- Player player = event.getPlayer();
-
- for (EcoEnchant value : EcoEnchants.values()) {
- if (!(value instanceof CustomEcoEnchant enchant)) {
- continue;
- }
-
- for (CustomEcoEnchantLevel level : enchant.getLevels()) {
- for (ConfiguredEffect effect : level.getEffects()) {
- effect.disableFor(player);
- }
- }
- }
- }
-
- /**
- * Called on item drop.
- *
- * @param event The event to listen for.
- */
- @EventHandler
- public void onInventoryDrop(@NotNull final PlayerDropItemEvent event) {
- if (!EnchantmentTarget.ALL.getMaterials().contains(event.getItemDrop().getItemStack().getType())) {
- return;
- }
-
- refreshPlayer(event.getPlayer());
- }
-
- /**
- * Called on slot change.
- *
- * @param event The event to listen for.
- */
- @EventHandler
- public void onChangeSlot(@NotNull final PlayerItemHeldEvent event) {
- refreshPlayer(event.getPlayer());
-
- this.getPlugin().getScheduler().run(() -> refreshPlayer(event.getPlayer()));
- }
-
- /**
- * Called on armor change.
- *
- * @param event The event to listen for.
- */
- @EventHandler
- public void onArmorChange(@NotNull final ArmorChangeEvent event) {
- refreshPlayer(event.getPlayer());
- }
-
- /**
- * Called on inventory click.
- *
- * @param event The event to listen for.
- */
- @EventHandler
- public void onInventoryClick(@NotNull final InventoryClickEvent event) {
- if (!(event.getWhoClicked() instanceof Player)) {
- return;
- }
-
- refreshPlayer((Player) event.getWhoClicked());
- }
-
- /**
- * Force refresh all online players.
- *
- * This is a very expensive method.
- */
- public void refresh() {
- this.getPlugin().getServer().getOnlinePlayers().forEach(this::refreshPlayer);
- }
-
- private void refreshPlayer(@NotNull final Player player) {
- CustomEnchantLookup.clearCache(player);
- LibReforgeUtils.updateEffects(player);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEnchantLookup.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEnchantLookup.java
deleted file mode 100644
index f58b486e..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEnchantLookup.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package com.willfp.ecoenchants.enchantments.custom;
-
-import com.github.benmanes.caffeine.cache.Cache;
-import com.github.benmanes.caffeine.cache.Caffeine;
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-import java.util.function.Function;
-
-public class CustomEnchantLookup {
- /**
- * All registered providers.
- */
- private static final Set>> PROVIDERS = new HashSet<>();
-
- /**
- * Cached items.
- */
- private static final Cache> ITEM_CACHE = Caffeine.newBuilder()
- .expireAfterWrite(2, TimeUnit.SECONDS)
- .build();
-
- /**
- * Cached enchant levels.
- */
- private static final Cache> ENCHANT_LEVELS_CACHE = Caffeine.newBuilder()
- .expireAfterWrite(2, TimeUnit.SECONDS)
- .build();
-
- /**
- * Instance of EcoEnchants.
- */
- private static final EcoPlugin PLUGIN = EcoEnchantsPlugin.getInstance();
-
- /**
- * Register provider.
- *
- * @param provider The provider.
- */
- public static void registerProvider(@NotNull final Function> provider) {
- PROVIDERS.add(provider);
- }
-
- /**
- * Provide ItemStacks.
- *
- * @param p The player.
- * @return The ItemStacks.
- */
- public static Map provide(@NotNull final Player p) {
- return ITEM_CACHE.get(p, player -> {
- Map found = new HashMap<>();
- for (Function> provider : PROVIDERS) {
- found.putAll(provider.apply(player));
- }
- found.keySet().removeIf(Objects::isNull);
- return found;
- });
- }
-
- /**
- * Provide levels.
- *
- * @param p The player.
- * @return The levels.
- */
- public static List provideLevels(@NotNull final Player p) {
- return new ArrayList<>(ENCHANT_LEVELS_CACHE.get(p, player -> {
- List found = new ArrayList<>();
-
- for (Map.Entry entry : provide(player).entrySet()) {
- ItemStack itemStack = entry.getKey();
- EnchantmentTarget.Slot slot = entry.getValue();
- if (itemStack == null) {
- continue;
- }
-
- Map enchants = EnchantChecks.getEnchantsOnItem(itemStack);
-
- if (enchants.isEmpty()) {
- continue;
- }
-
- for (Map.Entry enchantEntry : enchants.entrySet()) {
- if (!(enchantEntry.getKey() instanceof CustomEcoEnchant enchant)) {
- continue;
- }
-
- if (slot != EnchantmentTarget.Slot.ANY) {
- if (!enchant.getTargets().stream()
- .map(EnchantmentTarget::getSlot).toList()
- .contains(slot)) {
- continue;
- }
- }
-
- found.add(enchant.getLevel(enchantEntry.getValue()));
- }
- }
-
- return found;
- }));
- }
-
- /**
- * Clear cache.
- *
- * @param player The player.
- */
- public static void clearCache(@NotNull final Player player) {
- ITEM_CACHE.invalidate(player);
- ENCHANT_LEVELS_CACHE.invalidate(player);
- }
-
- static {
- registerProvider(player -> Map.of(
- player.getInventory().getItemInMainHand(),
- EnchantmentTarget.Slot.HANDS
- ));
- registerProvider(player -> Map.of(
- player.getInventory().getItemInOffHand(),
- EnchantmentTarget.Slot.HANDS
- ));
- registerProvider(player -> {
- Map items = new HashMap<>();
- for (ItemStack stack : player.getInventory().getArmorContents()) {
- items.put(stack, EnchantmentTarget.Slot.ARMOR);
- }
- return items;
- });
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AngerArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AngerArtifact.java
deleted file mode 100644
index d60ed683..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AngerArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class AngerArtifact extends Artifact {
- public AngerArtifact() {
- super(
- "anger_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.VILLAGER_ANGRY;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AshArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AshArtifact.java
deleted file mode 100644
index 40dfa27a..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AshArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class AshArtifact extends Artifact {
- public AshArtifact() {
- super(
- "ash_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.WHITE_ASH;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CloudsArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CloudsArtifact.java
deleted file mode 100644
index 1811d272..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CloudsArtifact.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Color;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class CloudsArtifact extends Artifact {
- public CloudsArtifact() {
- super(
- "clouds_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.REDSTONE;
- }
-
- @Override
- public Particle.DustOptions getDustOptions() {
- return new Particle.DustOptions(Color.AQUA, 1.0f);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CopperArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CopperArtifact.java
deleted file mode 100644
index ca4e83c8..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CopperArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class CopperArtifact extends Artifact {
- public CopperArtifact() {
- super(
- "copper_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.WAX_ON;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CrimsonArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CrimsonArtifact.java
deleted file mode 100644
index 269a528a..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CrimsonArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class CrimsonArtifact extends Artifact {
- public CrimsonArtifact() {
- super(
- "crimson_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.CRIMSON_SPORE;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DamageArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DamageArtifact.java
deleted file mode 100644
index dbc80da2..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DamageArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class DamageArtifact extends Artifact {
- public DamageArtifact() {
- super(
- "damage_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.DAMAGE_INDICATOR;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DragonArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DragonArtifact.java
deleted file mode 100644
index fa9e0cdd..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DragonArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class DragonArtifact extends Artifact {
- public DragonArtifact() {
- super(
- "dragon_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.DRAGON_BREATH;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DustArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DustArtifact.java
deleted file mode 100644
index ab491a79..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DustArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class DustArtifact extends Artifact {
- public DustArtifact() {
- super(
- "dust_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.CRIT;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EmeraldArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EmeraldArtifact.java
deleted file mode 100644
index 15299ee9..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EmeraldArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class EmeraldArtifact extends Artifact {
- public EmeraldArtifact() {
- super(
- "emerald_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.COMPOSTER;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EnchantmentArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EnchantmentArtifact.java
deleted file mode 100644
index 57695a44..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EnchantmentArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class EnchantmentArtifact extends Artifact {
- public EnchantmentArtifact() {
- super(
- "enchantment_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.ENCHANTMENT_TABLE;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EndArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EndArtifact.java
deleted file mode 100644
index 7f279b4c..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EndArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class EndArtifact extends Artifact {
- public EndArtifact() {
- super(
- "end_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.END_ROD;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/FireArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/FireArtifact.java
deleted file mode 100644
index 13fb98c5..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/FireArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class FireArtifact extends Artifact {
- public FireArtifact() {
- super(
- "fire_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.FLAME;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/GlowArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/GlowArtifact.java
deleted file mode 100644
index ac682227..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/GlowArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class GlowArtifact extends Artifact {
- public GlowArtifact() {
- super(
- "glow_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.GLOW;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/HeartArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/HeartArtifact.java
deleted file mode 100644
index 105575c9..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/HeartArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class HeartArtifact extends Artifact {
- public HeartArtifact() {
- super(
- "heart_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.HEART;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/HoneyArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/HoneyArtifact.java
deleted file mode 100644
index 227d2e3b..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/HoneyArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class HoneyArtifact extends Artifact {
- public HoneyArtifact() {
- super(
- "honey_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.FALLING_HONEY;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/InkArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/InkArtifact.java
deleted file mode 100644
index 6fea17dc..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/InkArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class InkArtifact extends Artifact {
- public InkArtifact() {
- super(
- "ink_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.SQUID_INK;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/LavaArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/LavaArtifact.java
deleted file mode 100644
index 89bb94c6..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/LavaArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class LavaArtifact extends Artifact {
- public LavaArtifact() {
- super(
- "lava_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.DRIP_LAVA;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/LimeArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/LimeArtifact.java
deleted file mode 100644
index 452f9819..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/LimeArtifact.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Color;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class LimeArtifact extends Artifact {
- public LimeArtifact() {
- super(
- "lime_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.REDSTONE;
- }
-
- @Override
- public Particle.DustOptions getDustOptions() {
- return new Particle.DustOptions(Color.fromRGB(3, 252, 140), 1.0f);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MagicArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MagicArtifact.java
deleted file mode 100644
index 0de89a98..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MagicArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class MagicArtifact extends Artifact {
- public MagicArtifact() {
- super(
- "magic_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.CRIT_MAGIC;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MagmaArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MagmaArtifact.java
deleted file mode 100644
index 520c1cba..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MagmaArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class MagmaArtifact extends Artifact {
- public MagmaArtifact() {
- super(
- "magma_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.LAVA;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MusicArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MusicArtifact.java
deleted file mode 100644
index 4e1984ca..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MusicArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class MusicArtifact extends Artifact {
- public MusicArtifact() {
- super(
- "music_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.NOTE;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/NautilusArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/NautilusArtifact.java
deleted file mode 100644
index 3a8b2ce4..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/NautilusArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class NautilusArtifact extends Artifact {
- public NautilusArtifact() {
- super(
- "nautilus_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.NAUTILUS;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/NetherArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/NetherArtifact.java
deleted file mode 100644
index b7e6a836..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/NetherArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class NetherArtifact extends Artifact {
- public NetherArtifact() {
- super(
- "nether_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.PORTAL;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/RainArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/RainArtifact.java
deleted file mode 100644
index dec3d5fa..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/RainArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class RainArtifact extends Artifact {
- public RainArtifact() {
- super(
- "rain_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.WATER_SPLASH;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/RedstoneArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/RedstoneArtifact.java
deleted file mode 100644
index 75f143b4..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/RedstoneArtifact.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Color;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class RedstoneArtifact extends Artifact {
- public RedstoneArtifact() {
- super(
- "redstone_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.REDSTONE;
- }
-
- @Override
- public Particle.DustOptions getDustOptions() {
- return new Particle.DustOptions(Color.RED, 1.0f);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SlimeArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SlimeArtifact.java
deleted file mode 100644
index 8b96d718..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SlimeArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class SlimeArtifact extends Artifact {
- public SlimeArtifact() {
- super(
- "slime_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.SLIME;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SmokeArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SmokeArtifact.java
deleted file mode 100644
index 1bb67824..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SmokeArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class SmokeArtifact extends Artifact {
- public SmokeArtifact() {
- super(
- "smoke_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.CAMPFIRE_COSY_SMOKE;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SnowArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SnowArtifact.java
deleted file mode 100644
index 009f400f..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SnowArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class SnowArtifact extends Artifact {
- public SnowArtifact() {
- super(
- "snow_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.SNOWBALL;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulArtifact.java
deleted file mode 100644
index df2f4bae..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class SoulArtifact extends Artifact {
- public SoulArtifact() {
- super(
- "soul_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.SOUL;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulFireArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulFireArtifact.java
deleted file mode 100644
index 4604a6ec..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulFireArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class SoulFireArtifact extends Artifact {
- public SoulFireArtifact() {
- super(
- "soul_fire_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.SOUL_FIRE_FLAME;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SparkArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SparkArtifact.java
deleted file mode 100644
index 824f08c5..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SparkArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class SparkArtifact extends Artifact {
- public SparkArtifact() {
- super(
- "spark_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.ELECTRIC_SPARK;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SparkleArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SparkleArtifact.java
deleted file mode 100644
index 917f04da..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SparkleArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class SparkleArtifact extends Artifact {
- public SparkleArtifact() {
- super(
- "sparkle_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.FIREWORKS_SPARK;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SporeArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SporeArtifact.java
deleted file mode 100644
index 529e2d2d..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SporeArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class SporeArtifact extends Artifact {
- public SporeArtifact() {
- super(
- "spore_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.FALLING_SPORE_BLOSSOM;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SweepArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SweepArtifact.java
deleted file mode 100644
index c3cbc353..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SweepArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class SweepArtifact extends Artifact {
- public SweepArtifact() {
- super(
- "sweep_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.SWEEP_ATTACK;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TearArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TearArtifact.java
deleted file mode 100644
index 64ed9ac3..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TearArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class TearArtifact extends Artifact {
- public TearArtifact() {
- super(
- "tear_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.DRIPPING_OBSIDIAN_TEAR;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TotemArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TotemArtifact.java
deleted file mode 100644
index f0a656b6..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TotemArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class TotemArtifact extends Artifact {
- public TotemArtifact() {
- super(
- "totem_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.TOTEM;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/VillagerArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/VillagerArtifact.java
deleted file mode 100644
index f6d76fd6..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/VillagerArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class VillagerArtifact extends Artifact {
- public VillagerArtifact() {
- super(
- "villager_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.VILLAGER_HAPPY;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WarpedArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WarpedArtifact.java
deleted file mode 100644
index 2a746ca5..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WarpedArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class WarpedArtifact extends Artifact {
- public WarpedArtifact() {
- super(
- "warped_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.WARPED_SPORE;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WaterArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WaterArtifact.java
deleted file mode 100644
index 770e34a0..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WaterArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class WaterArtifact extends Artifact {
- public WaterArtifact() {
- super(
- "water_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.DRIP_WATER;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WaxArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WaxArtifact.java
deleted file mode 100644
index b7f59f83..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WaxArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class WaxArtifact extends Artifact {
- public WaxArtifact() {
- super(
- "wax_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.WAX_OFF;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WitchArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WitchArtifact.java
deleted file mode 100644
index 6095fae5..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WitchArtifact.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class WitchArtifact extends Artifact {
- public WitchArtifact() {
- super(
- "witch_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.SPELL_WITCH;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/ZapArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/ZapArtifact.java
deleted file mode 100644
index 81d8654e..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/ZapArtifact.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.artifact;
-
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import org.bukkit.Color;
-import org.bukkit.Particle;
-import org.jetbrains.annotations.NotNull;
-
-public class ZapArtifact extends Artifact {
- public ZapArtifact() {
- super(
- "zap_artifact"
- );
- }
-
- @Override
- public @NotNull Particle getParticle() {
- return Particle.REDSTONE;
- }
-
- @Override
- public Particle.DustOptions getDustOptions() {
- return new Particle.DustOptions(Color.YELLOW, 1.0f);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/BreaklessnessCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/BreaklessnessCurse.java
deleted file mode 100644
index ff191323..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/BreaklessnessCurse.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class BreaklessnessCurse extends EcoEnchant {
- public BreaklessnessCurse() {
- super(
- "breaklessness_curse", EnchantmentType.CURSE
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onDamageBlock(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockDamageEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- event.setCancelled(true);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/CallingCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/CallingCurse.java
deleted file mode 100644
index 18c345f5..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/CallingCurse.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
-
-import com.willfp.eco.core.events.ArmorChangeEvent;
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.eco.util.VectorUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.TimedRunnable;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Monster;
-import org.bukkit.entity.PigZombie;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class CallingCurse extends EcoEnchant implements TimedRunnable {
- private final Map players = new HashMap<>();
- private double distance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance");
-
- public CallingCurse() {
- super(
- "calling_curse", EnchantmentType.CURSE
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return NumberUtils.format(distance);
- }
-
- @EventHandler
- public void onArmorEquip(@NotNull final ArmorChangeEvent event) {
- refresh();
- }
-
- @EventHandler
- public void onPlayerJoin(@NotNull final PlayerJoinEvent event) {
- refresh();
- }
-
- @EventHandler
- public void onPlayerLeave(@NotNull final PlayerQuitEvent event) {
- refresh();
- }
-
- private void refresh() {
- players.clear();
- this.getPlugin().getScheduler().runLater(() -> {
- for (Player player : this.getPlugin().getServer().getOnlinePlayers()) {
- int level = EnchantChecks.getArmorPoints(player, this, 0);
- if (level > 0) {
- if (this.areRequirementsMet(player)) {
- players.put(player, level);
- }
- }
- }
- }, 1);
-
- distance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance");
- }
-
- @Override
- public void run() {
- players.forEach((player, level) -> {
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- for (Entity e : player.getWorld().getNearbyEntities(player.getLocation(), distance, distance, distance)) {
- if (!(e instanceof Monster)) {
- continue;
- }
-
- if (e instanceof PigZombie) {
- ((PigZombie) e).setAngry(true);
- }
-
- ((Monster) e).setTarget(player);
-
- Vector vector = player.getLocation().toVector().clone().subtract(e.getLocation().toVector()).normalize().multiply(0.23d);
-
- if (VectorUtils.isFinite(vector)) {
- e.setVelocity(vector);
- }
- }
- });
- }
-
- @Override
- public long getTime() {
- return this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "repeat-ticks");
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/DecayCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/DecayCurse.java
deleted file mode 100644
index eb37542d..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/DecayCurse.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
-
-import com.willfp.eco.util.DurabilityUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.TimedRunnable;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDropItemEvent;
-import org.bukkit.event.entity.EntityPickupItemEvent;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.Repairable;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-public class DecayCurse extends EcoEnchant implements TimedRunnable {
- private final Set players = new HashSet<>();
- private int amount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- public DecayCurse() {
- super(
- "decay_curse", EnchantmentType.CURSE
- );
- }
-
- @EventHandler
- public void onItemPickup(@NotNull final EntityPickupItemEvent event) {
- if (!(event.getEntity() instanceof Player)) {
- return;
- }
- refreshPlayer((Player) event.getEntity());
- }
-
- @EventHandler
- public void onPlayerJoin(@NotNull final PlayerJoinEvent event) {
- refresh();
- }
-
- @EventHandler
- public void onPlayerLeave(@NotNull final PlayerQuitEvent event) {
- refresh();
- }
-
- @EventHandler
- public void onInventoryDrop(@NotNull final EntityDropItemEvent event) {
- if (!(event.getEntity() instanceof Player)) {
- return;
- }
- refreshPlayer((Player) event.getEntity());
- }
-
- @EventHandler
- public void onInventoryClick(@NotNull final InventoryClickEvent event) {
- if (!(event.getWhoClicked() instanceof Player)) {
- return;
- }
- refreshPlayer((Player) event.getWhoClicked());
- }
-
- private void refresh() {
- players.clear();
- this.getPlugin().getScheduler().runLater(() -> this.getPlugin().getServer().getOnlinePlayers().forEach(player -> {
- if (Arrays.stream(player.getInventory().getContents()).parallel().anyMatch(item -> EnchantChecks.item(item, this))) {
- if (this.areRequirementsMet(player)) {
- players.add(player);
- }
- }
- }), 1);
- amount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "multiplier");
- }
-
- private void refreshPlayer(@NotNull final Player player) {
- players.remove(player);
- if (Arrays.stream(player.getInventory().getContents()).parallel().anyMatch(item -> EnchantChecks.item(item, this))) {
- if (this.areRequirementsMet(player)) {
- players.add(player);
- }
- }
- }
-
- @Override
- public void run() {
- players.forEach((player -> {
- for (ItemStack item : player.getInventory().getContents()) {
- int level = EnchantChecks.getItemLevel(item, this);
- if (level == 0) {
- continue;
- }
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (!(item.getItemMeta() instanceof Repairable)) {
- continue;
- }
-
- if (player.getInventory().getItemInMainHand().equals(item)) {
- continue;
- }
- if (player.getInventory().getItemInOffHand().equals(item)) {
- continue;
- }
- if (player.getItemOnCursor().equals(item)) {
- continue;
- }
-
- DurabilityUtils.damageItemNoBreak(item, amount, player);
- }
- }));
- }
-
- @Override
- public long getTime() {
- return this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "repeat-ticks");
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/FragilityCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/FragilityCurse.java
deleted file mode 100644
index 4fe68cf6..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/FragilityCurse.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
-
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerItemDamageEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-public class FragilityCurse extends EcoEnchant {
- public FragilityCurse() {
- super(
- "fragility_curse", EnchantmentType.CURSE
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return NumberUtils.format((
- this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "minimum-extra-durability")
- + this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "maximum-extra-durability")
- ) / 2D);
- }
-
- @EventHandler
- public void onItemDamage(@NotNull final PlayerItemDamageEvent event) {
- ItemStack item = event.getItem();
-
- if (!EnchantChecks.item(item, this)) {
- return;
- }
-
- if (!this.areRequirementsMet(event.getPlayer())) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(event.getPlayer().getWorld())) {
- return;
- }
-
- int min = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "minimum-extra-durability");
- int max = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "maximum-extra-durability");
-
- event.setDamage(event.getDamage() * NumberUtils.randInt(min, max));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/HarmlessnessCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/HarmlessnessCurse.java
deleted file mode 100644
index 9b261644..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/HarmlessnessCurse.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class HarmlessnessCurse extends EcoEnchant {
- public HarmlessnessCurse() {
- super(
- "harmlessness_curse", EnchantmentType.CURSE
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- event.setDamage(0);
- event.setCancelled(true);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/HungerCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/HungerCurse.java
deleted file mode 100644
index a9081736..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/HungerCurse.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
-
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.FoodLevelChangeEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class HungerCurse extends EcoEnchant {
- public HungerCurse() {
- super(
- "hunger_curse", EnchantmentType.CURSE
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return NumberUtils.format(this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "times-more-hunger"));
- }
-
- @EventHandler
- public void onHunger(@NotNull final FoodLevelChangeEvent event) {
- if (!(event.getEntity() instanceof Player player)) {
- return;
- }
-
- if (!EnchantChecks.helmet(player, this)) {
- return;
- }
-
- if (event.getFoodLevel() > player.getFoodLevel()) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- int delta = player.getFoodLevel() - event.getFoodLevel();
- delta *= this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "times-more-hunger");
-
- event.setFoodLevel(player.getFoodLevel() - delta);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/InaccuracyCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/InaccuracyCurse.java
deleted file mode 100644
index 597d1d58..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/InaccuracyCurse.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
-
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityShootBowEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class InaccuracyCurse extends EcoEnchant {
- public InaccuracyCurse() {
- super(
- "inaccuracy_curse", EnchantmentType.CURSE
- );
- }
-
- @Override
- public void onBowShoot(@NotNull final LivingEntity shooter,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityShootBowEvent event) {
- double spread = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "spread");
-
- Vector velocity = event.getProjectile().getVelocity().clone();
-
- velocity.add(new Vector(NumberUtils.randFloat(-spread, spread), NumberUtils.randFloat(-spread, spread), NumberUtils.randFloat(-spread, spread)));
- event.getProjectile().setVelocity(velocity);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/MisfortuneCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/MisfortuneCurse.java
deleted file mode 100644
index dc3f3d2c..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/MisfortuneCurse.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class MisfortuneCurse extends EcoEnchant {
- public MisfortuneCurse() {
- super(
- "misfortune_curse", EnchantmentType.CURSE
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onBlockBreak(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockBreakEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- event.setDropItems(false);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/PermanenceCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/PermanenceCurse.java
deleted file mode 100644
index d3f354aa..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/PermanenceCurse.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-
-public class PermanenceCurse extends EcoEnchant {
- public PermanenceCurse() {
- super(
- "permanence_curse", EnchantmentType.CURSE
- );
- }
- // Listeners are in anvil listeners
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abattoir.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abattoir.java
deleted file mode 100644
index 64841ac2..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abattoir.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Monster;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Abattoir extends EcoEnchant {
- public Abattoir() {
- super(
- "abattoir", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return NumberUtils.format(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * 100 * (level + 1));
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (victim instanceof Monster) {
- return;
- }
-
- if (victim instanceof Player) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = (multiplier * (level + 1)) + 1;
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abrasion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abrasion.java
deleted file mode 100644
index 40ce5526..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abrasion.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.DurabilityUtils;
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-public class Abrasion extends EcoEnchant {
- public Abrasion() {
- super(
- "abrasion", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return NumberUtils.format(level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity uncastVictim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(uncastVictim instanceof Player victim)) {
- return;
- }
-
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- ArrayList armor = new ArrayList<>(Arrays.asList(victim.getInventory().getArmorContents()));
- if (armor.isEmpty()) {
- return;
- }
-
- for (ItemStack armorPiece : armor) {
- if (armorPiece == null) {
- continue;
- }
-
- DurabilityUtils.damageItem(victim, armorPiece, level);
-
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aerial.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aerial.java
deleted file mode 100644
index ee16b5bc..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aerial.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityShootBowEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Aerial extends EcoEnchant {
- public Aerial() {
- super(
- "aerial", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return NumberUtils.format(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * level * 100);
- }
-
- @Override
- public void onBowShoot(@NotNull final LivingEntity shooter,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityShootBowEvent event) {
- if (!(event.getProjectile() instanceof Arrow)) {
- return;
- }
-
- if (shooter.isOnGround()) {
- return;
- }
-
- event.getProjectile().setMetadata("shot-in-air", this.getPlugin().getMetadataValueFactory().create(true));
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!arrow.hasMetadata("shot-in-air")) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = 1 + (multiplier * level);
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aquatic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aquatic.java
deleted file mode 100644
index 11cd0f7e..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aquatic.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.Material;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Aquatic extends EcoEnchant {
- public Aquatic() {
- super(
- "aquatic", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return NumberUtils.format(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * level * 100);
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!attacker.getLocation().getBlock().getType().equals(Material.WATER)) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double reduction = 1 + (multiplier * level);
- event.setDamage(damage * reduction);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arachnid.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arachnid.java
deleted file mode 100644
index 213e0d62..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arachnid.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Spider;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Arachnid extends EcoEnchant {
- public Arachnid() {
- super(
- "arachnid", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return NumberUtils.format(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * 100 * (level + 1));
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Spider)) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = (multiplier * (level + 1)) + 1;
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arborist.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arborist.java
deleted file mode 100644
index 54f21476..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arborist.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.drops.DropQueue;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.GameMode;
-import org.bukkit.Material;
-import org.bukkit.Tag;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-public class Arborist extends EcoEnchant {
- public Arborist() {
- super(
- "arborist", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onBlockBreak(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockBreakEvent event) {
- if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- if (!Tag.LEAVES.isTagged(block.getType())) {
- return;
- }
-
- event.setDropItems(false);
-
- Material toDrop;
-
- List materials = new ArrayList<>();
-
- for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "items")) {
- Material material = Material.getMaterial(materialName.toUpperCase());
- if (material != null) {
- materials.add(material);
- }
- }
-
- toDrop = materials.get(new Random().nextInt(materials.size()));
-
- if (toDrop == null) {
- toDrop = block.getType();
- }
-
- ItemStack item = new ItemStack(toDrop, 1);
-
- new DropQueue(player)
- .setLocation(block.getLocation())
- .addItem(item)
- .push();
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arcanic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arcanic.java
deleted file mode 100644
index bdffb91a..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arcanic.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Arcanic extends EcoEnchant {
- public Arcanic() {
- super(
- "arcanic", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onDamageWearingArmor(@NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageEvent event) {
- if (!(event.getCause().equals(EntityDamageEvent.DamageCause.POISON) || event.getCause().equals(EntityDamageEvent.DamageCause.WITHER))) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- event.setCancelled(true);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Atmospheric.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Atmospheric.java
deleted file mode 100644
index 6a21f2b8..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Atmospheric.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.ProjectileLaunchEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Atmospheric extends EcoEnchant {
- public Atmospheric() {
- super(
- "atmospheric", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return NumberUtils.format(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * level * 100);
- }
-
- @Override
- public void onTridentLaunch(@NotNull final LivingEntity shooter,
- @NotNull final Trident trident,
- final int level,
- @NotNull final ProjectileLaunchEvent event) {
- if (shooter.isOnGround()) {
- return;
- }
-
- trident.setMetadata("shot-in-air", this.getPlugin().getMetadataValueFactory().create(true));
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!trident.hasMetadata("shot-in-air")) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = 1 + (multiplier * level);
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Backstab.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Backstab.java
deleted file mode 100644
index 372e958a..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Backstab.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Backstab extends EcoEnchant {
- public Backstab() {
- super(
- "backstab", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return NumberUtils.format(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * level * 100);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- Vector pDir = attacker.getLocation().getDirection();
- Vector eDir = victim.getLocation().getDirection();
- double xv = pDir.getX() * eDir.getZ() - pDir.getZ() * eDir.getX();
- double zv = pDir.getX() * eDir.getX() + pDir.getZ() * eDir.getZ();
- double angle = Math.atan2(xv, zv); // Value between -π and +π
- double angleInDegrees = (angle * 180) / Math.PI;
-
- if (angleInDegrees > 60 || angleInDegrees < -32) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = 1 + (multiplier * level);
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Beheading.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Beheading.java
deleted file mode 100644
index e766aa9e..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Beheading.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.drops.DropQueue;
-import com.willfp.eco.core.items.builder.SkullBuilder;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.Material;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDeathEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.SkullMeta;
-import org.jetbrains.annotations.NotNull;
-
-public class Beheading extends EcoEnchant {
- public Beheading() {
- super(
- "beheading", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @EventHandler
- public void onDeath(@NotNull final EntityDeathEvent event) {
- if (event.getEntity().getKiller() == null) {
- return;
- }
-
- Player player = event.getEntity().getKiller();
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- LivingEntity victim = event.getEntity();
-
- if (!EnchantChecks.mainhand(player, this)) {
- return;
- }
-
- int level = EnchantChecks.getMainhandLevel(player, this);
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- ItemStack item;
-
- if (victim instanceof Player) {
- item = new ItemStack(Material.PLAYER_HEAD, 1);
- SkullMeta meta = (SkullMeta) item.getItemMeta();
- assert meta != null;
- meta.setOwningPlayer((Player) victim);
- item.setItemMeta(meta);
- } else {
- item = getHead(event.getEntityType());
- if (item == null) {
- if (event.getEntityType().equals(EntityType.ZOMBIE)) {
- item = new ItemStack(Material.ZOMBIE_HEAD, 1);
- } else if (event.getEntityType().equals(EntityType.SKELETON)) {
- item = new ItemStack(Material.SKELETON_SKULL, 1);
- } else if (event.getEntityType().equals(EntityType.CREEPER)) {
- item = new ItemStack(Material.CREEPER_HEAD, 1);
- } else if (event.getEntityType().equals(EntityType.ENDER_DRAGON)) {
- item = new ItemStack(Material.DRAGON_HEAD, 1);
- } else {
- return;
- }
- }
- }
-
- new DropQueue(player)
- .addItem(item)
- .addXP(event.getDroppedExp())
- .setLocation(victim.getLocation())
- .push();
-
- event.setDroppedExp(0);
- }
-
- private ItemStack getHead(@NotNull final EntityType type) {
- for (String s : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "custom-heads")) {
- String[] split = s.split("::");
- if (type.name().equalsIgnoreCase(split[0])) {
- SkullBuilder builder = new SkullBuilder().setSkullTexture(split[1]);
-
- if (split.length >= 3) {
- builder.setDisplayName(split[2]);
- }
-
- return builder.build();
- }
- }
- return null;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java
deleted file mode 100644
index fdbc0268..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.Material;
-import org.bukkit.Particle;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.HashSet;
-import java.util.Set;
-
-public class BlastMining extends EcoEnchant {
- public BlastMining() {
- super(
- "blast_mining", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onBlockBreak(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockBreakEvent event) {
- if (block.hasMetadata("block-ignore")) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- if (player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) {
- return;
- }
-
- Set toBreak = new HashSet<>();
-
- for (int x = -1; x <= 1; x++) {
- for (int y = -1; y <= 1; y++) {
- for (int z = -1; z <= 1; z++) {
- if (x == 0 && y == 0 && z == 0) {
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "enable-sound")) {
- block.getWorld().createExplosion(block.getLocation().clone().add(0.5, 0.5, 0.5), 0, false);
- } else {
- block.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, block.getLocation().clone().add(0.5, 0.5, 0.5), 1);
- }
- continue;
- }
- Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(x, y, z));
-
- if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) {
- continue;
- }
-
- if (block1.getType().getHardness() > block.getType().getHardness() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "hardness-check")) {
- continue;
- }
-
- if (block1.getType() == Material.AIR) {
- continue;
- }
-
- if (!AntigriefManager.canBreakBlock(player, block1)) {
- continue;
- }
-
- toBreak.add(block1);
- }
- }
- }
-
- AnticheatManager.exemptPlayer(player);
- EnchantmentUtils.rehandleBreaking(player, toBreak, this.getPlugin());
- AnticheatManager.unexemptPlayer(player);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java
deleted file mode 100644
index 400b47c8..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.concurrent.atomic.AtomicInteger;
-
-public class Bleed extends EcoEnchant {
- public Bleed() {
- super(
- "bleed", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- double bleedDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bleed-damage");
-
- int bleedCount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "amount-per-level");
- bleedCount *= level;
- final int finalBleedCount = bleedCount;
-
- AtomicInteger currentBleedCount = new AtomicInteger(0);
-
- this.getPlugin().getRunnableFactory().create(bukkitRunnable -> {
- currentBleedCount.addAndGet(1);
-
- victim.damage(bleedDamage);
-
- if (currentBleedCount.get() >= finalBleedCount) {
- bukkitRunnable.cancel();
- }
- }).runTaskTimer(0, 10);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Blind.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Blind.java
deleted file mode 100644
index 3836c2bb..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Blind.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Blind extends EcoEnchant {
- public Blind() {
- super(
- "blind", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "duration-per-level");
-
- victim.setVelocity(new Vector(0, 0, 0));
- victim.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, duration * level, level));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlockBreather.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlockBreather.java
deleted file mode 100644
index 8a8473a3..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlockBreather.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class BlockBreather extends EcoEnchant {
- public BlockBreather() {
- super(
- "block_breather", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onDamageWearingArmor(@NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageEvent event) {
- if (!event.getCause().equals(EntityDamageEvent.DamageCause.SUFFOCATION)) {
- return;
- }
-
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- event.setCancelled(true);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BossHunter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BossHunter.java
deleted file mode 100644
index a22f6e86..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BossHunter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.NamespacedKey;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Boss;
-import org.bukkit.entity.ElderGuardian;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.persistence.PersistentDataType;
-import org.jetbrains.annotations.NotNull;
-
-@SuppressWarnings("deprecation")
-public class BossHunter extends EcoEnchant {
- public BossHunter() {
- super(
- "boss_hunter", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Boss || victim instanceof ElderGuardian) && !victim.getPersistentDataContainer().has(new NamespacedKey("ecobosses", "boss"), PersistentDataType.STRING)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- double damageMultiplier = (level * multiplier) + 1;
-
- event.setDamage(event.getDamage() * damageMultiplier);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Buckshot.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Buckshot.java
deleted file mode 100644
index 4b4e67b3..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Buckshot.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.Sound;
-import org.bukkit.SoundCategory;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.AbstractArrow;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityShootBowEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Buckshot extends EcoEnchant {
- public Buckshot() {
- super(
- "buckshot", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onBowShoot(@NotNull final LivingEntity shooter,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityShootBowEvent event) {
- this.getPlugin().getScheduler().runLater(1, () -> event.getProjectile().remove());
- if (shooter instanceof Player player) {
- player.playSound(shooter.getLocation(), Sound.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0f, 1.0f);
- }
-
- int number = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "amount-per-level");
- number *= level;
-
- double spread = Math.abs(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "spread-per-level"));
- spread *= level;
-
- if (shooter instanceof Player player) {
- AnticheatManager.exemptPlayer(player);
- }
-
- for (int i = 0; i < number; i++) {
- Vector velocity = event.getProjectile().getVelocity().clone();
-
- velocity.add(new Vector(NumberUtils.randFloat(-spread, spread), NumberUtils.randFloat(-spread, spread), NumberUtils.randFloat(-spread, spread)));
-
- Arrow arrow1 = shooter.launchProjectile(Arrow.class, velocity);
- if (EnchantChecks.mainhand(shooter, Enchantment.ARROW_FIRE)) {
- arrow1.setFireTicks(Integer.MAX_VALUE);
- }
- if (EnchantChecks.mainhand(shooter, EcoEnchants.MARKSMAN)) {
- arrow1.setGravity(false);
- }
- arrow1.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED);
- }
-
- if (shooter instanceof Player player) {
- AnticheatManager.unexemptPlayer(player);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Butchering.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Butchering.java
deleted file mode 100644
index b24a2081..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Butchering.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Monster;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Butchering extends EcoEnchant {
- public Butchering() {
- super(
- "butchering", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (victim instanceof Monster) {
- return;
- }
-
- if (victim instanceof Player) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level");
- event.setDamage(event.getDamage() + (level * multiplier));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cerebral.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cerebral.java
deleted file mode 100644
index 0fe58864..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cerebral.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Cerebral extends EcoEnchant {
- public Cerebral() {
- super(
- "cerebral", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (arrow.getLocation().getY() < victim.getLocation().getY() + victim.getEyeHeight() - 0.22) {
- return;
- }
-
- if (!EnchantChecks.arrow(arrow, this)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- double damageMultiplier = (level * multiplier) + 1;
-
- event.setDamage(event.getDamage() * damageMultiplier);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Chopless.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Chopless.java
deleted file mode 100644
index 2d0f84a6..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Chopless.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Chopless extends EcoEnchant {
- public Chopless() {
- super(
- "chopless", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onDamageWearingArmor(@NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageEvent event) {
- if (victim.getEquipment() == null) {
- return;
- }
-
- if (!victim.getEquipment().getItemInMainHand().getType().toString().endsWith("_AXE")) {
- return;
- }
-
- double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-less-per-level");
-
- double multiplier = 1 - ((reduction / 100) * level);
-
- event.setDamage(event.getDamage() * multiplier);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cleave.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cleave.java
deleted file mode 100644
index 74119832..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cleave.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Cleave extends EcoEnchant {
- public Cleave() {
- super(
- "cleave", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (victim.hasMetadata("cleaved")) {
- return;
- }
-
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- double damagePerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-percentage-per-level") * 0.01;
- double radiusPerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-per-level");
- final double damage = damagePerLevel * level * event.getDamage();
- final double radius = radiusPerLevel * level;
-
- victim.getNearbyEntities(radius, radius, radius).stream()
- .filter(entity -> entity instanceof LivingEntity)
- .filter(entity -> !entity.equals(attacker))
- .forEach(entity -> {
- entity.setMetadata("cleaved", this.getPlugin().getMetadataValueFactory().create(true));
- this.getPlugin().getScheduler().run(() -> ((LivingEntity) entity).damage(damage, attacker));
- this.getPlugin().getScheduler().runLater(() -> entity.removeMetadata("cleaved", this.getPlugin()), 5);
- });
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Collateral.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Collateral.java
deleted file mode 100644
index 4b456406..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Collateral.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityShootBowEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Collateral extends EcoEnchant {
- public Collateral() {
- super(
- "collateral", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onBowShoot(@NotNull final LivingEntity shooter,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityShootBowEvent event) {
- arrow.setPierceLevel(level);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Conclude.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Conclude.java
deleted file mode 100644
index 5e611a02..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Conclude.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Conclude extends EcoEnchant {
- public Conclude() {
- super(
- "conclude", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- double minhealth = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "minimum-health-per-level");
- if (victim.getHealth() > level * minhealth) {
- return;
- }
-
- event.setDamage(30); // cba to do this properly
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Corrosive.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Corrosive.java
deleted file mode 100644
index 0f6a2360..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Corrosive.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.eco.util.DurabilityUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-public class Corrosive extends EcoEnchant {
- public Corrosive() {
- super(
- "corrosive", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity uncastVictim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(uncastVictim instanceof Player victim)) {
- return;
- }
-
- if (attacker instanceof Player player) {
- if (!AntigriefManager.canInjure(player, uncastVictim)) {
- return;
- }
- }
-
- ArrayList armor = new ArrayList<>(Arrays.asList(victim.getInventory().getArmorContents()));
- if (armor.isEmpty()) {
- return;
- }
-
- for (ItemStack armorPiece : armor) {
- if (armorPiece == null) {
- continue;
- }
-
- DurabilityUtils.damageItem(victim, armorPiece, level);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cranial.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cranial.java
deleted file mode 100644
index f6f43ee9..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cranial.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Cranial extends EcoEnchant {
- public Cranial() {
- super(
- "cranial", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (trident.getLocation().getY() < victim.getLocation().getY() + victim.getEyeHeight() - 0.22) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- double damageMultiplier = (level * multiplier) + 1;
-
- event.setDamage(event.getDamage() * damageMultiplier);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Criticals.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Criticals.java
deleted file mode 100644
index 6c42ebe0..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Criticals.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Criticals extends EcoEnchant {
- public Criticals() {
- super(
- "criticals", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return NumberUtils.format(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * 100 * level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(attacker.getFallDistance() > 0 && !attacker.isOnGround())) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "use-additive")) {
- damage = damage / 1.5;
- double bonus = damage * (multiplier * level);
- damage = damage + bonus + damage / 2;
- event.setDamage(damage);
- } else {
- double bonus = 1 + (multiplier * level);
- event.setDamage(damage * bonus);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cubism.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cubism.java
deleted file mode 100644
index 7b1c8bdf..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cubism.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Slime;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Cubism extends EcoEnchant {
- public Cubism() {
- super(
- "cubism", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Slime)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- double damageMultiplier = (level * multiplier) + 1;
-
- event.setDamage(event.getDamage() * damageMultiplier);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Defender.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Defender.java
deleted file mode 100644
index b6adfe03..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Defender.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Tameable;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Defender extends EcoEnchant {
- public Defender() {
- super(
- "defender", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Tameable pet)) {
- return;
- }
-
- if (pet.getOwner() == null) {
- return;
- }
- if (!pet.getOwner().equals(attacker)) {
- return;
- }
-
- event.setCancelled(true);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Deflection.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Deflection.java
deleted file mode 100644
index 912e7fe8..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Deflection.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Deflection extends EcoEnchant {
- public Deflection() {
- super(
- "deflection", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onDeflect(@NotNull final Player blocker,
- @NotNull final LivingEntity attacker,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (blocker.hasMetadata("cleaved") || blocker.hasMetadata("carved")) {
- return;
- }
-
- if (attacker.hasMetadata("cleaved") || attacker.hasMetadata("carved")) {
- return;
- }
- if (attacker.equals(blocker)){
- return;
- }
- double perlevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-deflected-per-level");
- double damagePercent = (perlevel / 100) * level;
- double damage = event.getDamage() * damagePercent;
-
- attacker.damage(damage, attacker);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Defusion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Defusion.java
deleted file mode 100644
index 5b0344cd..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Defusion.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Creeper;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Defusion extends EcoEnchant {
- public Defusion() {
- super(
- "defusion", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Creeper)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level");
- event.setDamage(event.getDamage() + (level * multiplier));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dexterous.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dexterous.java
deleted file mode 100644
index 1cb1e7f3..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dexterous.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.attribute.Attribute;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerItemHeldEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-public class Dexterous extends EcoEnchant {
- public Dexterous() {
- super(
- "dexterous", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onDextHold(@NotNull final PlayerItemHeldEvent event) {
- Player player = event.getPlayer();
- ItemStack item = player.getInventory().getItem(event.getNewSlot());
-
- if (!EnchantChecks.item(item, this)) {
- player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0);
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- int level = EnchantChecks.getItemLevel(item, this);
- double bonus = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "add-speed-per-level");
- player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0 + (level * bonus));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disable.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disable.java
deleted file mode 100644
index 9688d06a..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disable.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Disable extends EcoEnchant {
- public Disable() {
- super(
- "disable", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, level * 10, 5));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disappear.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disappear.java
deleted file mode 100644
index b7538ee6..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disappear.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Disappear extends EcoEnchant {
- public Disappear() {
- super(
- "disappear", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onDamageWearingArmor(@NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageEvent event) {
- this.getPlugin().getScheduler().runLater(() -> {
- if (victim.getHealth() > EcoEnchants.DISAPPEAR.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "threshold")) {
- return;
- }
-
- int ticksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level");
- final int ticks = ticksPerLevel * level;
- victim.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, ticks, 1, false, false, true));
- }, 1);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java
deleted file mode 100644
index 656e20bb..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.World;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Diurnal extends EcoEnchant {
- public Diurnal() {
- super(
- "diurnal", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!attacker.getWorld().getEnvironment().equals(World.Environment.NORMAL)) {
- return;
- }
-
- long time = attacker.getWorld().getTime();
-
- if (time > 12300 && time < 23850) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- event.setDamage(event.getDamage() * (1 + (level * multiplier)));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diverse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diverse.java
deleted file mode 100644
index 02fcd986..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diverse.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Diverse extends EcoEnchant {
- public Diverse() {
- super(
- "diverse", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (victim.getEquipment() == null) {
- return;
- }
-
- if (!victim.getEquipment().getItemInMainHand().getType().toString().endsWith("_SWORD")) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- event.setDamage(event.getDamage() * (1 + (level * multiplier)));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dousing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dousing.java
deleted file mode 100644
index 7b5079a4..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dousing.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.ProjectileHitEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Dousing extends EcoEnchant {
- public Dousing() {
- super(
- "dousing", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onArrowHit(@NotNull final LivingEntity uncastShooter,
- final int level,
- @NotNull final ProjectileHitEvent event) {
- if (!(uncastShooter instanceof Player shooter)) {
- return;
- }
-
- if (event.getHitBlock() == null) {
- return;
- }
-
- if (!AntigriefManager.canBreakBlock(shooter, event.getHitBlock())) {
- return;
- }
-
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- BlockFace face = event.getHitBlockFace();
-
- assert face != null;
-
- Block toIgnite = event.getHitBlock().getRelative(face);
- if (toIgnite.getType().equals(Material.FIRE)) {
- toIgnite.setType(Material.AIR);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java
deleted file mode 100644
index 43a20441..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.eco.util.VectorUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Drill extends EcoEnchant {
- public Drill() {
- super(
- "drill", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onBlockBreak(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockBreakEvent event) {
- if (block.hasMetadata("block-ignore")) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- if (player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) {
- return;
- }
-
- int blocks = level * this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "blocks-per-level");
-
- AnticheatManager.exemptPlayer(player);
-
- for (int i = 1; i <= blocks; i++) {
- Vector simplified = VectorUtils.simplifyVector(player.getLocation().getDirection().normalize()).multiply(i);
- Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(simplified));
- block1.setMetadata("block-ignore", this.getPlugin().getMetadataValueFactory().create(true));
-
- if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) {
- continue;
- }
-
- if (block1.getType().getHardness() > block.getType().getHardness() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "hardness-check")) {
- continue;
- }
-
- if (!AntigriefManager.canBreakBlock(player, block1)) {
- continue;
- }
-
- player.breakBlock(block1);
- block1.removeMetadata("block-ignore", this.getPlugin());
- }
-
- AnticheatManager.unexemptPlayer(player);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dullness.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dullness.java
deleted file mode 100644
index 5a3ef65a..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dullness.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Dullness extends EcoEnchant {
- public Dullness() {
- super(
- "dullness", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- int durationPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "duration-per-level");
-
- victim.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, level * durationPerLevel, level));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dweller.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dweller.java
deleted file mode 100644
index 94e01f1f..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dweller.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Illager;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Dweller extends EcoEnchant {
- public Dweller() {
- super(
- "dweller", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Illager)) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = 1 + (multiplier * level);
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Economical.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Economical.java
deleted file mode 100644
index 8684ffcd..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Economical.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.destroystokyo.paper.event.player.PlayerElytraBoostEvent;
-import com.willfp.eco.core.Prerequisite;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.event.EventHandler;
-import org.jetbrains.annotations.NotNull;
-
-public class Economical extends EcoEnchant {
- public Economical() {
- super(
- "economical", EnchantmentType.NORMAL,
- Prerequisite.HAS_PAPER
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @EventHandler
- public void onElytraBoost(@NotNull final PlayerElytraBoostEvent event) {
- if (!EnchantChecks.chestplate(event.getPlayer(), this)) {
- return;
- }
- if (!EnchantmentUtils.passedChance(this, EnchantChecks.getArmorPoints(event.getPlayer(), this))) {
- return;
- }
- if (this.getDisabledWorlds().contains(event.getPlayer().getWorld())) {
- return;
- }
- if (!this.areRequirementsMet(event.getPlayer())) {
- return;
- }
- event.setShouldConsume(false);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Electroshock.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Electroshock.java
deleted file mode 100644
index fde33d2b..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Electroshock.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.LightningUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Electroshock extends EcoEnchant {
- public Electroshock() {
- super(
- "electroshock", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onDeflect(@NotNull final Player blocker,
- @NotNull final LivingEntity attacker,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage");
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- boolean silent = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "local-lightning-sound");
- LightningUtils.strike(attacker, damage, silent);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/EndInfusion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/EndInfusion.java
deleted file mode 100644
index 8ab7bc46..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/EndInfusion.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.World;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class EndInfusion extends EcoEnchant {
- public EndInfusion() {
- super(
- "end_infusion", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!attacker.getWorld().getEnvironment().equals(World.Environment.THE_END)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- event.setDamage(event.getDamage() * (1 + (level * multiplier)));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/EnderSlayer.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/EnderSlayer.java
deleted file mode 100644
index b414eff4..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/EnderSlayer.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.google.common.collect.ImmutableSet;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Set;
-
-public class EnderSlayer extends EcoEnchant {
- private static final Set END_MOBS = new ImmutableSet.Builder()
- .add(EntityType.ENDERMITE)
- .add(EntityType.ENDERMAN)
- .add(EntityType.ENDER_DRAGON)
- .add(EntityType.SHULKER)
- .build();
-
- public EnderSlayer() {
- super(
- "ender_slayer", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!END_MOBS.contains(victim.getType())) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level");
-
- event.setDamage(event.getDamage() + (level * multiplier));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Enderism.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Enderism.java
deleted file mode 100644
index 757f93ca..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Enderism.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.World;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Enderism extends EcoEnchant {
- public Enderism() {
- super(
- "enderism", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!attacker.getWorld().getEnvironment().equals(World.Environment.THE_END)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- event.setDamage(event.getDamage() * (1 + (level * multiplier)));
- }
-
- @EventHandler
- public void onHit(@NotNull final EntityDamageByEntityEvent event) {
- if (!(event.getDamager() instanceof Arrow arrow)) {
- return;
- }
- if (!(((Arrow) event.getDamager()).getShooter() instanceof Player player)) {
- return;
- }
-
- if (!player.getWorld().getEnvironment().equals(World.Environment.THE_END)) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!EnchantChecks.arrow(arrow, this)) {
- return;
- }
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- int level = EnchantChecks.getArrowLevel(arrow, this);
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- event.setDamage(event.getDamage() * (1 + (level * multiplier)));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Evasion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Evasion.java
deleted file mode 100644
index 7fd8c83c..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Evasion.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Evasion extends EcoEnchant {
- public Evasion() {
- super(
- "evasion", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onDamageWearingArmor(@NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageEvent event) {
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- event.setCancelled(true);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extinguishing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extinguishing.java
deleted file mode 100644
index 39dda6a2..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extinguishing.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Extinguishing extends EcoEnchant {
- public Extinguishing() {
- super(
- "extinguishing", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onDamageWearingArmor(@NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageEvent event) {
- if (!event.getCause().equals(EntityDamageEvent.DamageCause.FIRE_TICK)) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- victim.setFireTicks(0);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extract.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extract.java
deleted file mode 100644
index 4cdb6dcc..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extract.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.attribute.Attribute;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Extract extends EcoEnchant {
- public Extract() {
- super(
- "extract", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level");
- double amountToHeal = level * multiplier;
- double newHealth = attacker.getHealth() + amountToHeal;
- if (newHealth > attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) {
- newHealth = attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
- }
- attacker.setHealth(newHealth);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Famine.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Famine.java
deleted file mode 100644
index a2ed445b..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Famine.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Famine extends EcoEnchant {
- public Famine() {
- super(
- "famine", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, level * this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level"), level));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Farmhand.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Farmhand.java
deleted file mode 100644
index cfa975ff..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Farmhand.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.eco.util.DurabilityUtils;
-import com.willfp.eco.util.VectorUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.block.Action;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Farmhand extends EcoEnchant {
- public Farmhand() {
- super(
- "farmhand", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onTill(@NotNull final PlayerInteractEvent event) {
- Player player = event.getPlayer();
-
- if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
- return;
- }
-
- if (event.getClickedBlock() == null) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!(event.getClickedBlock().getType().equals(Material.DIRT) || event.getClickedBlock().getType().equals(Material.GRASS_BLOCK))) {
- return;
- }
-
- ItemStack item = event.getItem();
-
- if (!EnchantChecks.item(item, this)) {
- return;
- }
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (!item.getType().toString().endsWith("_HOE")) {
- return;
- }
-
- if (!AntigriefManager.canBreakBlock(player, event.getClickedBlock())) {
- return;
- }
-
- event.getClickedBlock().setType(Material.FARMLAND);
- int initial = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "initial-radius");
- int levelrad = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "per-level-radius");
- int radius = initial + (EnchantChecks.getItemLevel(item, this) - 1) * levelrad;
- Vector[] vecs;
-
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "use-cube")) {
- vecs = VectorUtils.getCube(radius);
- } else {
- vecs = VectorUtils.getSquare(radius);
- }
-
- if (!this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "per-block-damage")) {
- DurabilityUtils.damageItem(player, player.getInventory().getItemInMainHand(), 1);
- }
-
- for (Vector vec : vecs) {
- Location loc = event.getClickedBlock().getLocation().add(vec);
- Block block = event.getClickedBlock().getWorld().getBlockAt(loc);
-
- if (!AntigriefManager.canBreakBlock(player, block)) {
- continue;
- }
-
- if (!(block.getType().equals(Material.DIRT) || block.getType().equals(Material.GRASS_BLOCK))) {
- continue;
- }
-
- if (!block.getWorld().getBlockAt(loc.add(0, 1, 0)).getType().equals(Material.AIR)) {
- continue;
- }
-
- block.setType(Material.FARMLAND);
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "per-block-damage")) {
-
- DurabilityUtils.damageItem(player, player.getInventory().getItemInMainHand(), 1);
- }
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fetching.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fetching.java
deleted file mode 100644
index e5d29393..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fetching.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.drops.DropQueue;
-import com.willfp.eco.core.events.EntityDeathByEntityEvent;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Wolf;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Collection;
-
-public class Fetching extends EcoEnchant {
- public Fetching() {
- super(
- "fetching", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler(priority = EventPriority.HIGH)
- public void onWolfKill(@NotNull final EntityDeathByEntityEvent event) {
- LivingEntity entity = event.getVictim();
-
- if (entity instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "not-on-players")) {
- return;
- }
-
- if (!(event.getKiller() instanceof Wolf wolf)) {
- return;
- }
-
- if (!wolf.isTamed() || wolf.getOwner() == null) {
- return;
- }
-
- if (!(wolf.getOwner() instanceof Player player)) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!(EnchantChecks.helmet(player, this))) {
- return;
- }
-
- int xp = event.getXp();
- Collection drops = event.getDrops();
-
- new DropQueue(player)
- .addItems(drops)
- .setLocation(entity.getLocation())
- .addXP(xp)
- .forceTelekinesis()
- .push();
-
- event.getDeathEvent().setDroppedExp(0);
- event.getDeathEvent().getDrops().clear();
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Finality.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Finality.java
deleted file mode 100644
index 993d0bef..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Finality.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Finality extends EcoEnchant {
- public Finality() {
- super(
- "finality", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- double minhealth = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "minimum-health-per-level");
- if (victim.getHealth() > level * minhealth) {
- return;
- }
-
- event.setDamage(30); // cba to do this properly
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Finishing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Finishing.java
deleted file mode 100644
index 07680e10..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Finishing.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Finishing extends EcoEnchant {
- public Finishing() {
- super(
- "finishing", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- double minhealth = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "minimum-health-per-level");
- if (victim.getHealth() > level * minhealth) {
- return;
- }
-
- event.setDamage(30); // cba to do this properly
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/FireAffinity.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/FireAffinity.java
deleted file mode 100644
index c391a209..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/FireAffinity.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class FireAffinity extends EcoEnchant {
- public FireAffinity() {
- super(
- "fire_affinity", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (attacker.getFireTicks() == 0) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = 1 + (multiplier * level);
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/FirstStrike.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/FirstStrike.java
deleted file mode 100644
index 8f2d1671..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/FirstStrike.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.attribute.Attribute;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class FirstStrike extends EcoEnchant {
- public FirstStrike() {
- super(
- "first_strike", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (victim.getHealth() != victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = 1 + (multiplier * level);
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Flinch.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Flinch.java
deleted file mode 100644
index 072035b1..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Flinch.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Flinch extends EcoEnchant {
- public Flinch() {
- super(
- "flinch", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onDeflect(@NotNull final Player blocker,
- @NotNull final LivingEntity attacker,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level");
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- int finalDuration = duration * level;
-
- attacker.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, finalDuration, 1, false, false, false));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Forcefield.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Forcefield.java
deleted file mode 100644
index 1875220e..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Forcefield.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.events.ArmorChangeEvent;
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.TimedRunnable;
-import org.bukkit.entity.Endermite;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Monster;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class Forcefield extends EcoEnchant implements TimedRunnable {
- private final Map players = new HashMap<>();
- private double initialDistance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "initial-distance");
- private double bonus = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level");
- private double damagePerPoint = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level");
-
- public Forcefield() {
- super(
- "forcefield", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onArmorEquip(@NotNull final ArmorChangeEvent event) {
- refresh();
- }
-
- @EventHandler
- public void onPlayerJoin(@NotNull final PlayerJoinEvent event) {
- refresh();
- }
-
- @EventHandler
- public void onPlayerLeave(@NotNull final PlayerQuitEvent event) {
- refresh();
- }
-
- private void refresh() {
- players.clear();
- this.getPlugin().getScheduler().runLater(() -> {
- for (Player player : this.getPlugin().getServer().getOnlinePlayers()) {
- int level = EnchantChecks.getArmorPoints(player, this, 0);
- if (level > 0) {
- if (this.areRequirementsMet(player)) {
- players.put(player, level);
- }
- }
- }
- }, 1);
- initialDistance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "initial-distance");
- bonus = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level");
- damagePerPoint = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level");
- }
-
- @Override
- public void run() {
- new HashMap<>(players).forEach((player, level) -> {
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
- double distance = initialDistance + (level * bonus);
- final double damage = damagePerPoint * level;
-
- for (Entity e : player.getWorld().getNearbyEntities(player.getLocation(), distance, 2.0d, distance)) {
- if (!(e instanceof Monster)) {
- continue;
- }
-
- if (e instanceof Endermite) {
- continue;
- }
-
- if (e.getCustomName() != null || e.isCustomNameVisible()) {
- continue;
- }
-
- ((Monster) e).damage(damage);
-
- double damageChance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-chance");
-
- if (NumberUtils.randFloat(0, 1) < damageChance) {
- EnchantChecks.getArmorPoints(player, this, 1);
- }
- }
- });
- }
-
- @Override
- public long getTime() {
- return this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "repeat-ticks");
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Freerunner.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Freerunner.java
deleted file mode 100644
index a2d576c3..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Freerunner.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Freerunner extends EcoEnchant {
- public Freerunner() {
- super(
- "freerunner", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onFallDamage(@NotNull final LivingEntity faller,
- final int level,
- @NotNull final EntityDamageEvent event) {
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- event.setCancelled(true);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Frozen.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Frozen.java
deleted file mode 100644
index 09703ca3..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Frozen.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Frozen extends EcoEnchant {
- public Frozen() {
- super(
- "frozen", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @EventHandler
- public void onHurt(@NotNull final EntityDamageByEntityEvent event) {
- if (!(event.getEntity() instanceof Player player)) {
- return;
- }
-
- if (!(event.getDamager() instanceof LivingEntity victim)) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- final int points = EnchantChecks.getArmorPoints(player, this, 0);
-
- if (points == 0) {
- return;
- }
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, points)) {
- return;
- }
-
- int divisor = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "points-per-level");
- final int level = (int) Math.ceil((double) points / divisor);
-
- this.getPlugin().getScheduler().runLater(() -> {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, points * 5, level));
- victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, points * 5, level));
- }, 1);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fury.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fury.java
deleted file mode 100644
index 96410c97..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fury.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.VectorUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Monster;
-import org.bukkit.entity.PigZombie;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Fury extends EcoEnchant {
- public Fury() {
- super(
- "fury", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- double distancePerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance-per-level");
- final double distance = distancePerLevel * level;
-
- for (Entity e : victim.getWorld().getNearbyEntities(victim.getLocation(), distance, distance, distance)) {
- if (!(e instanceof Monster)) {
- continue;
- }
-
- if (e instanceof PigZombie) {
- ((PigZombie) e).setAngry(true);
- }
-
- ((Monster) e).setTarget(victim);
-
- Vector vector = attacker.getLocation().toVector().clone().subtract(e.getLocation().toVector()).normalize().multiply(0.23d);
-
- if (VectorUtils.isFinite(vector)) {
- e.setVelocity(vector);
- }
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Goliath.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Goliath.java
deleted file mode 100644
index e7779f6f..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Goliath.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.attribute.Attribute;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Goliath extends EcoEnchant {
- public Goliath() {
- super(
- "goliath", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (victim.getHealth() <= attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) {
- return;
- }
-
- double timesMoreHealth = victim.getHealth() / attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = 1 + (multiplier * level * timesMoreHealth);
- if (bonus - 1 > this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier-cap")) {
- bonus = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier-cap") + 1;
- }
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Graceful.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Graceful.java
deleted file mode 100644
index e0d383a5..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Graceful.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerMoveEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-@SuppressWarnings("deprecation")
-public class Graceful extends EcoEnchant {
- public Graceful() {
- super(
- "graceful", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @EventHandler
- public void onFall(@NotNull final PlayerMoveEvent event) {
- Player player = event.getPlayer();
-
- if (player.isOnGround()) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (player.getVelocity().getY() > -1) {
- return;
- }
-
- if (player.getLocation().clone().add(0, -3, 0).getBlock().getType().equals(Material.AIR)) {
- return;
- }
-
- if (!EnchantChecks.boots(player, this)) {
- return;
- }
-
- int level = EnchantChecks.getBootsLevel(player, this);
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20, 5, false, false, true));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grapple.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grapple.java
deleted file mode 100644
index 8e0da516..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grapple.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.VectorUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Grapple extends EcoEnchant {
- public Grapple() {
- super(
- "grapple", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- double baseMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-multiplier");
- Vector vector = attacker.getLocation().toVector().clone().subtract(victim.getLocation().toVector()).normalize().multiply(level * baseMultiplier);
-
- if (VectorUtils.isFinite(vector)) {
- victim.setVelocity(vector);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/GreenThumb.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/GreenThumb.java
deleted file mode 100644
index 81ac81e2..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/GreenThumb.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.eco.util.DurabilityUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.block.Action;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class GreenThumb extends EcoEnchant {
- public GreenThumb() {
- super(
- "green_thumb", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onInteract(@NotNull final PlayerInteractEvent event) {
- Player player = event.getPlayer();
-
- if (!event.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (event.getClickedBlock() == null) {
- return;
- }
-
- if (!event.getClickedBlock().getType().equals(Material.DIRT)) {
- return;
- }
-
- if (!EnchantChecks.mainhand(player, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (!AntigriefManager.canBreakBlock(player, event.getClickedBlock())) {
- return;
- }
-
- if (!AntigriefManager.canPlaceBlock(player, event.getClickedBlock())) {
- return;
- }
-
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "damage")) {
- DurabilityUtils.damageItem(player, player.getInventory().getItemInMainHand(), 1);
- }
-
- event.getClickedBlock().setType(Material.GRASS_BLOCK);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grit.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grit.java
deleted file mode 100644
index 2fdd2394..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grit.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.eco.util.DurabilityUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.inventory.meta.Damageable;
-import org.jetbrains.annotations.NotNull;
-
-public class Grit extends EcoEnchant {
- public Grit() {
- super(
- "grit", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onGritHurt(@NotNull final EntityDamageByEntityEvent event) {
- if (!(event.getEntity() instanceof Player player)) {
- return;
- }
-
- if (!(event.getDamager() instanceof Player attacker)) {
- return;
- }
-
- if (!this.areRequirementsMet(attacker)) {
- return;
- }
-
- if (!AntigriefManager.canInjure(attacker, player)) {
- return;
- }
-
- int totalGritPoints = EnchantChecks.getArmorPoints(player, this, 0);
-
- if (totalGritPoints == 0) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (!(attacker.getInventory().getItemInMainHand() instanceof Damageable)) {
- return;
- }
-
- int damage = (int) Math.ceil(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * totalGritPoints);
-
- DurabilityUtils.damageItem(attacker, attacker.getInventory().getItemInMainHand(), damage);
- }
-
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hellish.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hellish.java
deleted file mode 100644
index b02b339b..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hellish.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.World;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Hellish extends EcoEnchant {
- public Hellish() {
- super(
- "hellish", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!attacker.getWorld().getEnvironment().equals(World.Environment.NETHER)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- event.setDamage(event.getDamage() * (1 + (level * multiplier)));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hook.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hook.java
deleted file mode 100644
index f6209400..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hook.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.VectorUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Hook extends EcoEnchant {
- public Hook() {
- super(
- "hook", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- double baseMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-multiplier");
- Vector vector = attacker.getLocation().toVector().clone().subtract(victim.getLocation().toVector()).normalize().multiply(level * baseMultiplier);
- if (VectorUtils.isFinite(vector)) {
- victim.setVelocity(vector);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Horde.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Horde.java
deleted file mode 100644
index 9164aefe..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Horde.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Horde extends EcoEnchant {
- public Horde() {
- super(
- "horde", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- double distance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance-per-level") * level;
-
- int entitiesNearby = (int) attacker.getNearbyEntities(distance, distance, distance).stream().filter(entity -> entity instanceof LivingEntity).count();
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier-per-level");
- multiplier = (1 + (level * multiplier * entitiesNearby));
-
- event.setDamage(event.getDamage() * multiplier);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IceShot.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IceShot.java
deleted file mode 100644
index aa808d93..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IceShot.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class IceShot extends EcoEnchant {
- public IceShot() {
- super(
- "ice_shot", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- victim.setVelocity(new Vector(0, 0, 0));
- victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 30, level));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Identify.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Identify.java
deleted file mode 100644
index 51a06410..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Identify.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Identify extends EcoEnchant {
- public Identify() {
- super(
- "identify", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onDeflect(@NotNull final Player blocker,
- @NotNull final LivingEntity attacker,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level");
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- int finalDuration = duration * level;
-
- attacker.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, finalDuration, 1, false, false, false));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Ignite.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Ignite.java
deleted file mode 100644
index 67acefb3..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Ignite.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.ProjectileHitEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Ignite extends EcoEnchant {
- public Ignite() {
- super(
- "ignite", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onArrowHit(@NotNull final LivingEntity uncastShooter,
- final int level,
- @NotNull final ProjectileHitEvent event) {
- if (!(uncastShooter instanceof Player shooter)) {
- return;
- }
-
- if (event.getHitBlock() == null) {
- return;
- }
-
- if (!AntigriefManager.canBreakBlock(shooter, event.getHitBlock())) {
- return;
- }
-
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- BlockFace face = event.getHitBlockFace();
-
- assert face != null;
-
- Block toIgnite = event.getHitBlock().getRelative(face);
- if (toIgnite.getType().equals(Material.AIR)) {
- toIgnite.setType(Material.FIRE);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IllusionAspect.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IllusionAspect.java
deleted file mode 100644
index c6dcd743..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IllusionAspect.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class IllusionAspect extends EcoEnchant {
- public IllusionAspect() {
- super(
- "illusion_aspect", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- victim.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, level * 10 + 15, level));
- victim.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, level * 10 + 15, level));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Impact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Impact.java
deleted file mode 100644
index 902b73b2..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Impact.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Impact extends EcoEnchant {
- public Impact() {
- super(
- "impact", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- event.setDamage(event.getDamage() * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-multiplier"));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Incandescence.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Incandescence.java
deleted file mode 100644
index 286dad61..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Incandescence.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Incandescence extends EcoEnchant {
- public Incandescence() {
- super(
- "incandescence", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onIncandescenceHurt(@NotNull final EntityDamageByEntityEvent event) {
- if (event.getCause() == EntityDamageEvent.DamageCause.THORNS) {
- return;
- }
-
- if (!(event.getEntity() instanceof Player player)) {
- return;
- }
-
- if (!(event.getDamager() instanceof LivingEntity victim)) {
- return;
- }
-
- int totalIncandescencePoints = EnchantChecks.getArmorPoints(player, this);
-
- if (totalIncandescencePoints == 0) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (!AntigriefManager.canInjure(player, victim)) {
- return;
- }
-
- this.getPlugin().getScheduler().runLater(() -> victim.setFireTicks(totalIncandescencePoints
- * this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-point")
- + this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "initial-ticks")),
- 1);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/InfernalTouch.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/InfernalTouch.java
deleted file mode 100644
index 27ababe7..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/InfernalTouch.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.drops.DropQueue;
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.eco.core.tuples.Pair;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.Bukkit;
-import org.bukkit.GameMode;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.block.Container;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.Item;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.block.BlockDropItemEvent;
-import org.bukkit.inventory.FurnaceRecipe;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.Recipe;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-public class InfernalTouch extends EcoEnchant {
- private static final Map> RECIPES = new HashMap<>();
- private static final Set FORTUNE_MATERIALS = new HashSet<>(
- Arrays.asList(
- Material.GOLD_INGOT,
- Material.IRON_INGOT
- )
- );
-
- static {
- Iterator iterator = Bukkit.recipeIterator();
- while (iterator.hasNext()) {
- Recipe recipe = iterator.next();
- if (!(recipe instanceof FurnaceRecipe furnaceRecipe)) {
- continue;
- }
- int xp = (int) Math.ceil(furnaceRecipe.getExperience());
- RECIPES.put(furnaceRecipe.getInput().getType(), new Pair<>(furnaceRecipe.getResult().getType(), xp));
- }
-
- FORTUNE_MATERIALS.add(Material.COPPER_INGOT);
- }
-
- public InfernalTouch() {
- super(
- "infernal_touch", EnchantmentType.NORMAL
- );
- }
-
- @NotNull
- private static Pair getOutput(@NotNull final Material input) {
- Pair toReturn = RECIPES.get(input);
- if (toReturn == null) {
- return new Pair<>(input, 0);
- }
- return toReturn;
- }
-
- @EventHandler
- public void infernalTouchBreak(@NotNull final BlockDropItemEvent event) {
-
- Player player = event.getPlayer();
- Block block = event.getBlock();
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!EnchantChecks.mainhand(player, this)) {
- return;
- }
-
- if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) {
- return;
- }
-
- if (event.getBlockState() instanceof Container) {
- return;
- }
-
- if (event.isCancelled()) {
- return;
- }
-
- if (!AntigriefManager.canBreakBlock(player, block)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- List drops = new ArrayList<>();
-
- for (Item item : event.getItems()) {
- drops.add(item.getItemStack());
- }
-
- int experience = 0;
- int fortune = EnchantChecks.getMainhandLevel(player, Enchantment.LOOT_BONUS_BLOCKS);
-
- for (ItemStack itemStack : drops) {
- Pair out = getOutput(itemStack.getType());
- itemStack.setType(out.getFirst());
- experience += out.getSecond();
-
- if (fortune > 0 && FORTUNE_MATERIALS.contains(itemStack.getType())) {
- itemStack.setAmount((int) Math.round((Math.random() * ((double) fortune - 1)) + 1.1));
- experience++;
- }
- }
-
- if (!this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "drop-xp")) {
- experience = 0;
- }
-
- int i = 0;
- for (Item item : event.getItems()) {
- item.setItemStack(drops.get(i));
- i++;
- }
-
- new DropQueue(player)
- .setLocation(block.getLocation())
- .addXP(experience)
- .push();
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Inferno.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Inferno.java
deleted file mode 100644
index 22353798..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Inferno.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.ProjectileLaunchEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Inferno extends EcoEnchant {
- public Inferno() {
- super(
- "inferno", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onTridentLaunch(@NotNull final LivingEntity shooter,
- @NotNull final Trident trident,
- final int level,
- final @NotNull ProjectileLaunchEvent event) {
- trident.setFireTicks(Integer.MAX_VALUE);
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (trident.getFireTicks() <= 0) {
- return;
- }
-
- victim.setFireTicks(100);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Infuriate.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Infuriate.java
deleted file mode 100644
index 2a2b69db..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Infuriate.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.VectorUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Monster;
-import org.bukkit.entity.PigZombie;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Infuriate extends EcoEnchant {
- public Infuriate() {
- super(
- "infuriate", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onDeflect(@NotNull final Player blocker,
- @NotNull final LivingEntity attacker,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- double distancePerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance-per-level");
- final double distance = distancePerLevel * level;
-
- for (Entity e : attacker.getWorld().getNearbyEntities(attacker.getLocation(), distance, distance, distance)) {
- if (!(e instanceof Monster)) {
- continue;
- }
-
- if (e instanceof PigZombie) {
- ((PigZombie) e).setAngry(true);
- }
-
- ((Monster) e).setTarget(attacker);
-
- Vector vector = attacker.getLocation().toVector().clone().subtract(e.getLocation().toVector()).normalize().multiply(0.23d);
-
- if (VectorUtils.isFinite(vector)) {
- e.setVelocity(vector);
- }
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Insecticide.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Insecticide.java
deleted file mode 100644
index 83457511..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Insecticide.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Spider;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Insecticide extends EcoEnchant {
- public Insecticide() {
- super(
- "insecticide", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Spider)) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = (multiplier * (level + 1)) + 1;
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java
deleted file mode 100644
index 06929c3b..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Instantaneous extends EcoEnchant {
- public Instantaneous() {
- super(
- "instantaneous", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onDamageBlock(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockDamageEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- if (block.getDrops(player.getInventory().getItemInMainHand()).isEmpty()) {
- return;
- }
-
- if (block.getType().getHardness() > 100) {
- return;
- }
-
- List blacklist = new ArrayList<>();
-
- for (String s : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks")) {
- blacklist.add(Material.getMaterial(s));
- }
-
- if (blacklist.contains(block.getType())) {
- return;
- }
-
- AnticheatManager.exemptPlayer(player);
-
- event.setInstaBreak(true);
-
- AnticheatManager.unexemptPlayer(player);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Introversion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Introversion.java
deleted file mode 100644
index 7e7bee50..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Introversion.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Introversion extends EcoEnchant {
- public Introversion() {
- super(
- "introversion", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Player)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level");
- event.setDamage(event.getDamage() + (level * multiplier));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Invigoration.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Invigoration.java
deleted file mode 100644
index 9ae6c67a..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Invigoration.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Invigoration extends EcoEnchant {
- public Invigoration() {
- super(
- "invigoration", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onInvigorationHurt(@NotNull final EntityDamageEvent event) {
- if (!(event.getEntity() instanceof Player player)) {
- return;
- }
-
- if (player.getHealth() > this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "below-health")) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- int totalInvigorationPoints = EnchantChecks.getArmorPoints(player, this, 0);
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (totalInvigorationPoints == 0) {
- return;
- }
-
- double damageReduction = totalInvigorationPoints * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "reduction-multiplier") * 0.01;
- event.setDamage(event.getDamage() * (1 - damageReduction));
- }
-
- @EventHandler
- public void onInvigorationDamage(@NotNull final EntityDamageByEntityEvent event) {
- if (!(event.getDamager() instanceof Player player)) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (player.getHealth() > this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "below-health")) {
- return;
- }
-
- int totalInvigorationPoints = EnchantChecks.getArmorPoints(player, this, 0);
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (totalInvigorationPoints == 0) {
- return;
- }
-
- double damageBonus = totalInvigorationPoints * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-multiplier") * 0.01;
- damageBonus += 1;
- event.setDamage(event.getDamage() * damageBonus);
- }
-
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Kinetic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Kinetic.java
deleted file mode 100644
index 033f3818..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Kinetic.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Kinetic extends EcoEnchant {
- public Kinetic() {
- super(
- "kinetic", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onDamageWearingArmor(@NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageEvent event) {
- if (!event.getCause().equals(EntityDamageEvent.DamageCause.FLY_INTO_WALL)) {
- return;
- }
-
- double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "reduction-per-level");
- double multiplier = 1 - ((reduction / 100) * level);
- event.setDamage(event.getDamage() * multiplier);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Launch.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Launch.java
deleted file mode 100644
index 1e3a25f4..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Launch.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.VelocityChecks;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.block.Action;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Launch extends EcoEnchant {
- public Launch() {
- super(
- "launch", EnchantmentType.NORMAL
- );
- }
-
- // START OF LISTENERS
- @EventHandler
- public void onFireworkUse(@NotNull final PlayerInteractEvent event) {
- if (event.getItem() == null) {
- return;
- }
-
- if (!event.getItem().getType().equals(Material.FIREWORK_ROCKET)) {
- return;
- }
-
- if (!event.getAction().equals(Action.RIGHT_CLICK_AIR)) {
- return;
- }
-
- Player player = event.getPlayer();
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!player.isGliding()) {
- return;
- }
-
- if (!EnchantChecks.chestplate(player, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- int level = EnchantChecks.getChestplateLevel(player, this);
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double boost = 1 + (multiplier * level);
- Vector vector = player.getVelocity().multiply(boost);
-
- if (VelocityChecks.isUnsafeVelocity(vector)) {
- return;
- }
-
- this.getPlugin().getScheduler().run(() -> player.setVelocity(vector));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Leeching.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Leeching.java
deleted file mode 100644
index 36572d15..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Leeching.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.attribute.Attribute;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Leeching extends EcoEnchant {
- public Leeching() {
- super(
- "leeching", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level");
- double amountToHeal = level * multiplier;
- double newHealth = attacker.getHealth() + amountToHeal;
- if (newHealth > attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) {
- newHealth = attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
- }
- attacker.setHealth(newHealth);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lesion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lesion.java
deleted file mode 100644
index a8359a7b..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lesion.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.concurrent.atomic.AtomicInteger;
-
-public class Lesion extends EcoEnchant {
- public Lesion() {
- super(
- "lesion", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- double bleedDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bleed-damage");
-
- int bleedCount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "amount-per-level");
- bleedCount *= level;
- final int finalBleedCount = bleedCount;
-
- AtomicInteger currentBleedCount = new AtomicInteger(0);
-
- this.getPlugin().getRunnableFactory().create(bukkitRunnable -> {
- currentBleedCount.addAndGet(1);
-
- victim.damage(bleedDamage);
-
- if (currentBleedCount.get() >= finalBleedCount) {
- bukkitRunnable.cancel();
- }
- }).runTaskTimer(0, 10);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Levitate.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Levitate.java
deleted file mode 100644
index a9fd3f02..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Levitate.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Levitate extends EcoEnchant {
- public Levitate() {
- super(
- "levitate", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "duration-per-level");
-
- victim.setVelocity(new Vector(0, 0, 0));
- victim.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, duration * level, 0));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/LiquidShot.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/LiquidShot.java
deleted file mode 100644
index 07065e2d..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/LiquidShot.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Blaze;
-import org.bukkit.entity.Enderman;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.MagmaCube;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class LiquidShot extends EcoEnchant {
- public LiquidShot() {
- super(
- "liquid_shot", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Blaze || victim instanceof MagmaCube || victim instanceof Enderman)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- double damageMultiplier = (level * multiplier) + 1;
-
- event.setDamage(event.getDamage() * damageMultiplier);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/LuckyCatch.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/LuckyCatch.java
deleted file mode 100644
index 0a28227c..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/LuckyCatch.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Item;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerFishEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-public class LuckyCatch extends EcoEnchant {
- public LuckyCatch() {
- super(
- "lucky_catch", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @EventHandler
- public void onFish(@NotNull final PlayerFishEvent event) {
- Player player = event.getPlayer();
- ItemStack item = player.getInventory().getItemInMainHand();
-
- if (!EnchantChecks.item(item, this)) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (event.getState() == PlayerFishEvent.State.CAUGHT_ENTITY) {
- return;
- }
-
- int level = EnchantChecks.getItemLevel(item, this);
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- Entity caught = event.getCaught();
-
- if (!(caught instanceof Item caughtItem)) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- caughtItem.getItemStack().setAmount(caughtItem.getItemStack().getAmount() * 2);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java
deleted file mode 100644
index b8701637..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.eco.util.BlockUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-public class Lumberjack extends EcoEnchant {
- private List materials;
-
- public Lumberjack() {
- super(
- "lumberjack", EnchantmentType.NORMAL
- );
- }
-
- @Override
- protected void postUpdate() {
- materials = new ArrayList<>();
- for (String string : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "whitelisted-blocks")) {
- Material match = Material.getMaterial(string.toUpperCase());
- if (match != null) {
- materials.add(match);
- }
- }
- }
-
- @Override
- public void onBlockBreak(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockBreakEvent event) {
- if (block.hasMetadata("block-ignore")) {
- return;
- }
-
- if (player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) {
- return;
- }
-
- if (!materials.contains(block.getType())) {
- return;
- }
-
- int blocksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "blocks-per-level");
- int limit = level * blocksPerLevel;
-
- Set treeBlocks = BlockUtils.getVein(block, materials, limit);
- treeBlocks.removeIf(block1 -> !AntigriefManager.canBreakBlock(player, block1));
-
- AnticheatManager.exemptPlayer(player);
- EnchantmentUtils.rehandleBreaking(player, treeBlocks, this.getPlugin());
- AnticheatManager.unexemptPlayer(player);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Magnetic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Magnetic.java
deleted file mode 100644
index 040ab596..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Magnetic.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.events.ArmorChangeEvent;
-import com.willfp.eco.util.VectorUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.TimedRunnable;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.ExperienceOrb;
-import org.bukkit.entity.Item;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class Magnetic extends EcoEnchant implements TimedRunnable {
- private final Map players = new HashMap<>();
- private double initialDistance = 1;
- private double bonus = 1;
-
- public Magnetic() {
- super(
- "magnetic", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onArmorEquip(@NotNull final ArmorChangeEvent event) {
- refresh();
- }
-
- @EventHandler
- public void onPlayerJoin(@NotNull final PlayerJoinEvent event) {
- refresh();
- }
-
- @EventHandler
- public void onPlayerLeave(@NotNull final PlayerQuitEvent event) {
- refresh();
- }
-
- private void refresh() {
- players.clear();
- this.getPlugin().getScheduler().runLater(() -> this.getPlugin().getServer().getOnlinePlayers().forEach(player -> {
- int level = EnchantChecks.getArmorPoints(player, this, 0);
- if (level > 0) {
- if (this.areRequirementsMet(player)) {
- players.put(player, level);
- }
- }
- }), 1);
- initialDistance = EcoEnchants.MAGNETIC.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "initial-distance");
- bonus = EcoEnchants.MAGNETIC.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level");
- }
-
- @Override
- public void run() {
- players.forEach((player, level) -> {
- double distance = initialDistance + (level * bonus);
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-while-sneaking")) {
- if (player.isSneaking()) {
- return;
- }
- }
-
- for (Entity e : player.getWorld().getNearbyEntities(player.getLocation(), distance, 2.0d, distance)) {
- if (!(e instanceof Item || e instanceof ExperienceOrb)) {
- continue;
- }
-
- if (e instanceof Item && ((Item) e).getPickupDelay() > 0) {
- continue;
- }
-
-
- Vector vector = player.getLocation().toVector().subtract(e.getLocation().toVector()).normalize().multiply(0.1 * level);
-
- if (VectorUtils.isFinite(vector)) {
- e.setVelocity(vector);
- }
- }
- });
- }
-
- @Override
- public long getTime() {
- return this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "repeat-ticks");
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marking.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marking.java
deleted file mode 100644
index a7c42d37..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marking.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Marking extends EcoEnchant {
- public Marking() {
- super(
- "marking", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- int ticksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level");
- int ticks = ticksPerLevel * level;
-
- victim.setMetadata("marked", this.getPlugin().getMetadataValueFactory().create(true));
-
- this.getPlugin().getScheduler().runLater(() -> victim.removeMetadata("marked", this.getPlugin()), ticks);
- }
-
- @EventHandler
- public void onHitWhileMarked(@NotNull final EntityDamageEvent event) {
- if (!(event.getEntity() instanceof LivingEntity victim)) {
- return;
- }
-
- if (!victim.hasMetadata("marked")) {
- return;
- }
-
- event.setDamage(event.getDamage() * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier-while-weak"));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marksman.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marksman.java
deleted file mode 100644
index 4a36b2dc..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marksman.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Projectile;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.ProjectileLaunchEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Marksman extends EcoEnchant {
- public Marksman() {
- super(
- "marksman", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onMarksmanShoot(@NotNull final ProjectileLaunchEvent event) {
- if (!(event.getEntity().getShooter() instanceof Player player)) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!EnchantChecks.mainhand(player, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- Projectile a = event.getEntity();
- a.setGravity(false);
-
- int ticks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "remove-arrow-after-ticks");
-
- this.getPlugin().getScheduler().runLater(() -> {
- if (!a.isOnGround()) {
- a.remove();
- }
- }, ticks);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Necrotic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Necrotic.java
deleted file mode 100644
index 79040fee..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Necrotic.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.drops.DropQueue;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import com.willfp.ecoenchants.enchantments.util.WeakMetadata;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.WitherSkeleton;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDeathEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-public class Necrotic extends EcoEnchant {
- public Necrotic() {
- super(
- "necrotic", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @EventHandler
- public void necroticKill(@NotNull final EntityDeathEvent event) {
- if (event.getEntity().getKiller() == null) {
- return;
- }
-
- if (!(event.getEntity() instanceof WitherSkeleton victim)) {
- return;
- }
-
- Player player = event.getEntity().getKiller();
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!EnchantChecks.mainhand(player, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- int level = EnchantChecks.getMainhandLevel(player, this);
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- if (WeakMetadata.SUMMONED_ENTITY_MEMORY.containsKey(event.getEntity())) {
- return;
- }
-
- ItemStack item = new ItemStack(Material.WITHER_SKELETON_SKULL, 1);
-
- new DropQueue(player)
- .addItem(item)
- .setLocation(victim.getLocation())
- .addXP(event.getDroppedExp())
- .push();
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/NetherInfusion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/NetherInfusion.java
deleted file mode 100644
index 5b3e737b..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/NetherInfusion.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.World;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class NetherInfusion extends EcoEnchant {
- public NetherInfusion() {
- super(
- "nether_infusion", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!attacker.getWorld().getEnvironment().equals(World.Environment.NETHER)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- event.setDamage(event.getDamage() * (1 + (level * multiplier)));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Netheric.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Netheric.java
deleted file mode 100644
index 106d5718..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Netheric.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.World;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Netheric extends EcoEnchant {
- public Netheric() {
- super(
- "netheric", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!attacker.getWorld().getEnvironment().equals(World.Environment.NETHER)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- event.setDamage(event.getDamage() * (1 + (level * multiplier)));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Nocturnal.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Nocturnal.java
deleted file mode 100644
index 0d3818f4..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Nocturnal.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.World;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Nocturnal extends EcoEnchant {
- public Nocturnal() {
- super(
- "nocturnal", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!attacker.getWorld().getEnvironment().equals(World.Environment.NORMAL)) {
- return;
- }
-
- if (!(attacker.getWorld().getTime() > 12300 && attacker.getWorld().getTime() < 23850)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- event.setDamage(event.getDamage() * (1 + (level * multiplier)));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Optics.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Optics.java
deleted file mode 100644
index cbbd8210..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Optics.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.Location;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Optics extends EcoEnchant {
- public Optics() {
- super(
- "optics", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- Location land = arrow.getLocation();
- Location source = attacker.getLocation();
-
- double distance = land.distance(source);
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "block-multiplier");
-
- double damageMultiplier = (distance * level * multiplier) + 1;
-
- event.setDamage(event.getDamage() * damageMultiplier);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Oxygenate.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Oxygenate.java
deleted file mode 100644
index e7c57194..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Oxygenate.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Oxygenate extends EcoEnchant {
- public Oxygenate() {
- super(
- "oxygenate", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onBlockBreak(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockBreakEvent event) {
- if (player.getRemainingAir() == player.getMaximumAir()) {
- return;
- }
-
- int oxygenLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "oxygen-per-level");
- int oxygen = level * oxygenLevel;
- int newOxygen = player.getRemainingAir() + oxygen;
- newOxygen = Math.min(newOxygen, player.getMaximumAir());
-
- player.setRemainingAir(newOxygen);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Pacify.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Pacify.java
deleted file mode 100644
index 57ffccc7..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Pacify.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Creeper;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Pacify extends EcoEnchant {
- public Pacify() {
- super(
- "pacify", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Creeper)) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = (multiplier * (level + 1)) + 1;
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Paladin.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Paladin.java
deleted file mode 100644
index 971b4bb7..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Paladin.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Horse;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Paladin extends EcoEnchant {
- public Paladin() {
- super(
- "paladin", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(attacker.getVehicle() instanceof Horse)) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = 1 + (multiplier * level);
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Paralyze.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Paralyze.java
deleted file mode 100644
index 3bd3ca4d..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Paralyze.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Paralyze extends EcoEnchant {
- public Paralyze() {
- super(
- "paralyze", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onDeflect(@NotNull final Player blocker,
- @NotNull final LivingEntity attacker,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level");
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- int finalDuration = duration * level;
-
- attacker.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, finalDuration, 10, false, false, false));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parasitic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parasitic.java
deleted file mode 100644
index f38e7f9f..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parasitic.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.attribute.Attribute;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Parasitic extends EcoEnchant {
- public Parasitic() {
- super(
- "parasitic", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level");
- double amountToHeal = level * multiplier;
- double newHealth = attacker.getHealth() + amountToHeal;
- if (newHealth > attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) {
- newHealth = attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
- }
-
- if (attacker.getHealth() > 0) {
- attacker.setHealth(newHealth);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parry.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parry.java
deleted file mode 100644
index e46c23ea..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parry.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Parry extends EcoEnchant {
- public Parry() {
- super(
- "parry", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void parryHit(@NotNull final EntityDamageByEntityEvent event) {
- if (!(event.getEntity() instanceof Player player)) {
- return;
- }
-
- if (event.isCancelled()) {
- return;
- }
-
- if (!EnchantChecks.mainhand(player, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- int level = EnchantChecks.getMainhandLevel(player, this);
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = 1 - (multiplier * level);
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Phantasm.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Phantasm.java
deleted file mode 100644
index 7e4253cc..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Phantasm.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Skeleton;
-import org.bukkit.entity.Trident;
-import org.bukkit.entity.Zombie;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Phantasm extends EcoEnchant {
- public Phantasm() {
- super(
- "phantasm", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Zombie || victim instanceof Skeleton)) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = (multiplier * (level + 1)) + 1;
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Plasmic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Plasmic.java
deleted file mode 100644
index 707cfc8a..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Plasmic.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.Material;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.inventory.EntityEquipment;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Arrays;
-
-public class Plasmic extends EcoEnchant {
- private static final Material[] ITEMS;
-
- static {
- ITEMS = new Material[]{
- Material.DIAMOND_HELMET,
- Material.DIAMOND_CHESTPLATE,
- Material.DIAMOND_LEGGINGS,
- Material.DIAMOND_BOOTS,
-
- Material.NETHERITE_HELMET,
- Material.NETHERITE_CHESTPLATE,
- Material.NETHERITE_LEGGINGS,
- Material.NETHERITE_BOOTS
- };
- }
-
- public Plasmic() {
- super(
- "plasmic", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- EntityEquipment equipment = victim.getEquipment();
- if (equipment == null) {
- return;
- }
-
- int pieces = 0;
- for (ItemStack armorPiece : equipment.getArmorContents()) {
- if (armorPiece == null) {
- continue;
- }
- if (Arrays.asList(ITEMS).contains(armorPiece.getType())) {
- pieces++;
- }
- }
-
- if (pieces == 0) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- event.setDamage(event.getDamage() * (1 + (level * multiplier * pieces)));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Protector.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Protector.java
deleted file mode 100644
index 290f46ef..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Protector.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Tameable;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Protector extends EcoEnchant {
- public Protector() {
- super(
- "protector", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity uncastVictim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(uncastVictim instanceof Tameable victim)) {
- return;
- }
-
- if (victim.getOwner() == null) {
- return;
- }
- if (!victim.getOwner().equals(attacker)) {
- return;
- }
-
- event.setCancelled(true);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Proximity.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Proximity.java
deleted file mode 100644
index bea9edb4..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Proximity.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Proximity extends EcoEnchant {
- public Proximity() {
- super(
- "proximity", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!attacker.getWorld().equals(victim.getWorld())) {
- return;
- }
-
- double distance = attacker.getLocation().distance(victim.getLocation());
-
- double decreaseAfter = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "when-closer-than-blocks");
-
- if (distance > decreaseAfter) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = 1 + (multiplier * level);
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Puncture.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Puncture.java
deleted file mode 100644
index 4384c74e..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Puncture.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Shulker;
-import org.bukkit.entity.Trident;
-import org.bukkit.entity.Turtle;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Puncture extends EcoEnchant {
- public Puncture() {
- super(
- "puncture", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Turtle || victim instanceof Shulker)) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = 1 + (multiplier * level);
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Quadrilateralism.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Quadrilateralism.java
deleted file mode 100644
index 414691ec..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Quadrilateralism.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Slime;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Quadrilateralism extends EcoEnchant {
- public Quadrilateralism() {
- super(
- "quadrilateralism", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Slime)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- double damageMultiplier = (level * multiplier) + 1;
-
- event.setDamage(event.getDamage() * damageMultiplier);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Radiance.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Radiance.java
deleted file mode 100644
index 879c7897..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Radiance.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Radiance extends EcoEnchant {
- public Radiance() {
- super(
- "radiance", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- double radius = level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-multiplier");
- int duration = level * this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "duration-per-level");
-
- for (Entity e : arrow.getNearbyEntities(radius, radius, radius)) {
- if (e.hasMetadata("NPC")) {
- continue;
- }
-
- if (!(e instanceof LivingEntity entity)) {
- continue;
- }
-
- if (e.equals(attacker)) {
- continue;
- }
-
- entity.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, duration, 0, false, false, false));
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rage.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rage.java
deleted file mode 100644
index ba154cf2..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rage.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.VectorUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Monster;
-import org.bukkit.entity.PigZombie;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Rage extends EcoEnchant {
- public Rage() {
- super(
- "rage", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- double distancePerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance-per-level");
- final double distance = distancePerLevel * level;
-
- for (Entity e : victim.getWorld().getNearbyEntities(victim.getLocation(), distance, distance, distance)) {
- if (!(e instanceof Monster)) {
- continue;
- }
-
- if (e instanceof PigZombie) {
- ((PigZombie) e).setAngry(true);
- }
-
- ((Monster) e).setTarget(victim);
-
- Vector vector = attacker.getLocation().toVector().clone().subtract(e.getLocation().toVector()).normalize().multiply(0.23d);
-
- if (VectorUtils.isFinite(vector)) {
- e.setVelocity(vector);
- }
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rapid.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rapid.java
deleted file mode 100644
index e1225eec..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rapid.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityShootBowEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Rapid extends EcoEnchant {
- public Rapid() {
- super(
- "rapid", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onBowShoot(@NotNull final LivingEntity shooter,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityShootBowEvent event) {
- if (shooter instanceof Player player) {
- AnticheatManager.exemptPlayer(player);
- }
- double multiplier = 1 - ((this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-faster-per-level") / 100) * level);
-
- if (event.getForce() < multiplier) {
- return;
- }
-
- double force = 1 / event.getForce();
- event.getProjectile().setVelocity(event.getProjectile().getVelocity().multiply(force));
-
- if (shooter instanceof Player player) {
- AnticheatManager.unexemptPlayer(player);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reaper.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reaper.java
deleted file mode 100644
index 2b7ef38e..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reaper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-
-public class Reaper extends EcoEnchant {
- public Reaper() {
- super(
- "reaper", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- // Actual code is in soulbound.
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rebounding.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rebounding.java
deleted file mode 100644
index f0dbf63d..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rebounding.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.VectorUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Rebounding extends EcoEnchant {
- public Rebounding() {
- super(
- "rebounding", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onDamage(@NotNull final EntityDamageByEntityEvent event) {
- if (!(event.getEntity() instanceof LivingEntity victim)) {
- return;
- }
-
- if (!(event.getDamager() instanceof LivingEntity attacker)) {
- return;
- }
-
- if (event.isCancelled()) {
- return;
- }
-
- if (!this.areRequirementsMet(victim)) {
- return;
- }
-
- int level = EnchantChecks.getArmorPoints(victim, this);
-
- if (level == 0) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(attacker.getWorld())) {
- return;
- }
-
- Vector vector = attacker.getLocation().toVector().clone().subtract(victim.getLocation().toVector()).normalize()
- .multiply((level * (this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-multiplier") - 1)) + 1);
-
- if (!VectorUtils.isFinite(vector)) {
- return;
- }
-
- vector.setY(0.2);
-
- if (!VectorUtils.isFinite(vector)) {
- return;
- }
-
- attacker.setVelocity(vector);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reel.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reel.java
deleted file mode 100644
index f6770f32..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reel.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.eco.util.VectorUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerFishEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Reel extends EcoEnchant {
- public Reel() {
- super(
- "reel", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onFish(@NotNull final PlayerFishEvent event) {
- if (!event.getState().equals(PlayerFishEvent.State.CAUGHT_ENTITY)) {
- return;
- }
-
- if (!(event.getCaught() instanceof LivingEntity victim)) {
- return;
- }
-
- Player player = event.getPlayer();
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (victim.hasMetadata("NPC")) {
- return;
- }
-
- if (!AntigriefManager.canInjure(player, victim)) {
- return;
- }
-
- if (!EnchantChecks.mainhand(player, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- int level = EnchantChecks.getMainhandLevel(player, this);
-
- double baseMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-multiplier");
- Vector vector = player.getLocation().toVector().clone().subtract(victim.getLocation().toVector()).normalize().multiply(level * baseMultiplier);
- if (VectorUtils.isFinite(vector)) {
- victim.setVelocity(vector);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reinforcement.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reinforcement.java
deleted file mode 100644
index ad4bc6d8..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reinforcement.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Reinforcement extends EcoEnchant {
- public Reinforcement() {
- super(
- "reinforcement", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onDamageWearingArmor(@NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageEvent event) {
- if (event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) {
- return;
- }
-
- double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "reduction-per-level");
- double multiplier = 1 - ((reduction / 100) * level);
- event.setDamage(event.getDamage() * multiplier);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rejuvenation.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rejuvenation.java
deleted file mode 100644
index 596a0438..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rejuvenation.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityRegainHealthEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Rejuvenation extends EcoEnchant {
- public Rejuvenation() {
- super(
- "rejuvenation", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onRejuvenationHeal(@NotNull final EntityRegainHealthEvent event) {
- if (!(event.getEntity() instanceof Player player)) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!event.getRegainReason().equals(EntityRegainHealthEvent.RegainReason.SATIATED) && !event.getRegainReason().equals(EntityRegainHealthEvent.RegainReason.REGEN)) {
- return;
- }
-
- int totalRejuvenationPoints = EnchantChecks.getArmorPoints(player, this, 0);
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (totalRejuvenationPoints == 0) {
- return;
- }
-
- double amount = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "per-point-multiplier");
- amount = amount * totalRejuvenationPoints;
- amount += 1;
-
- event.setAmount(event.getAmount() * amount);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.java
deleted file mode 100644
index 3165660a..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.block.data.Ageable;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Replenish extends EcoEnchant {
- public Replenish() {
- super(
- "replenish", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onBlockBreak(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockBreakEvent event) {
- Material type = block.getType();
-
- if (!(block.getBlockData() instanceof Ageable data)) {
- return;
- }
-
- if (block.getType() == Material.GLOW_BERRIES || block.getType() == Material.SWEET_BERRY_BUSH) {
- return;
- }
-
- if (block.getType() == Material.CACTUS || block.getType() == Material.BAMBOO) {
- return;
- }
-
- if (block.getType() == Material.CHORUS_FLOWER || block.getType() == Material.SUGAR_CANE) {
- return;
- }
-
-
- if (data.getAge() != data.getMaximumAge()) {
- event.setDropItems(false);
- event.setExpToDrop(0);
-
- data.setAge(0);
-
- this.getPlugin().getScheduler().runLater(() -> {
- block.setType(type);
- block.setBlockData(data);
- }, 1);
- }
-
- data.setAge(0);
-
- this.getPlugin().getScheduler().runLater(() -> {
- block.setType(type);
- block.setBlockData(data);
- }, 1);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Respirator.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Respirator.java
deleted file mode 100644
index 48b0c627..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Respirator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Respirator extends EcoEnchant {
- public Respirator() {
- super(
- "respirator", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onDamageWearingArmor(@NotNull final LivingEntity victim,
- final int level,
- final @NotNull EntityDamageEvent event) {
- if (!event.getCause().equals(EntityDamageEvent.DamageCause.DRAGON_BREATH)) {
- return;
- }
-
- double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-less-per-level");
-
- double multiplier = 1 - ((reduction / 100) * level);
-
- event.setDamage(event.getDamage() * multiplier);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Revenant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Revenant.java
deleted file mode 100644
index a214959f..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Revenant.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Skeleton;
-import org.bukkit.entity.Zombie;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Revenant extends EcoEnchant {
- public Revenant() {
- super(
- "revenant", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Zombie || victim instanceof Skeleton)) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = (multiplier * (level + 1)) + 1;
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sating.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sating.java
deleted file mode 100644
index a2db6c61..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sating.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.FoodLevelChangeEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Sating extends EcoEnchant {
- public Sating() {
- super(
- "sating", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @EventHandler
- public void onSatingHunger(@NotNull final FoodLevelChangeEvent event) {
- if (!(event.getEntity() instanceof Player player)) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!EnchantChecks.helmet(player, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (event.getFoodLevel() > player.getFoodLevel()) {
- return;
- }
-
- int level = EnchantChecks.getHelmetLevel(player, this);
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- event.setCancelled(true);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Serrated.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Serrated.java
deleted file mode 100644
index ef3ec479..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Serrated.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Serrated extends EcoEnchant {
- public Serrated() {
- super(
- "serrated", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = 1 + (multiplier * level);
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Settle.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Settle.java
deleted file mode 100644
index c744f4fb..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Settle.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Creeper;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Settle extends EcoEnchant {
- public Settle() {
- super(
- "settle", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Creeper)) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = (multiplier * (level + 1)) + 1;
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Shockwave.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Shockwave.java
deleted file mode 100644
index 86b5d6c3..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Shockwave.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.AbstractArrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.ProjectileLaunchEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-public class Shockwave extends EcoEnchant {
- public Shockwave() {
- super(
- "shockwave", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onShoot(@NotNull final ProjectileLaunchEvent event) {
- if (!(event.getEntity() instanceof AbstractArrow entity)) {
- return;
- }
-
- if (!(event.getEntity().getShooter() instanceof Player player)) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- ItemStack item = player.getInventory().getItemInMainHand();
- if (entity instanceof Trident trident) {
- item = trident.getItem();
- }
-
- if (!EnchantChecks.item(item, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- int ticks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "particle-tick-delay");
-
- int level = EnchantChecks.getMainhandLevel(player, this);
- double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level");
- damage *= level;
- final double finalDamage = damage;
-
- this.getPlugin().getRunnableFactory().create(runnable -> {
- if (entity.isOnGround() || entity.isInBlock() || entity.isDead()) {
- runnable.cancel();
- }
- entity.getNearbyEntities(1.5, 1.5, 1.5).stream()
- .filter(entity1 -> entity1 instanceof LivingEntity)
- .filter(entity1 -> entity1 != player)
- .filter(entity1 -> !entity1.hasMetadata("shockwaved"))
- .filter(entity1 -> AntigriefManager.canInjure(player, (LivingEntity) entity1))
- .forEach((mob -> {
- ((LivingEntity) mob).damage(finalDamage, entity);
- mob.setMetadata("shockwaved", this.getPlugin().getMetadataValueFactory().create(true));
- this.getPlugin().getScheduler().runLater(() -> mob.removeMetadata("shockwaved", this.getPlugin()), 10);
- }
- ));
- }).runTaskTimer(4, ticks);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/ShotAssist.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/ShotAssist.java
deleted file mode 100644
index f1fb87e3..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/ShotAssist.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class ShotAssist extends EcoEnchant {
- public ShotAssist() {
- super(
- "shot_assist", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onHit(@NotNull final EntityDamageByEntityEvent event) {
- if (!(event.getDamager() instanceof Arrow)) {
- return;
- }
-
- if (!(((Arrow) event.getDamager()).getShooter() instanceof Player player)) {
- return;
- }
-
- if (!(event.getEntity() instanceof LivingEntity)) {
- return;
- }
-
- if (event.isCancelled()) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- assert player != null;
-
- int points = EnchantChecks.getArmorPoints(player, this, 0);
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (points == 0) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double reduction = 1 + (multiplier * points);
- event.setDamage(damage * reduction);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sickening.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sickening.java
deleted file mode 100644
index 7677fd0b..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sickening.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Sickening extends EcoEnchant {
- public Sickening() {
- super(
- "sickening", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "duration-per-level");
-
- victim.setVelocity(new Vector(0, 0, 0));
- victim.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, duration * level, level));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slaughter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slaughter.java
deleted file mode 100644
index 22f9ac78..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slaughter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Monster;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Slaughter extends EcoEnchant {
- public Slaughter() {
- super(
- "slaughter", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (victim instanceof Monster) {
- return;
- }
-
- if (victim instanceof Player) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = (multiplier * (level + 1)) + 1;
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slicing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slicing.java
deleted file mode 100644
index 0431ace1..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slicing.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.DurabilityUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerMoveEvent;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-
-public class Slicing extends EcoEnchant {
- private final ArrayList entities = new ArrayList<>();
-
- public Slicing() {
- super(
- "slicing", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onPlayerCollide(@NotNull final PlayerMoveEvent event) {
- Player player = event.getPlayer();
-
- if (!player.isGliding()) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!EnchantChecks.chestplate(player, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- for (Entity entity : player.getNearbyEntities(1, 1, 1)) {
- LivingEntity victim;
- if (entity instanceof LivingEntity) {
- victim = (LivingEntity) entity;
- } else {
- continue;
- }
-
- if (entities.contains(victim)) {
- continue;
- }
-
- double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level");
- int level = EnchantChecks.getChestplateLevel(player, this);
- victim.damage(level * damage, player);
- entities.add(victim);
-
- Bukkit.getServer().getScheduler().runTaskLater(this.getPlugin(), () -> entities.remove(victim), this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "cooldown"));
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "damage-elytra")) {
- DurabilityUtils.damageItem(player, player.getInventory().getChestplate(), 1);
- }
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spearfishing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spearfishing.java
deleted file mode 100644
index cd3e6ddb..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spearfishing.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.drops.DropQueue;
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.Material;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.ProjectileHitEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Random;
-
-public class Spearfishing extends EcoEnchant {
- public Spearfishing() {
- super(
- "spearfishing", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @EventHandler
- public void onSpearfishingLand(@NotNull final ProjectileHitEvent event) {
- if (event.getEntityType() != EntityType.TRIDENT) {
- return;
- }
-
- if (!(event.getEntity().getShooter() instanceof Player player)) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!(event.getEntity() instanceof Trident trident)) {
- return;
- }
-
- if (!trident.getWorld().getBlockAt(trident.getLocation().add(0, 0.2, 0)).getType().equals(Material.WATER)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- ItemStack item = trident.getItem();
-
- if (!EnchantChecks.item(item, this)) {
- return;
- }
-
- int level = EnchantChecks.getItemLevel(item, this);
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- List potentialDrops = new ArrayList<>();
- this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "drops").forEach(material -> {
- potentialDrops.add(Material.getMaterial(material.toUpperCase()));
- });
-
- Collections.shuffle(potentialDrops, new Random(NumberUtils.randInt(0, 100000)));
- ItemStack drop = new ItemStack(potentialDrops.get(0), 1);
-
- if (EnchantChecks.item(item, EcoEnchants.TELEKINESIS)) {
- new DropQueue(player)
- .addItem(drop)
- .setLocation(trident.getLocation())
- .forceTelekinesis()
- .push();
- } else {
- new DropQueue(player)
- .addItem(drop)
- .setLocation(trident.getLocation())
- .push();
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spiked.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spiked.java
deleted file mode 100644
index cf5347eb..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spiked.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerFishEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Spiked extends EcoEnchant {
- public Spiked() {
- super(
- "spiked", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onFish(@NotNull final PlayerFishEvent event) {
- if (!event.getState().equals(PlayerFishEvent.State.CAUGHT_ENTITY)) {
- return;
- }
-
- if (!(event.getCaught() instanceof LivingEntity victim)) {
- return;
- }
-
- Player player = event.getPlayer();
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (victim.hasMetadata("NPC")) {
- return;
- }
-
- if (!AntigriefManager.canInjure(player, victim)) {
- return;
- }
-
- if (!EnchantChecks.mainhand(player, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- int level = EnchantChecks.getMainhandLevel(player, this);
-
- double damagePerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level");
- double damage = damagePerLevel * level;
- victim.damage(damage, player);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Splash.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Splash.java
deleted file mode 100644
index 8d0699ee..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Splash.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.entity.ProjectileHitEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-@SuppressWarnings("deprecation")
-public class Splash extends EcoEnchant {
- public Splash() {
- super(
- "splash", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onTridentHit(@NotNull final LivingEntity shooter,
- final int level,
- @NotNull final ProjectileHitEvent event) {
- Trident trident = (Trident) event.getEntity();
-
- ItemStack item = trident.getItem();
-
- if (!EnchantChecks.item(item, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(shooter.getWorld())) {
- return;
- }
-
- double radius = level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-multiplier");
- double damage = level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level");
-
- for (Entity victim : trident.getNearbyEntities(radius, radius, radius)) {
- if (victim.hasMetadata("NPC")) {
- continue;
- }
-
- if (!(victim instanceof LivingEntity entity)) {
- continue;
- }
-
- if (victim.equals(shooter)) {
- continue;
- }
-
- Bukkit.getPluginManager().callEvent(new EntityDamageByEntityEvent(trident, entity, EntityDamageEvent.DamageCause.ENTITY_ATTACK, damage));
-
- if (shooter instanceof Player) {
- if (!AntigriefManager.canInjure((Player) shooter, entity)) {
- continue;
- }
- }
-
- entity.damage(damage, trident);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stab.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stab.java
deleted file mode 100644
index d1a15d96..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stab.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Stab extends EcoEnchant {
- public Stab() {
- super(
- "stab", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- double baseDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-base");
- double perLevelDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level");
- double damage = baseDamage + (level * perLevelDamage);
-
- event.setDamage(event.getDamage() + damage);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stalwart.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stalwart.java
deleted file mode 100644
index 1e3858b3..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stalwart.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Stalwart extends EcoEnchant {
- public Stalwart() {
- super(
- "stalwart", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onDamageWearingArmor(@NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "duration-per-level");
- duration *= level;
-
- int amplifier = (int) Math.ceil((double) level / 4) - 1;
-
- victim.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, duration, amplifier, false, false, true));
-
- event.setCancelled(true);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stamina.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stamina.java
deleted file mode 100644
index fb563bbe..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stamina.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.FoodLevelChangeEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Stamina extends EcoEnchant {
- public Stamina() {
- super(
- "stamina", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @EventHandler
- public void onStaminaHunger(@NotNull final FoodLevelChangeEvent event) {
- if (!(event.getEntity() instanceof Player player)) {
- return;
- }
-
- if (!player.isSprinting()) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!EnchantChecks.boots(player, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (event.getFoodLevel() > player.getFoodLevel()) {
- return;
- }
-
- int level = EnchantChecks.getBootsLevel(player, this);
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- event.setCancelled(true);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StoneSwitcher.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StoneSwitcher.java
deleted file mode 100644
index e591088b..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StoneSwitcher.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.drops.DropQueue;
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.GameMode;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-public class StoneSwitcher extends EcoEnchant {
- public StoneSwitcher() {
- super(
- "stone_switcher", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onBlockBreak(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockBreakEvent event) {
- if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) {
- return;
- }
-
- if (!block.getType().equals(Material.STONE)) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- event.setDropItems(false);
-
- Material material;
- double random = NumberUtils.randFloat(0, 1);
- double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size();
- int selectedIndex = (int) Math.floor(random / band);
- selectedIndex = Math.min(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size() - 1);
- String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").get(selectedIndex);
- material = Material.getMaterial(materialName.toUpperCase());
-
- if (material == null) {
- material = Material.COBBLESTONE;
- }
-
- ItemStack item = new ItemStack(material, 1);
-
- new DropQueue(player)
- .setLocation(block.getLocation())
- .addItem(item)
- .push();
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StrayAspect.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StrayAspect.java
deleted file mode 100644
index 11cf512f..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StrayAspect.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class StrayAspect extends EcoEnchant {
- public StrayAspect() {
- super(
- "stray_aspect", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- int ticksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level");
-
- victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, level * ticksPerLevel, level));
- victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, level * ticksPerLevel, level));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Succession.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Succession.java
deleted file mode 100644
index c83d067f..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Succession.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
-import com.willfp.eco.util.DurabilityUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.AbstractArrow;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityShootBowEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Succession extends EcoEnchant {
- public Succession() {
- super(
- "succession", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onBowShoot(@NotNull final LivingEntity shooter,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityShootBowEvent event) {
- int amount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "extra-arrows-per-level") * level;
-
- boolean fire = EnchantChecks.mainhand(shooter, Enchantment.ARROW_FIRE);
-
- if (shooter instanceof Player player) {
- AnticheatManager.exemptPlayer(player);
- }
-
- for (int i = 1; i <= amount; i++) {
- this.getPlugin().getScheduler().runLater(() -> {
- Arrow arrow1 = shooter.launchProjectile(Arrow.class, event.getProjectile().getVelocity());
- arrow1.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED);
- if (fire) {
- arrow1.setFireTicks(Integer.MAX_VALUE);
- }
-
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "per-arrow-damage") && shooter instanceof Player) {
- DurabilityUtils.damageItem((Player) shooter, ((Player) shooter).getInventory().getItemInMainHand(), 1);
- }
- }, (long) i * this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "delay-between-arrows"));
- }
- if (shooter instanceof Player player) {
- AnticheatManager.unexemptPlayer(player);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Supercritical.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Supercritical.java
deleted file mode 100644
index 2de2131a..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Supercritical.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Supercritical extends EcoEnchant {
- public Supercritical() {
- super(
- "supercritical", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- event.setDamage(event.getDamage() * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-multiplier"));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sycophant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sycophant.java
deleted file mode 100644
index 96df8afd..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sycophant.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.attribute.Attribute;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Sycophant extends EcoEnchant {
- public Sycophant() {
- super(
- "sycophant", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onDeflect(@NotNull final Player blocker,
- @NotNull final LivingEntity attacker,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level");
- double amountToHeal = level * multiplier;
- double newHealth = blocker.getHealth() + amountToHeal;
- if (newHealth > blocker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) {
- newHealth = blocker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
- }
- blocker.setHealth(newHealth);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tectonic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tectonic.java
deleted file mode 100644
index 25968078..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tectonic.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Collection;
-
-public class Tectonic extends EcoEnchant {
- public Tectonic() {
- super(
- "tectonic", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onFallDamage(@NotNull final LivingEntity faller,
- final int level,
- @NotNull final EntityDamageEvent event) {
-
- if (!event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) {
- return;
- }
-
- int radius = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "initial-radius") + (this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "per-level-radius") * level - 1);
- int damage = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "initial-damage") + (this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "per-level-damage") * level - 1);
-
-
- Collection entities = faller.getWorld().getNearbyEntities(faller.getLocation(), radius, 2, radius);
-
- for (Entity entity : entities) {
- if (entity.equals(faller)) {
- continue;
- }
- if (!(entity instanceof LivingEntity)) {
- continue;
- }
- entity.teleport(entity.getLocation().add(0, 0.3, 0));
- if (faller instanceof Player && !AntigriefManager.canInjure((Player) faller, (LivingEntity) entity)) {
- return;
- }
- ((LivingEntity) entity).damage(damage);
- }
- }
-
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java
deleted file mode 100644
index b50f47f6..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java
+++ /dev/null
@@ -1,210 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.drops.DropQueue;
-import com.willfp.eco.core.events.EntityDeathByEntityEvent;
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.eco.core.integrations.mcmmo.McmmoManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.integrations.mythicmobs.MythicMobsManager;
-import org.bukkit.GameMode;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Item;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.event.block.BlockDropItemEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.ItemMeta;
-import org.bukkit.persistence.PersistentDataType;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Objects;
-
-public class Telekinesis extends EcoEnchant {
- private static boolean always = false;
-
- public Telekinesis() {
- super(
- "telekinesis", EnchantmentType.NORMAL
- );
- }
-
- @Override
- protected void postUpdate() {
- always = this.getPlugin().getConfigYml().getBool("advanced.force-dropqueue");
- }
-
- // For block drops
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void telekinesisDropItem(@NotNull final BlockDropItemEvent event) {
- Player player = event.getPlayer();
-
- if (!always && !(EnchantChecks.mainhand(player, this)) && this.areRequirementsMet(player)) {
- return;
- }
-
- if (this.getDisabledWorldNames().contains(player.getWorld().getName())) {
- return;
- }
-
- if (event.isCancelled()) {
- return;
- }
-
- Block block = event.getBlock();
-
- if (!AntigriefManager.canBreakBlock(player, block)) {
- return;
- }
-
- List drops = new ArrayList<>();
-
- for (Item item : event.getItems()) {
- drops.add(item.getItemStack());
- for (int i = 0; i < McmmoManager.getBonusDropCount(block); i++) {
- drops.add(item.getItemStack());
- }
- }
-
- event.getItems().clear();
-
- DropQueue queue = new DropQueue(player)
- .setLocation(block.getLocation())
- .addItems(drops);
-
- if (!always) {
- queue.forceTelekinesis();
- }
-
- queue.push();
- }
-
- // For exp drops, blockdropitemevent doesn't cover xp
- @EventHandler(priority = EventPriority.HIGH)
- public void telekinesisBreak(@NotNull final BlockBreakEvent event) {
- Player player = event.getPlayer();
- Block block = event.getBlock();
-
- if (!always && !(EnchantChecks.mainhand(player, this)) && this.areRequirementsMet(player)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) {
- return;
- }
-
- if (event.isCancelled()) {
- return;
- }
-
- if (!AntigriefManager.canBreakBlock(player, block)) {
- return;
- }
-
- if (block.getType().equals(Material.SPAWNER)) {
- event.setExpToDrop(0);
- }
-
- DropQueue queue = new DropQueue(player)
- .setLocation(block.getLocation())
- .addXP(event.getExpToDrop());
-
- if (!always) {
- queue.forceTelekinesis();
- }
-
- queue.push();
-
- event.setExpToDrop(0);
- }
-
- @EventHandler(priority = EventPriority.HIGH)
- public void telekinesisKill(@NotNull final EntityDeathByEntityEvent event) {
- Player player = null;
- LivingEntity entity = event.getVictim();
- ItemStack item = null;
-
- if (entity instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "not-on-players")) {
- return;
- }
-
- if (!MythicMobsManager.canDropItems(entity)) {
- return;
- }
-
- if (event.getKiller() instanceof Player) {
- player = (Player) event.getKiller();
- item = player.getInventory().getItemInMainHand();
- } else if (event.getKiller() instanceof Arrow) {
- if (((Arrow) event.getKiller()).getShooter() instanceof Player) {
- player = (Player) ((Arrow) event.getKiller()).getShooter();
- item = player.getInventory().getItemInMainHand();
- }
- } else if (event.getKiller() instanceof Trident trident) {
- if (trident.getShooter() instanceof Player) {
- player = (Player) trident.getShooter();
- item = trident.getItem();
- }
- }
-
- //noinspection ConstantConditions
- if (player == null || item == null) {
- return;
- }
-
- if (Objects.equals(player, entity)) {
- return;
- }
-
- if (!EnchantChecks.item(item, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- int xp = event.getXp();
- Collection drops = event.getDrops();
-
- drops.removeIf(itemStack -> {
- if (itemStack == null) {
- return true;
- }
- ItemMeta meta = itemStack.getItemMeta();
- if (meta == null) {
- return false;
- }
- //noinspection ConstantConditions
- if (meta.getPersistentDataContainer() == null) {
- return false;
- }
- return meta.getPersistentDataContainer().has(this.getPlugin().getNamespacedKeyFactory().create("soulbound"), PersistentDataType.INTEGER);
- });
-
- new DropQueue(player)
- .addItems(drops)
- .setLocation(entity.getLocation())
- .addXP(xp)
- .forceTelekinesis()
- .push();
-
- event.getDeathEvent().setDroppedExp(0);
- event.getDeathEvent().getDrops().clear();
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thor.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thor.java
deleted file mode 100644
index 5d29599e..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thor.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.LightningUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Thor extends EcoEnchant {
- public Thor() {
- super(
- "thor", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "lightning-damage");
-
- boolean silent = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "local-lightning-sound");
- LightningUtils.strike(victim, damage, silent);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thrive.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thrive.java
deleted file mode 100644
index e59a4699..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thrive.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.events.ArmorChangeEvent;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.attribute.Attribute;
-import org.bukkit.attribute.AttributeInstance;
-import org.bukkit.attribute.AttributeModifier;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.UUID;
-
-public class Thrive extends EcoEnchant {
- private final AttributeModifier modifier = new AttributeModifier(UUID.nameUUIDFromBytes("thrive".getBytes()), this.getKey().getKey(), 1, AttributeModifier.Operation.ADD_NUMBER);
-
- public Thrive() {
- super(
- "thrive", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onArmorEquip(@NotNull final ArmorChangeEvent event) {
- Player player = event.getPlayer();
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- int points = EnchantChecks.getArmorPoints(player, this);
-
- AttributeInstance inst = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
-
- assert inst != null;
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- points = 0;
- }
-
- inst.removeModifier(modifier);
-
- if (points > 0) {
- inst.addModifier(
- new AttributeModifier(
- UUID.nameUUIDFromBytes("thrive".getBytes()),
- this.getKey().getKey(),
- this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "health-per-point") * points,
- AttributeModifier.Operation.ADD_NUMBER
- )
- );
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java
deleted file mode 100644
index 3afc824c..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Tornado extends EcoEnchant {
- public Tornado() {
- super(
- "tornado", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- double baseVelocity = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-per-level");
- double yVelocity = baseVelocity * level;
-
- Vector toAdd = new Vector(0, yVelocity, 0);
-
- if (victim instanceof Player pVictim) {
- AnticheatManager.exemptPlayer(pVictim);
-
- this.getPlugin().getScheduler().runLater(() -> {
- AnticheatManager.unexemptPlayer(pVictim);
- }, 40);
- }
-
- this.getPlugin().getScheduler().run(() -> {
- victim.setVelocity(victim.getVelocity().clone().add(toAdd));
- });
-
- this.getPlugin().getScheduler().runLater(() -> victim.setVelocity(victim.getVelocity().clone().add(toAdd)), 1);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Toxic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Toxic.java
deleted file mode 100644
index 212f98af..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Toxic.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Toxic extends EcoEnchant {
- public Toxic() {
- super(
- "toxic", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- victim.addPotionEffect(new PotionEffect(PotionEffectType.POISON, level * 10 + 20, level));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Transfuse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Transfuse.java
deleted file mode 100644
index f2738f61..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Transfuse.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.drops.DropQueue;
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.GameMode;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-public class Transfuse extends EcoEnchant {
- public Transfuse() {
- super(
- "transfuse", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onBlockBreak(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockBreakEvent event) {
- if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- if (!this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "works-on").contains(block.getType().toString().toLowerCase())) {
- return;
- }
-
- event.setDropItems(false);
-
- Material material;
- double random = NumberUtils.randFloat(0, 1);
- double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size();
- int selectedIndex = (int) Math.floor(random / band);
- selectedIndex = Math.min(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size() - 1);
- String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").get(selectedIndex);
- material = Material.getMaterial(materialName.toUpperCase());
- if (material == null) {
- material = Material.COBBLESTONE;
- }
-
- ItemStack item = new ItemStack(material, 1);
-
- new DropQueue(player)
- .setLocation(block.getLocation())
- .addItem(item)
- .push();
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tripleshot.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tripleshot.java
deleted file mode 100644
index 293681b8..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tripleshot.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.AbstractArrow;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityShootBowEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Tripleshot extends EcoEnchant {
- public Tripleshot() {
- super(
- "tripleshot", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onBowShoot(@NotNull final LivingEntity shooter,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityShootBowEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- if (shooter instanceof Player player) {
- AnticheatManager.exemptPlayer(player);
- }
-
- for (int i = -1; i < 2; i += 2) {
- Vector velocity = event.getProjectile().getVelocity();
-
- float radians = (float) ((float) i * Math.toRadians(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "angle")));
- velocity.rotateAroundY(radians);
-
- Arrow arrow1 = shooter.launchProjectile(Arrow.class, velocity);
- if (EnchantChecks.mainhand(shooter, Enchantment.ARROW_FIRE)) {
- arrow1.setFireTicks(Integer.MAX_VALUE);
- }
- arrow1.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED);
- }
-
- if (shooter instanceof Player player) {
- AnticheatManager.unexemptPlayer(player);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VampireAspect.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VampireAspect.java
deleted file mode 100644
index 6dbe0c7e..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VampireAspect.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class VampireAspect extends EcoEnchant {
- public VampireAspect() {
- super(
- "vampire_aspect", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- victim.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, level * 10 + 20, level));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java
deleted file mode 100644
index b7da4cc2..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.eco.util.BlockUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-public class Vein extends EcoEnchant {
- public Vein() {
- super(
- "vein", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onBlockBreak(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockBreakEvent event) {
- if (block.hasMetadata("block-ignore")) {
- return;
- }
-
- if (player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) {
- return;
- }
-
- List materials = Collections.singletonList(block.getType());
-
- if (!this.getConfig()
- .getStrings(EcoEnchants.CONFIG_LOCATION + "whitelisted-blocks")
- .contains(block.getType().toString().toLowerCase())) {
- return;
- }
-
- int blocksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "blocks-per-level");
- int limit = level * blocksPerLevel;
-
- Set blockSet = BlockUtils.getVein(block, materials, limit);
- blockSet.removeIf(block1 -> !AntigriefManager.canBreakBlock(player, block1));
-
- AnticheatManager.exemptPlayer(player);
- EnchantmentUtils.rehandleBreaking(player, blockSet, this.getPlugin());
- AnticheatManager.unexemptPlayer(player);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Venom.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Venom.java
deleted file mode 100644
index 730ac04d..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Venom.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Venom extends EcoEnchant {
- public Venom() {
- super(
- "venom", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- victim.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, level * 10 + 20, level));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VoidAffinity.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VoidAffinity.java
deleted file mode 100644
index 3c275127..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VoidAffinity.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.World;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class VoidAffinity extends EcoEnchant {
- public VoidAffinity() {
- super(
- "void_affinity", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!attacker.getWorld().getEnvironment().equals(World.Environment.THE_END)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- event.setDamage(event.getDamage() * (1 + (level * multiplier)));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Voltage.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Voltage.java
deleted file mode 100644
index 5d3d9465..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Voltage.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.Material;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.inventory.EntityEquipment;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Arrays;
-
-public class Voltage extends EcoEnchant {
- private static final Material[] ITEMS = {
- Material.IRON_HELMET,
- Material.IRON_CHESTPLATE,
- Material.IRON_LEGGINGS,
- Material.IRON_BOOTS,
-
- Material.GOLDEN_HELMET,
- Material.GOLDEN_CHESTPLATE,
- Material.GOLDEN_LEGGINGS,
- Material.GOLDEN_BOOTS,
-
- Material.CHAINMAIL_HELMET,
- Material.CHAINMAIL_CHESTPLATE,
- Material.CHAINMAIL_LEGGINGS,
- Material.CHAINMAIL_BOOTS,
- };
-
- public Voltage() {
- super(
- "voltage", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- EntityEquipment equipment = victim.getEquipment();
- if (equipment == null) {
- return;
- }
-
- int pieces = 0;
-
- for (ItemStack armorPiece : equipment.getArmorContents()) {
- if (armorPiece == null) {
- continue;
- }
-
- if (Arrays.asList(ITEMS).contains(armorPiece.getType())) {
- pieces++;
- }
- }
-
- if (pieces == 0) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- event.setDamage(event.getDamage() * (1 + (level * multiplier * pieces)));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WaterAffinity.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WaterAffinity.java
deleted file mode 100644
index 6fd7fbb6..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WaterAffinity.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.Material;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class WaterAffinity extends EcoEnchant {
- public WaterAffinity() {
- super(
- "water_affinity", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!attacker.getLocation().getBlock().getType().equals(Material.WATER)) {
- return;
- }
-
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = 1 + (multiplier * level);
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WaterAspect.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WaterAspect.java
deleted file mode 100644
index 465811a3..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WaterAspect.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Blaze;
-import org.bukkit.entity.Enderman;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.MagmaCube;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class WaterAspect extends EcoEnchant {
- public WaterAspect() {
- super(
- "water_aspect", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(victim instanceof Blaze || victim instanceof MagmaCube || victim instanceof Enderman)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- double damageMultiplier = (level * multiplier) + 1;
-
- event.setDamage(event.getDamage() * damageMultiplier);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.java
deleted file mode 100644
index 8a4a5074..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Weakening extends EcoEnchant {
- public Weakening() {
- super(
- "weakening", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- int ticksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level");
- int ticks = ticksPerLevel * level;
-
- victim.setMetadata("weak", this.getPlugin().getMetadataValueFactory().create(true));
-
- this.getPlugin().getScheduler().runLater(() -> victim.removeMetadata("weak", this.getPlugin()), ticks);
- }
-
- @EventHandler
- public void onDamage(@NotNull final EntityDamageEvent event) {
- if (!(event.getEntity() instanceof LivingEntity victim)) {
- return;
- }
-
- if (!victim.hasMetadata("weak")) {
- return;
- }
-
- event.setDamage(event.getDamage() * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier-while-weak"));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Wisdom.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Wisdom.java
deleted file mode 100644
index 562b7ab1..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Wisdom.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.events.NaturalExpGainEvent;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.inventory.InventoryType;
-import org.jetbrains.annotations.NotNull;
-
-public class Wisdom extends EcoEnchant {
- public Wisdom() {
- super(
- "wisdom", EnchantmentType.NORMAL
- );
- }
-
- @EventHandler
- public void onExpChange(@NotNull final NaturalExpGainEvent event) {
- Player player = event.getExpChangeEvent().getPlayer();
-
- if (event.getExpChangeEvent().getAmount() < 0) {
- return;
- }
-
- if (!EnchantChecks.mainhand(player, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (player.getOpenInventory().getTopInventory().getType() == InventoryType.GRINDSTONE) {
- return;
- }
-
- int level = EnchantChecks.getMainhandLevel(player, this);
-
- event.getExpChangeEvent().setAmount((int) Math.ceil(event.getExpChangeEvent().getAmount() * (1 + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-point")))));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WoodSwitcher.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WoodSwitcher.java
deleted file mode 100644
index d53bdad6..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WoodSwitcher.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.core.drops.DropQueue;
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.GameMode;
-import org.bukkit.Material;
-import org.bukkit.Tag;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-public class WoodSwitcher extends EcoEnchant {
- public WoodSwitcher() {
- super(
- "wood_switcher", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onBlockBreak(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockBreakEvent event) {
- if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) {
- return;
- }
-
- if (!Tag.LOGS.isTagged(block.getType())) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- event.setDropItems(false);
-
- Material material;
- double random = NumberUtils.randFloat(0, 1);
- double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size();
- int selectedIndex = (int) Math.floor(random / band);
- selectedIndex = Math.min(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size() - 1);
- String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").get(selectedIndex);
- material = Material.getMaterial(materialName.toUpperCase());
-
- if (material == null) {
- material = block.getType();
- }
-
- ItemStack item = new ItemStack(material, 1);
-
- new DropQueue(player)
- .setLocation(block.getLocation())
- .addItem(item)
- .push();
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Wound.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Wound.java
deleted file mode 100644
index 86a81ed2..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Wound.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.concurrent.atomic.AtomicInteger;
-
-public class Wound extends EcoEnchant {
- public Wound() {
- super(
- "wound", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- double bleedDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bleed-damage");
-
- int bleedCount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "amount-per-level");
- bleedCount *= level;
- final int finalBleedCount = bleedCount;
-
- AtomicInteger currentBleedCount = new AtomicInteger(0);
-
- this.getPlugin().getRunnableFactory().create(bukkitRunnable -> {
- currentBleedCount.addAndGet(1);
-
- victim.damage(bleedDamage);
-
- if (currentBleedCount.get() >= finalBleedCount) {
- bukkitRunnable.cancel();
- }
- }).runTaskTimer(0, 10);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Zeus.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Zeus.java
deleted file mode 100644
index e532da4b..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Zeus.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-
-import com.willfp.eco.util.LightningUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Zeus extends EcoEnchant {
- public Zeus() {
- super(
- "zeus", EnchantmentType.NORMAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "lightning-damage");
-
- boolean silent = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "local-lightning-sound");
- LightningUtils.strike(victim, damage, silent);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java
deleted file mode 100644
index 387bee5f..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.eco.core.entities.Entities;
-import com.willfp.eco.core.entities.TestableEntity;
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.GameMode;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Enderman;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.ProjectileLaunchEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-@SuppressWarnings({"unchecked", "unused"})
-public class Aiming extends EcoEnchant {
- private final List targets = new ArrayList<>();
-
- public Aiming() {
- super(
- "aiming", EnchantmentType.SPECIAL
- );
- targets.clear();
- targets.addAll(this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "targets").stream().map(
- Entities::lookup
- ).toList());
- }
-
- @EventHandler
- public void aimingLaunch(@NotNull final ProjectileLaunchEvent event) {
- if (!(event.getEntity().getShooter() instanceof Player player)) {
- return;
- }
-
- if (!(event.getEntity() instanceof Arrow arrow)) {
- return;
- }
-
- if (event.isCancelled()) {
- return;
- }
-
- if (!EnchantChecks.mainhand(player, this)) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- int level = EnchantChecks.getMainhandLevel(player, this);
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance-per-level");
-
- double distance = level * multiplier;
- double force = arrow.getVelocity().clone().length() / 3;
- force = Math.min(force, 1);
-
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "require-full-force") && force < 0.9) {
- return;
- }
-
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "scale-on-force")) {
- distance *= force;
- }
-
- final double finalDistance = distance;
-
- Runnable runnable = this.getPlugin().getRunnableFactory().create(bukkitRunnable -> {
- List nearbyEntities = (List) (List>) Arrays.asList(arrow.getNearbyEntities(finalDistance, finalDistance, finalDistance).stream()
- .filter(entity -> entity instanceof LivingEntity)
- .filter(entity -> this.targets.stream().anyMatch(target -> target.matches(entity)))
- .map(entity -> (LivingEntity) entity)
- .filter(entity -> !entity.equals(player))
- .filter(entity -> !(entity instanceof Enderman))
- .filter(entity -> AntigriefManager.canInjure(player, entity))
- .filter(entity -> {
- if (entity instanceof Player) {
- return ((Player) entity).getGameMode().equals(GameMode.SURVIVAL) || ((Player) entity).getGameMode().equals(GameMode.ADVENTURE);
- }
- return true;
- }).toArray());
-
- if (nearbyEntities.isEmpty()) {
- return;
- }
-
- LivingEntity entity = nearbyEntities.get(0);
- double dist = Double.MAX_VALUE;
-
- for (LivingEntity livingEntity : nearbyEntities) {
- double currentDistance = livingEntity.getLocation().distance(arrow.getLocation());
- if (currentDistance >= dist) {
- continue;
- }
-
- dist = currentDistance;
- entity = livingEntity;
- }
- if (entity != null) {
- Vector vector = entity.getEyeLocation().toVector().clone().subtract(arrow.getLocation().toVector()).normalize();
- arrow.setVelocity(vector);
- }
- });
-
- final int period = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "check-ticks");
- final int checks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "checks-per-level") * level;
- AtomicInteger checksPerformed = new AtomicInteger(0);
-
- this.getPlugin().getRunnableFactory().create(bukkitRunnable -> {
- checksPerformed.addAndGet(1);
- if (checksPerformed.get() > checks) {
- bukkitRunnable.cancel();
- }
- if (arrow.isDead() || arrow.isInBlock() || arrow.isOnGround()) {
- bukkitRunnable.cancel();
- }
- this.getPlugin().getScheduler().run(runnable);
- }).runTaskTimer(3, period);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Annihilate.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Annihilate.java
deleted file mode 100644
index e2e3e8f9..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Annihilate.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.eco.util.VectorUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Annihilate extends EcoEnchant {
- public Annihilate() {
- super(
- "annihilate", EnchantmentType.SPECIAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- double baseMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-multiplier");
- Vector vector = attacker.getLocation().toVector().clone().subtract(victim.getLocation().toVector()).normalize().multiply(level * baseMultiplier).multiply(-1);
- if (!VectorUtils.isFinite(vector)) {
- return;
- }
- vector.setY(0.2);
- if (!VectorUtils.isFinite(vector)) {
- return;
- }
- victim.setVelocity(vector);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bladed.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bladed.java
deleted file mode 100644
index c2dd99dc..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bladed.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Trident;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Bladed extends EcoEnchant {
- public Bladed() {
- super(
- "bladed", EnchantmentType.SPECIAL
- );
- }
-
- @Override
- public void onTridentDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Trident trident,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (victim instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-players")) {
- return;
- }
- double baseDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "base-multiplier");
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = 1 + (multiplier * level) + baseDamage;
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bolt.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bolt.java
deleted file mode 100644
index ae15875c..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bolt.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.eco.util.LightningUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Bolt extends EcoEnchant {
- public Bolt() {
- super(
- "bolt", EnchantmentType.SPECIAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "lightning-damage");
-
- boolean silent = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "local-lightning-sound");
- LightningUtils.strike(victim, damage, silent);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Carve.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Carve.java
deleted file mode 100644
index e8f25885..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Carve.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Carve extends EcoEnchant {
- public Carve() {
- super(
- "carve", EnchantmentType.SPECIAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (victim.hasMetadata("cleaved")) {
- return;
- }
-
- double damagePerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-percentage-per-level") * 0.01;
- double radiusPerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-per-level");
- final double damage = damagePerLevel * level * event.getDamage();
- final double radius = radiusPerLevel * level;
-
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- victim.getNearbyEntities(radius, radius, radius).stream()
- .filter(entity -> entity instanceof LivingEntity)
- .filter(entity -> !entity.equals(attacker))
- .forEach(entity -> {
- entity.setMetadata("cleaved", this.getPlugin().getMetadataValueFactory().create(true));
- this.getPlugin().getScheduler().run(() -> ((LivingEntity) entity).damage(damage, attacker));
- this.getPlugin().getScheduler().runLater(() -> entity.removeMetadata("cleaved", this.getPlugin()), 20);
- });
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Confusion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Confusion.java
deleted file mode 100644
index 127e8777..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Confusion.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class Confusion extends EcoEnchant {
- public Confusion() {
- super(
- "confusion", EnchantmentType.SPECIAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity uncastVictim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(uncastVictim instanceof Player victim)) {
- return;
- }
-
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- List hotbar = new ArrayList<>();
- for (int i = 0; i < 9; i++) {
- hotbar.add(victim.getInventory().getItem(i));
- }
- Collections.shuffle(hotbar);
- int i2 = 0;
- for (ItemStack item : hotbar) {
- victim.getInventory().setItem(i2, item);
- i2++;
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Energizing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Energizing.java
deleted file mode 100644
index 37d1aacc..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Energizing.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Energizing extends EcoEnchant {
- public Energizing() {
- super(
- "energizing", EnchantmentType.SPECIAL
- );
- }
-
- @Override
- public void onBlockBreak(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockBreakEvent event) {
- int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level") * level;
- int amplifier = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "initial-level") + (level - 2);
-
- player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, duration, amplifier, true, true, true));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Force.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Force.java
deleted file mode 100644
index b7e8c0ae..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Force.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Force extends EcoEnchant {
- public Force() {
- super(
- "force", EnchantmentType.SPECIAL
- );
- }
-
- @Override
- public void onArrowDamage(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (victim instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-players")) {
- return;
- }
- double damage = event.getDamage();
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double bonus = (multiplier * (level + 6)) + 1;
- event.setDamage(damage * bonus);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Frenzy.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Frenzy.java
deleted file mode 100644
index 2c256781..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Frenzy.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDeathEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Frenzy extends EcoEnchant {
- public Frenzy() {
- super(
- "frenzy", EnchantmentType.SPECIAL
- );
- }
-
- @EventHandler
- public void onFrenzyKill(@NotNull final EntityDeathEvent event) {
- if (event.getEntity().getKiller() == null) {
- return;
- }
-
- Player player = event.getEntity().getKiller();
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!EnchantChecks.mainhand(player, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- int level = EnchantChecks.getMainhandLevel(player, this);
-
- int duration = (int) (level * 20 * this.getConfig().getDouble((EcoEnchants.CONFIG_LOCATION + "seconds-per-level")));
-
- player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, duration, level, true, true, true));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Harpoon.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Harpoon.java
deleted file mode 100644
index 9d501fac..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Harpoon.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerFishEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Harpoon extends EcoEnchant {
- public Harpoon() {
- super(
- "harpoon", EnchantmentType.SPECIAL
- );
- }
-
- @EventHandler
- public void onFish(@NotNull final PlayerFishEvent event) {
- if (!event.getState().equals(PlayerFishEvent.State.CAUGHT_ENTITY)) {
- return;
- }
-
- if (!(event.getCaught() instanceof LivingEntity victim)) {
- return;
- }
-
- Player player = event.getPlayer();
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (victim.hasMetadata("NPC")) {
- return;
- }
-
- if (!AntigriefManager.canInjure(player, victim)) {
- return;
- }
-
- if (!EnchantChecks.mainhand(player, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- int level = EnchantChecks.getMainhandLevel(player, this);
-
- double damagePerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level");
- double damage = damagePerLevel * level;
- victim.damage(damage, player);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Indestructibility.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Indestructibility.java
deleted file mode 100644
index 7adbb7ce..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Indestructibility.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerItemDamageEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-public class Indestructibility extends EcoEnchant {
- public Indestructibility() {
- super(
- "indestructibility", EnchantmentType.SPECIAL
- );
- }
-
- @EventHandler
- public void onItemDamage(@NotNull final PlayerItemDamageEvent event) {
- ItemStack item = event.getItem();
-
- if (!EnchantChecks.item(item, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(event.getPlayer().getWorld())) {
- return;
- }
-
- if (!this.areRequirementsMet(event.getPlayer())) {
- return;
- }
-
- double level = EnchantChecks.getItemLevel(item, this);
- double levelBonus = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "level-bonus");
-
- if (NumberUtils.randFloat(0, 1) < (100 / (level + (1 + levelBonus)) / 100)) {
- return;
- }
-
- event.setCancelled(true);
- event.setDamage(0);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Instability.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Instability.java
deleted file mode 100644
index 5288b445..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Instability.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.entity.ProjectileHitEvent;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Instability extends EcoEnchant {
-
- private static final List toProtect = new ArrayList<>();
-
- public Instability() {
- super(
- "instability", EnchantmentType.SPECIAL
- );
- }
-
- @EventHandler
- public void onInstabilityExplode(@NotNull final EntityDamageEvent event) {
- if (!toProtect.contains(event.getEntity())) {
- return;
- }
-
- if (event.getCause() != EntityDamageEvent.DamageCause.ENTITY_EXPLOSION && event.getCause()
- != EntityDamageEvent.DamageCause.BLOCK_EXPLOSION) {
- return;
- }
-
- event.setCancelled(true);
- toProtect.remove(event.getEntity());
- }
-
- @EventHandler
- public void onInstabilityLand(@NotNull final ProjectileHitEvent event) {
- if (event.getEntityType() != EntityType.ARROW) {
- return;
- }
-
- if (!(event.getEntity().getShooter() instanceof Player player)) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!EnchantChecks.mainhand(player, this)) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (!(event.getEntity() instanceof Arrow)) {
- return;
- }
-
- int level = EnchantChecks.getMainhandLevel(player, this);
-
- boolean fire = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "fire");
- boolean breakblocks = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "break-blocks");
-
- float power = (float) (0.5 + (level * 0.5));
-
- if (!AntigriefManager.canCreateExplosion(player, event.getEntity().getLocation())) {
- return;
- }
-
- if (breakblocks) {
- breakblocks = AntigriefManager.canBreakBlock(player, event.getEntity().getLocation().getWorld().getBlockAt(event.getEntity().getLocation()));
- }
-
- List toAdd = event.getEntity().getNearbyEntities(power, power, power)
- .stream().filter(entity -> entity instanceof LivingEntity && !AntigriefManager.canInjure(player, (LivingEntity) entity))
- .toList();
-
- toProtect.addAll(
- toAdd
- );
-
- this.getPlugin().getScheduler().runLater(() -> toProtect.removeAll(toAdd), 20);
-
- event.getEntity().getWorld().createExplosion(event.getEntity().getLocation().getX(), event.getEntity().getLocation().getY(), event.getEntity().getLocation().getZ(), power, fire, breakblocks);
-
- event.getEntity().remove();
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Intellect.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Intellect.java
deleted file mode 100644
index 2e2d7cd7..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Intellect.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.eco.core.events.NaturalExpGainEvent;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.inventory.InventoryType;
-import org.jetbrains.annotations.NotNull;
-
-public class Intellect extends EcoEnchant {
- public Intellect() {
- super(
- "intellect", EnchantmentType.SPECIAL
- );
- }
-
- @EventHandler
- public void onExpChange(@NotNull final NaturalExpGainEvent event) {
- Player player = event.getExpChangeEvent().getPlayer();
-
- if (event.getExpChangeEvent().getAmount() < 0) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- int level = EnchantChecks.getMainhandLevel(player, this);
-
- if (level == 0) {
- return;
- }
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (player.getOpenInventory().getTopInventory().getType() == InventoryType.GRINDSTONE) {
- return;
- }
-
- event.getExpChangeEvent().setAmount((int) Math.ceil(event.getExpChangeEvent().getAmount() * (1 + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-point")))));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/LifeSteal.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/LifeSteal.java
deleted file mode 100644
index 38a054c2..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/LifeSteal.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.attribute.Attribute;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class LifeSteal extends EcoEnchant {
- public LifeSteal() {
- super(
- "life_steal", EnchantmentType.SPECIAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level");
- double amountToHeal = level * multiplier;
- double newHealth = attacker.getHealth() + amountToHeal;
- if (newHealth > attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) {
- newHealth = attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
- }
- attacker.setHealth(newHealth);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Pentashot.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Pentashot.java
deleted file mode 100644
index 074103c5..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Pentashot.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.AbstractArrow;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityShootBowEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Pentashot extends EcoEnchant {
- public Pentashot() {
- super(
- "pentashot", EnchantmentType.SPECIAL
- );
- }
-
- @Override
- public void onBowShoot(@NotNull final LivingEntity shooter,
- @NotNull final Arrow arrow,
- final int level,
- @NotNull final EntityShootBowEvent event) {
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- int bonusPerSide = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "side-arrows-per-level") * level;
-
- if (shooter instanceof Player player) {
- AnticheatManager.exemptPlayer(player);
- }
-
- for (int i = -bonusPerSide; i <= bonusPerSide; i += 1) {
- if (i == 0) {
- continue;
- }
-
- Vector velocity = event.getProjectile().getVelocity();
-
- float radians = (float) ((float) i * Math.toRadians(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "angle")));
- velocity.rotateAroundY(radians);
-
- Arrow arrow1 = shooter.launchProjectile(Arrow.class, velocity);
- if (EnchantChecks.mainhand(shooter, Enchantment.ARROW_FIRE)) {
- arrow1.setFireTicks(Integer.MAX_VALUE);
- }
- arrow1.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED);
- }
-
- if (shooter instanceof Player player) {
- AnticheatManager.unexemptPlayer(player);
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Preservation.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Preservation.java
deleted file mode 100644
index 07fe41ad..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Preservation.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Preservation extends EcoEnchant {
- public Preservation() {
- super(
- "preservation", EnchantmentType.SPECIAL
- );
- }
-
- @Override
- public void onDamageWearingArmor(@NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageEvent event) {
- if (event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) {
- return;
- }
-
- double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-less-per-level");
-
- double multiplier = 1 - ((reduction / 100) * level);
-
- event.setDamage(event.getDamage() * multiplier);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Prosperity.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Prosperity.java
deleted file mode 100644
index 5867e03c..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Prosperity.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.eco.core.events.ArmorChangeEvent;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.attribute.Attribute;
-import org.bukkit.attribute.AttributeInstance;
-import org.bukkit.attribute.AttributeModifier;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.UUID;
-
-public class Prosperity extends EcoEnchant {
- private final AttributeModifier modifier = new AttributeModifier(UUID.nameUUIDFromBytes("prosperity".getBytes()), this.getKey().getKey(), 1, AttributeModifier.Operation.ADD_NUMBER);
-
- public Prosperity() {
- super(
- "prosperity", EnchantmentType.SPECIAL
- );
- }
-
- @EventHandler
- public void onArmorEquip(@NotNull final ArmorChangeEvent event) {
- Player player = event.getPlayer();
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- int points = EnchantChecks.getArmorPoints(player, this);
-
- AttributeInstance inst = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
-
- assert inst != null;
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- points = 0;
- }
-
- inst.removeModifier(modifier);
-
- if (points > 0) {
- inst.addModifier(
- new AttributeModifier(
- UUID.nameUUIDFromBytes("prosperity".getBytes()),
- this.getKey().getKey(),
- this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "health-per-point") * points,
- AttributeModifier.Operation.ADD_NUMBER
- )
- );
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Razor.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Razor.java
deleted file mode 100644
index 97d2d617..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Razor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Razor extends EcoEnchant {
- public Razor() {
- super(
- "razor", EnchantmentType.SPECIAL
- );
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (victim instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-players")) {
- return;
- }
- double perLevelMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
- double baseDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "base-damage");
- double extra = (level * perLevelMultiplier) + baseDamage;
- if (this.getConfig().getBool((EcoEnchants.CONFIG_LOCATION) + "decrease-if-cooldown") && attacker instanceof Player) {
- extra *= ((Player) attacker).getAttackCooldown();
- }
-
- event.setDamage(event.getDamage() + extra);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Repairing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Repairing.java
deleted file mode 100644
index 20ab14bd..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Repairing.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.eco.util.DurabilityUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.TimedRunnable;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDropItemEvent;
-import org.bukkit.event.entity.EntityPickupItemEvent;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.Repairable;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-public class Repairing extends EcoEnchant implements TimedRunnable {
- private final Set players = new HashSet<>();
- private int amount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "multiplier");
-
- public Repairing() {
- super(
- "repairing", EnchantmentType.SPECIAL
- );
- }
-
- @EventHandler
- public void onItemPickup(@NotNull final EntityPickupItemEvent event) {
- if (!(event.getEntity() instanceof Player)) {
- return;
- }
- refreshPlayer((Player) event.getEntity());
- }
-
- @EventHandler
- public void onPlayerJoin(@NotNull final PlayerJoinEvent event) {
- refresh();
- }
-
- @EventHandler
- public void onPlayerLeave(@NotNull final PlayerQuitEvent event) {
- refresh();
- }
-
- @EventHandler
- public void onInventoryDrop(@NotNull final EntityDropItemEvent event) {
- if (!(event.getEntity() instanceof Player)) {
- return;
- }
-
- refreshPlayer((Player) event.getEntity());
- }
-
- @EventHandler
- public void onInventoryClick(@NotNull final InventoryClickEvent event) {
- if (!(event.getWhoClicked() instanceof Player)) {
- return;
- }
- refreshPlayer((Player) event.getWhoClicked());
- }
-
- private void refresh() {
- players.clear();
- this.getPlugin().getScheduler().runLater(() -> this.getPlugin().getServer().getOnlinePlayers().forEach(player -> {
- if (Arrays.stream(player.getInventory().getContents()).parallel().anyMatch(item -> EnchantChecks.item(item, this))) {
- if (this.areRequirementsMet(player)) {
- players.add(player);
- }
- }
- }), 1);
- amount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "multiplier");
- }
-
- private void refreshPlayer(@NotNull final Player player) {
- players.remove(player);
- if (Arrays.stream(player.getInventory().getContents()).parallel().anyMatch(item -> EnchantChecks.item(item, this))) {
- if (this.areRequirementsMet(player)) {
- players.add(player);
- }
- }
- }
-
- @Override
- public void run() {
- players.forEach((player -> {
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
- for (ItemStack item : player.getInventory().getContents()) {
- int level = EnchantChecks.getItemLevel(item, this);
- if (level == 0) {
- continue;
- }
-
- if (!(item.getItemMeta() instanceof Repairable)) {
- continue;
- }
-
- if (player.getInventory().getItemInMainHand().equals(item)) {
- continue;
- }
-
- if (player.getInventory().getItemInOffHand().equals(item)) {
- continue;
- }
-
- if (player.getItemOnCursor().equals(item)) {
- continue;
- }
-
- DurabilityUtils.repairItem(item, amount * level);
- }
- }));
- }
-
- @Override
- public long getTime() {
- return this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "repeat-ticks");
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java
deleted file mode 100644
index 09615069..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.NamespacedKey;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.entity.PlayerDeathEvent;
-import org.bukkit.event.player.PlayerRespawnEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.EnchantmentStorageMeta;
-import org.bukkit.inventory.meta.ItemMeta;
-import org.bukkit.persistence.PersistentDataContainer;
-import org.bukkit.persistence.PersistentDataType;
-import org.jetbrains.annotations.NotNull;
-import org.bukkit.entity.Arrow;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@SuppressWarnings("unchecked")
-public class Soulbound extends EcoEnchant {
- public Soulbound() {
- super(
- "soulbound", EnchantmentType.SPECIAL
- );
- }
-
- @EventHandler(priority = EventPriority.LOW)
- public void onSoulboundDeath(@NotNull final PlayerDeathEvent event) {
- if (event.getKeepInventory()) {
- return;
- }
-
- Player player = event.getEntity();
- List soulboundItems = new ArrayList<>(); // Stored as list to preserve duplicates
-
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!(event.getEntity() instanceof Arrow)) {
- if (player.getKiller() != null) {
- Player killer = player.getKiller();
- int reaperLevel = EnchantChecks.getMainhandLevel(killer, EcoEnchants.REAPER);
- if (reaperLevel > 0) {
- if (!(EcoEnchants.REAPER.getDisabledWorlds().contains(killer.getWorld()))) {
- if (EnchantmentUtils.passedChance(EcoEnchants.REAPER, reaperLevel)) {
- return;
- }
- }
- }
- }
- }
-
- for (ItemStack itemStack : player.getInventory().getContents()) {
- if (itemStack == null) {
- continue;
- }
-
- if (itemStack.containsEnchantment(this)) {
- soulboundItems.add(itemStack);
- }
-
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "on-books")) {
- if (itemStack.getItemMeta() instanceof EnchantmentStorageMeta && (((EnchantmentStorageMeta) itemStack.getItemMeta()).getStoredEnchants().containsKey(this))) {
- soulboundItems.add(itemStack);
- }
- }
- }
-
- event.getDrops().removeAll(soulboundItems);
-
- for (ItemStack itemStack : soulboundItems) {
- ItemMeta meta = itemStack.getItemMeta();
- assert meta != null;
- PersistentDataContainer container = meta.getPersistentDataContainer();
- container.set(this.getPlugin().getNamespacedKeyFactory().create("soulbound"), PersistentDataType.INTEGER, 1);
-
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "remove-after")) {
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "on-books")) {
- if (meta instanceof EnchantmentStorageMeta) {
- ((EnchantmentStorageMeta) meta).removeStoredEnchant(this);
- }
- }
- meta.removeEnchant(this);
- }
-
- itemStack.setItemMeta(meta);
- }
-
- player.setMetadata("soulbound-items", this.getPlugin().getMetadataValueFactory().create(soulboundItems));
- }
-
- public boolean hasSoulboundItems(@NotNull final Player player) {
- final NamespacedKey soulbound = this.getPlugin().getNamespacedKeyFactory().create("soulbound");
- for (ItemStack itemStack : player.getInventory().getContents()) {
- if (itemStack != null && itemStack.getItemMeta().getPersistentDataContainer().has(soulbound, PersistentDataType.INTEGER)) {
- return false;
- }
- }
- return true;
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onSoulboundRespawn(@NotNull final PlayerRespawnEvent event) {
- Player player = event.getPlayer();
-
- this.getPlugin().getScheduler().run(() -> {
- if (!hasSoulboundItems(player)) {
- return;
- }
-
- if (!player.hasMetadata("soulbound-items")) {
- return;
- }
-
- List soulboundItems = (List) player.getMetadata("soulbound-items").get(0).value();
-
- if (soulboundItems == null) {
- player.removeMetadata("soulbound-items", this.getPlugin());
- return;
- }
-
- for (ItemStack soulboundItem : soulboundItems) {
- player.getInventory().remove(soulboundItem);
-
- ItemMeta meta = soulboundItem.getItemMeta();
- assert meta != null;
- meta.getPersistentDataContainer().remove(this.getPlugin().getNamespacedKeyFactory().create("soulbound"));
- soulboundItem.setItemMeta(meta);
- player.getInventory().addItem(soulboundItem);
- }
-
- player.removeMetadata("soulbound-items", this.getPlugin());
- });
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onDeath(@NotNull final PlayerDeathEvent event) {
- final NamespacedKey soulbound = this.getPlugin().getNamespacedKeyFactory().create("soulbound");
- event.getDrops().removeIf(itemStack -> itemStack.getItemMeta().getPersistentDataContainer().has(soulbound, PersistentDataType.INTEGER));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Spring.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Spring.java
deleted file mode 100644
index 5a009d16..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Spring.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.player.PlayerMoveEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Spring extends EcoEnchant {
- public Spring() {
- super(
- "spring", EnchantmentType.SPECIAL
- );
- }
-
- @Override
- public void onDamageWearingArmor(@NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageEvent event) {
- if (event.getCause() == EntityDamageEvent.DamageCause.FALL) {
- event.setCancelled(true);
- }
- }
-
- @Override
- public void onJump(@NotNull final Player player,
- final int level,
- @NotNull final PlayerMoveEvent event) {
- if (player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) {
- return;
- }
- AnticheatManager.exemptPlayer(player);
-
- double multiplier = 0.5 + ((double) (level * level) / 4 - 0.2) / 3;
- player.setVelocity(player.getLocation().getDirection().multiply(multiplier).setY(multiplier));
-
- this.getPlugin().getScheduler().runLater(() -> AnticheatManager.unexemptPlayer(player), 100);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Streamlining.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Streamlining.java
deleted file mode 100644
index d0b49c9a..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Streamlining.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-
-import com.willfp.eco.core.events.ArmorChangeEvent;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-
-public class Streamlining extends EcoEnchant {
- public Streamlining() {
- super(
- "streamlining", EnchantmentType.SPECIAL
- );
- }
-
- @Override
- public void onArmorEquip(@NotNull final Player player,
- final int level,
- @NotNull final ArmorChangeEvent event) {
- if (level == 0) {
- player.setWalkSpeed(0.2f);
- return;
- }
-
- player.setWalkSpeed((float) (0.2f + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "speed-per-level"))));
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Volatile.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Volatile.java
deleted file mode 100644
index 60d9e4b8..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Volatile.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.special;
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.Location;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Volatile extends EcoEnchant {
- public Volatile() {
- super(
- "volatile", EnchantmentType.SPECIAL
- );
- }
-
- @Override
- public String getPlaceholder(final int level) {
- return EnchantmentUtils.chancePlaceholder(this, level);
- }
-
- @Override
- public void onMeleeAttack(@NotNull final LivingEntity uncastAttacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- if (!(uncastAttacker instanceof Player attacker)) {
- return;
- }
-
- if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) {
- return;
- }
-
- if (!EnchantmentUtils.passedChance(this, level)) {
- return;
- }
-
- boolean fire = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "fire");
- boolean breakblocks = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "break-blocks");
-
- float power = (float) (0.5 + (level * 0.5));
-
- if (!AntigriefManager.canCreateExplosion(attacker, event.getEntity().getLocation())) {
- return;
- }
-
- if (breakblocks && !AntigriefManager.canBreakBlock(attacker, event.getEntity().getLocation().getWorld().getBlockAt(event.getEntity().getLocation()))) {
- return;
- }
-
- Location explosionLoc = victim.getEyeLocation();
-
- victim.getWorld().createExplosion(explosionLoc, power, fire, breakblocks);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Ascend.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Ascend.java
deleted file mode 100644
index 680d7a7f..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Ascend.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.spell;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
-
-public class Ascend extends Spell {
- private static final String IGNORE_FALL_KEY = "ignore-fall-damage";
-
- public Ascend() {
- super("ascend");
- }
-
- @Override
- public boolean onUse(@NotNull final Player player,
- final int level,
- @NotNull final PlayerInteractEvent event) {
- int ticks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level") * level;
- player.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, ticks, this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "power") - 1, false, false));
- player.setMetadata(IGNORE_FALL_KEY, this.getPlugin().getMetadataValueFactory().create(true));
- this.getPlugin().getScheduler().runLater(() -> player.removeMetadata(IGNORE_FALL_KEY, this.getPlugin()), ticks * 4L);
-
- return true;
- }
-
- @EventHandler
- public void onFallDamage(@NotNull final EntityDamageEvent event) {
- if (!event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) {
- return;
- }
-
- if (!event.getEntity().hasMetadata(IGNORE_FALL_KEY)) {
- return;
- }
-
- event.setCancelled(true);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Charge.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Charge.java
deleted file mode 100644
index d677d235..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Charge.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.spell;
-
-import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
-import org.bukkit.entity.Player;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-
-public class Charge extends Spell {
- public Charge() {
- super("charge");
- }
-
- @Override
- public boolean onUse(@NotNull final Player player,
- final int level,
- @NotNull final PlayerInteractEvent event) {
- AnticheatManager.exemptPlayer(player);
-
- Vector velocity = player.getEyeLocation().getDirection().clone();
- velocity.normalize();
- velocity.multiply(level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-per-level"));
- velocity.setY(player.getEyeLocation().getDirection().clone().getY() + 0.2);
- player.setVelocity(safenVector(velocity));
-
- this.getPlugin().getScheduler().runLater(() -> AnticheatManager.unexemptPlayer(player), 10);
-
- return true;
- }
-
- private Vector safenVector(@NotNull final Vector vector) {
- if (Math.abs(vector.getX()) > 4) {
- vector.setX(vector.getX() < 0 ? -3.9 : 3.9);
- }
-
- if (Math.abs(vector.getY()) > 4) {
- vector.setY(vector.getY() < 0 ? -3.9 : 3.9);
- }
-
- if (Math.abs(vector.getZ()) > 4) {
- vector.setZ(vector.getZ() < 0 ? -3.9 : 3.9);
- }
-
- return vector;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java
deleted file mode 100644
index f7f34a47..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.spell;
-
-import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
-import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
-import org.bukkit.Particle;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.Action;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.HashSet;
-import java.util.Set;
-
-public class Dynamite extends Spell {
- public Dynamite() {
- super("dynamite");
- }
-
- @Override
- public boolean onUse(@NotNull final Player player,
- final int level,
- @NotNull final PlayerInteractEvent event) {
- Block block = event.getClickedBlock();
-
- if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
- return false;
- }
-
- if (block == null) {
- return false;
- }
-
- if (block.hasMetadata("block-ignore")) {
- return false;
- }
-
- AnticheatManager.exemptPlayer(player);
-
- Set toBreak = new HashSet<>();
-
- int baseDiff = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "base-bonus");
- int bonusPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "per-level-bonus");
- final int size = baseDiff + (bonusPerLevel * (level - 1));
-
-
- for (int x = -size; x <= size; x++) {
- for (int y = -size; y <= size; y++) {
- for (int z = -size; z <= size; z++) {
- if (x == 0 && y == 0 && z == 0) {
- block.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, block.getLocation().clone().add(0.5, 0.5, 0.5), 1);
- }
- Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(x, y, z));
-
- if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) {
- continue;
- }
-
- if (block1.getType().getHardness() > block.getType().getHardness() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "hardness-check")) {
- continue;
- }
-
- if (!AntigriefManager.canBreakBlock(player, block1)) {
- continue;
- }
-
- toBreak.add(block1);
- }
- }
- }
-
- EnchantmentUtils.rehandleBreaking(player, toBreak, this.getPlugin());
-
- AnticheatManager.unexemptPlayer(player);
-
- return true;
- }
-
- @Override
- protected boolean requiresBlockClick() {
- return true;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Missile.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Missile.java
deleted file mode 100644
index 7a5aa3d9..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Missile.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.spell;
-
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.WitherSkull;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityExplodeEvent;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Missile extends Spell {
- public Missile() {
- super("missile");
- }
-
- @Override
- public boolean onUse(@NotNull final Player player,
- final int level,
- @NotNull final PlayerInteractEvent event) {
- WitherSkull skull = player.launchProjectile(WitherSkull.class, player.getEyeLocation().getDirection().multiply(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity")));
- skull.setCharged(true);
- skull.setIsIncendiary(false);
- skull.setMetadata("eco-damage", this.getPlugin().getMetadataValueFactory().create(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * level));
- skull.setMetadata("nobreak", this.getPlugin().getMetadataValueFactory().create(true));
- skull.setShooter(player);
-
- return true;
- }
-
- @EventHandler(priority = EventPriority.LOW)
- public void onWitherSkullDamage(@NotNull final EntityDamageByEntityEvent event) {
- if (!(event.getDamager() instanceof WitherSkull)) {
- return;
- }
-
- if (event.getDamager().getMetadata("eco-damage").isEmpty()) {
- return;
- }
-
- double multiplier = event.getDamager().getMetadata("eco-damage").get(0).asDouble();
-
- if (((WitherSkull) event.getDamager()).getShooter().equals(event.getEntity())) {
- event.setCancelled(true);
- }
-
- event.setDamage(multiplier);
- }
-
- @EventHandler
- public void onWitherSkullExplode(@NotNull final EntityExplodeEvent event) {
- if (!(event.getEntity() instanceof WitherSkull)) {
- return;
- }
-
- if (event.getEntity().getMetadata("nobreak").isEmpty()) {
- return;
- }
-
- event.setCancelled(true);
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Quake.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Quake.java
deleted file mode 100644
index 382f3d2d..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Quake.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.spell;
-
-import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Collection;
-
-public class Quake extends Spell {
- public Quake() {
- super("quake");
- }
-
- @Override
- public boolean onUse(@NotNull final Player player,
- final int level,
- @NotNull final PlayerInteractEvent event) {
- int radius = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "radius-per-level") * level;
- int damage = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * level;
-
-
- Collection entities = player.getWorld().getNearbyEntities(player.getLocation(), radius, 3, radius);
-
- for (Entity entity : entities) {
- if (entity.equals(player)) {
- continue;
- }
- if (!(entity instanceof LivingEntity)) {
- continue;
- }
- if (!AntigriefManager.canInjure(player, (LivingEntity) entity)) {
- continue;
- }
-
- ((LivingEntity) entity).damage(damage);
- }
-
- return true;
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Vitalize.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Vitalize.java
deleted file mode 100644
index 887b6df8..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Vitalize.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.willfp.ecoenchants.enchantments.ecoenchants.spell;
-
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
-import org.bukkit.Location;
-import org.bukkit.Particle;
-import org.bukkit.attribute.Attribute;
-import org.bukkit.entity.Player;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.jetbrains.annotations.NotNull;
-
-public class Vitalize extends Spell {
- public Vitalize() {
- super("vitalize");
- }
-
- @Override
- public boolean onUse(@NotNull final Player player,
- final int level,
- @NotNull final PlayerInteractEvent event) {
- player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
-
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "spawn-heart-particles")) {
- spawnParticles(player);
- }
-
- return true;
- }
-
- private void spawnParticles(@NotNull final Player player) {
- Location location = player.getLocation().clone();
-
- location.add(0, 1, 0);
-
- int limit = NumberUtils.randInt(8, 13);
-
- for (int i = 0; i < limit; i++) {
- Location spawnLoc = location.clone();
- spawnLoc.add(
- NumberUtils.randFloat(-1.2, 1.2),
- NumberUtils.randFloat(-0.3, 1.2),
- NumberUtils.randFloat(-1.2, 1.2)
- );
-
- spawnLoc.getWorld().spawnParticle(
- Particle.HEART,
- spawnLoc,
- 1
- );
- }
- }
-}
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
deleted file mode 100644
index b0e40957..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Artifact.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package com.willfp.ecoenchants.enchantments.itemtypes;
-
-import com.google.common.util.concurrent.AtomicDouble;
-import com.willfp.eco.core.Prerequisite;
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import org.bukkit.Location;
-import org.bukkit.Particle;
-import org.bukkit.block.Block;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Projectile;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.ProjectileLaunchEvent;
-import org.bukkit.event.player.PlayerMoveEvent;
-import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public abstract class Artifact extends EcoEnchant {
- /**
- * The artifact particle.
- */
- private Particle particle;
-
- /**
- * The extra particle dust options.
- *
- * Used for redstone particles.
- */
- @Nullable
- private Object extra;
-
- /**
- * Create a new artifact enchantment.
- *
- * @param key The key name of the enchantment
- * @param prerequisites Optional {@link Prerequisite}s that must be met
- */
- protected Artifact(@NotNull final String key,
- @NotNull final Prerequisite... prerequisites) {
- super(key, EnchantmentType.ARTIFACT, prerequisites);
-
- if (!Prerequisite.areMet(prerequisites)) {
- HandlerList.unregisterAll(this); // Prevent events firing
- return;
- }
-
- this.particle = this.getParticle();
- this.extra = this.getDustOptions();
- }
-
- /**
- * Get the artifact particle.
- *
- * @return The artifact particle.
- */
- @NotNull
- public abstract Particle getParticle();
-
- /**
- * The extra particle dust options.
- *
- * @return The dust options.
- */
- @Nullable
- public Object getDustOptions() {
- return null;
- }
-
- @Override
- public void onBlockBreak(@NotNull final Player player,
- @NotNull final Block block,
- final int level,
- @NotNull final BlockBreakEvent event) {
- if (!this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "on-blocks").contains(block.getType().name().toLowerCase())) {
- return;
- }
-
- int amount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "amount");
- block.getWorld().spawnParticle(particle, block.getLocation().add(0.5, 0.5, 0.5), amount, 0.4, 0.4, 0.4, 0, extra, false);
- }
-
- /**
- * Called on player fly while wearing an elytra.
- *
- * @param event The event to listen for.
- */
- @EventHandler
- public void onElytra(@NotNull final PlayerMoveEvent event) {
- Player player = event.getPlayer();
-
- if (!player.isGliding()) {
- return;
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (!EnchantChecks.chestplate(player, this)) {
- return;
- }
-
- 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);
-
- 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
- public void onMeleeAttack(@NotNull final LivingEntity attacker,
- @NotNull final LivingEntity victim,
- final int level,
- @NotNull final EntityDamageByEntityEvent event) {
- double radius = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius");
-
- AtomicDouble yAtomic = new AtomicDouble(0);
-
- double yDelta = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "y-delta");
- double radiusMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-multiplier");
- double offset = NumberUtils.randFloat(0, 0.75);
-
- boolean doubleHelix = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "use-double-helix");
-
- this.getPlugin().getRunnableFactory().create(bukkitRunnable -> {
- for (int i = 0; i < 3; i++) {
- if (yAtomic.get() > victim.getHeight()) {
- bukkitRunnable.cancel();
- }
- yAtomic.addAndGet(yDelta);
- double y = yAtomic.get();
- double x = radius * NumberUtils.fastCos((y + offset) * radiusMultiplier);
- double z = radius * NumberUtils.fastSin((y + offset) * radiusMultiplier);
- Location particleLocation = victim.getLocation();
- particleLocation.add(x, y, z);
- victim.getWorld().spawnParticle(particle, particleLocation, 1, 0, 0, 0, 0, extra, false);
- if (doubleHelix) {
- Location particleLocation2 = victim.getLocation();
- particleLocation2.add(-x, y, -z);
- victim.getWorld().spawnParticle(particle, particleLocation2, 1, 0, 0, 0, 0, extra, false);
- }
- }
- }).runTaskTimerAsynchronously(0, 1);
- }
-
- @Override
- public void onProjectileLaunch(@NotNull final LivingEntity shooter,
- @NotNull final Projectile projectile,
- final int level,
- @NotNull final ProjectileLaunchEvent event) {
- int ticks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "particle-tick-delay");
-
- int noteColor;
- AtomicDouble color = new AtomicDouble(0);
- if (particle.equals(Particle.NOTE)) {
- noteColor = NumberUtils.randInt(0, 24);
- color.set((double) noteColor / 24);
- }
- final double finalColor = color.get();
-
- this.getPlugin().getRunnableFactory().create(bukkitRunnable -> {
- if (projectile.isOnGround() || projectile.isDead()) {
- bukkitRunnable.cancel();
- }
- projectile.getLocation().getWorld().spawnParticle(particle, projectile.getLocation(), 1, 0, 0, 0, finalColor, extra, true);
- }).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
deleted file mode 100644
index e1df8f6a..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java
+++ /dev/null
@@ -1,320 +0,0 @@
-package com.willfp.ecoenchants.enchantments.itemtypes;
-
-import com.willfp.eco.core.Prerequisite;
-import com.willfp.eco.core.integrations.placeholder.PlaceholderManager;
-import com.willfp.eco.core.placeholder.PlayerPlaceholder;
-import com.willfp.eco.util.StringUtils;
-import com.willfp.ecoenchants.display.EnchantmentCache;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.EcoEnchants;
-import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
-import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
-import com.willfp.ecoenchants.enchantments.util.SpellActivateEvent;
-import net.md_5.bungee.api.ChatMessageType;
-import net.md_5.bungee.api.chat.TextComponent;
-import org.bukkit.Bukkit;
-import org.bukkit.GameMode;
-import org.bukkit.Material;
-import org.bukkit.Sound;
-import org.bukkit.SoundCategory;
-import org.bukkit.Tag;
-import org.bukkit.block.Container;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.block.Action;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.inventory.BlockInventoryHolder;
-import org.bukkit.permissions.PermissionAttachmentInfo;
-import org.bukkit.util.NumberConversions;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-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.
- */
- private static final List LEFT_CLICK_ITEMS = Arrays.asList(
- Material.FISHING_ROD,
- Material.BOW,
- Material.CROSSBOW,
- Material.TRIDENT
- );
-
- /**
- * Items that don't cause spells to activate when right clicked.
- */
- private static final List BLACKLIST_CLICKED_BLOCKS = new ArrayList<>(Arrays.asList(
- Material.CRAFTING_TABLE,
- Material.GRINDSTONE,
- Material.ENCHANTING_TABLE,
- Material.FURNACE,
- Material.SMITHING_TABLE,
- Material.LEVER,
- Material.REPEATER,
- Material.COMPARATOR,
- Material.RESPAWN_ANCHOR,
- Material.NOTE_BLOCK,
- Material.ITEM_FRAME,
- Material.CHEST,
- Material.BARREL,
- Material.BEACON,
- Material.LECTERN,
- Material.FLETCHING_TABLE,
- Material.SMITHING_TABLE,
- Material.STONECUTTER,
- Material.SMOKER,
- Material.BLAST_FURNACE,
- Material.BREWING_STAND,
- Material.DISPENSER,
- Material.DROPPER,
- Material.FIRE
- ));
-
- static {
- BLACKLIST_CLICKED_BLOCKS.addAll(Tag.BUTTONS.getValues());
- BLACKLIST_CLICKED_BLOCKS.addAll(Tag.BEDS.getValues());
- BLACKLIST_CLICKED_BLOCKS.addAll(Tag.DOORS.getValues());
- BLACKLIST_CLICKED_BLOCKS.addAll(Tag.FENCE_GATES.getValues());
- BLACKLIST_CLICKED_BLOCKS.addAll(Tag.TRAPDOORS.getValues());
- BLACKLIST_CLICKED_BLOCKS.addAll(Tag.ANVIL.getValues());
- BLACKLIST_CLICKED_BLOCKS.addAll(Tag.SHULKER_BOXES.getValues());
- }
-
- /**
- * The cooldown end times linked to players.
- */
- private final Map tracker = new HashMap<>();
- /**
- * Players currently running spells - prevents listener firing twice.
- */
- private final Set preventDuplicateList = new HashSet<>();
-
- /**
- * Create a new spell enchantment.
- *
- * @param key The key name of the enchantment
- * @param prerequisites Optional {@link Prerequisite}s that must be met
- */
- protected Spell(@NotNull final String key,
- @NotNull final Prerequisite... prerequisites) {
- super(key, EnchantmentType.SPELL, prerequisites);
-
- PlaceholderManager.registerPlaceholder(
- new PlayerPlaceholder(
- this.getPlugin(),
- this.getPermissionName() + "_" + "cooldown",
- player -> StringUtils.toNiceString(getCooldown(this, player))
- )
- );
- }
-
- /**
- * Utility method to get a player's cooldown time of a specific spell.
- *
- * @param spell The spell to query.
- * @param player The player to query.
- * @return The time left in seconds before next use.
- */
- public static int getCooldown(@NotNull final Spell spell,
- @NotNull final Player player) {
- if (!spell.tracker.containsKey(player.getUniqueId())) {
- return 0;
- }
-
- long msLeft = spell.tracker.get(player.getUniqueId()) - System.currentTimeMillis();
-
- long secondsLeft = (long) Math.ceil((double) msLeft / 1000);
-
- return NumberConversions.toInt(secondsLeft);
- }
-
- /**
- * Get a multiplier for a spell cooldown.
- *
- * Used for perks..
- *
- * @param player The player to query.
- * @return The multiplier.
- */
- public static double getCooldownMultiplier(@NotNull final Player player) {
- if (player.hasPermission("ecoenchants.cooldowntime.quarter")) {
- return 0.25;
- }
-
- if (player.hasPermission("ecoenchants.cooldowntime.third")) {
- return 0.33;
- }
-
- if (player.hasPermission("ecoenchants.cooldowntime.half")) {
- return 0.5;
- }
-
- if (player.hasPermission("ecoenchants.cooldowntime.75")) {
- return 0.75;
- }
-
- String prefix = "ecoenchants.cooldowntime.";
- for (PermissionAttachmentInfo permissionAttachmentInfo : player.getEffectivePermissions()) {
- String permission = permissionAttachmentInfo.getPermission();
- if (permission.startsWith(prefix)) {
- try {
- return Double.parseDouble(permission.substring(permission.lastIndexOf(".") + 1)) / 100;
- } catch (NumberFormatException e) {
- return 1;
- }
- }
- }
-
- return 1;
- }
-
- /**
- * Get the cooldown time of the spell (in seconds).
- *
- * @return The time, in seconds.
- */
- public int getCooldownTime() {
- return this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "cooldown");
- }
-
- /**
- * Get the sound to be played on activation.
- *
- * @return The sound.
- */
- public final Sound getActivationSound() {
- return Sound.valueOf(this.getConfig().getString(EcoEnchants.CONFIG_LOCATION + "activation-sound").toUpperCase());
- }
-
- /**
- * Listener called on spell activation.
- *
- * @param event The event to listen for.
- */
- @EventHandler
- public void onUseEventHandler(@NotNull final PlayerInteractEvent event) {
- Player player = event.getPlayer();
-
- if (preventDuplicateList.contains(player.getUniqueId())) {
- return;
- }
- preventDuplicateList.add(player.getUniqueId());
- this.getPlugin().getScheduler().runLater(() -> preventDuplicateList.remove(player.getUniqueId()), 2);
-
- if (player.getGameMode() == GameMode.SPECTATOR) {
- return;
- }
-
- if (LEFT_CLICK_ITEMS.contains(player.getInventory().getItemInMainHand().getType())) {
- if (!(event.getAction().equals(Action.LEFT_CLICK_AIR) || event.getAction().equals(Action.LEFT_CLICK_BLOCK))) {
- return;
- }
- if (requiresBlockClick() && !event.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
- return;
- }
- } else {
- if (!(event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK))) {
- return;
- }
- if (requiresBlockClick() && !event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
- return;
- }
- }
-
- if (!EnchantChecks.mainhand(player, this)) {
- return;
- }
-
- int level = EnchantChecks.getMainhandLevel(player, this);
- if (this.getDisabledWorlds().contains(player.getWorld())) {
- return;
- }
-
- int cooldown = getCooldown(this, player);
-
- if (event.getClickedBlock() != null) {
- if (event.getClickedBlock().getState() instanceof Container
- || event.getClickedBlock().getState() instanceof BlockInventoryHolder
- || BLACKLIST_CLICKED_BLOCKS.contains(event.getClickedBlock().getType())) {
- return;
- }
- }
-
- if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "not-while-sneaking")) {
- if (player.isSneaking()) {
- return;
- }
- }
-
- if (!this.areRequirementsMet(player)) {
- return;
- }
-
- if (cooldown > 0) {
- if (!this.hasFlag("no-cooldown-message")) {
- if (this.getPlugin().getConfigYml().getBool("types.special.cooldown-in-actionbar")) {
- String message = this.getPlugin().getLangYml().getFormattedString("messages.on-cooldown")
- .replace("%seconds%", String.valueOf(cooldown))
- .replace("%name%", EnchantmentCache.getEntry(this).getRawName());
-
- player.spigot().sendMessage(
- ChatMessageType.ACTION_BAR,
- TextComponent.fromLegacyText(message)
- );
- } else {
- String message = this.getPlugin().getLangYml().getMessage("on-cooldown")
- .replace("%seconds%", String.valueOf(cooldown))
- .replace("%name%", EnchantmentCache.getEntry(this).getRawName());
- player.sendMessage(message);
- }
- player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_BASS, 1, 0.5f);
- }
- } else {
- SpellActivateEvent spellActivateEvent = new SpellActivateEvent(player, this);
- Bukkit.getPluginManager().callEvent(spellActivateEvent);
-
- if (!spellActivateEvent.isCancelled()) {
- if (onUse(player, level, event)) {
- if (!this.hasFlag("no-use-message")) {
- String message = this.getPlugin().getLangYml().getMessage("used-spell").replace("%name%", EnchantmentCache.getEntry(this).getRawName());
- player.sendMessage(message);
- player.playSound(player.getLocation(), this.getActivationSound(), SoundCategory.PLAYERS, 1, 1);
- }
-
- tracker.remove(player.getUniqueId());
- tracker.put(player.getUniqueId(), System.currentTimeMillis() + (long) ((this.getCooldownTime() * 1000L) * Spell.getCooldownMultiplier(player)));
- }
- }
- }
- }
-
- /**
- * Get if the spell requires a block to be clicked to trigger the spell.
- *
- * @return If the spell requires a block to be clicked.
- */
- protected boolean requiresBlockClick() {
- return false;
- }
-
- /**
- * Actual spell-specific implementations; the functionality.
- *
- * @param player The player who triggered the spell.
- * @param level The level of the spell on the item.
- * @param event The event that activated the spell.
- * @return If the spell should be activated.
- */
- public abstract boolean onUse(@NotNull Player player,
- int level,
- @NotNull PlayerInteractEvent event);
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentRarity.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentRarity.java
deleted file mode 100644
index bc5b8229..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentRarity.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package com.willfp.ecoenchants.enchantments.meta;
-
-import com.willfp.eco.core.config.updating.ConfigUpdater;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.config.RarityYml;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-
-public class EnchantmentRarity {
- /**
- * All registered rarities.
- */
- private static final Set REGISTERED = new HashSet<>();
-
- static {
- update(EcoEnchantsPlugin.getInstance());
- }
-
- /**
- * The name of the rarity.
- */
- @Getter
- private final String name;
- /**
- * The probability of getting an enchantment with this rarity from an enchanting table.
- */
- @Getter
- private final double tableProbability;
- /**
- * The minimum xp level to get an enchantment of this rarity from an enchanting table.
- */
- @Getter
- private final int minimumLevel;
- /**
- * The probability of a villager obtaining an enchantment with this rarity.
- */
- @Getter
- private final double villagerProbability;
- /**
- * The probability of an item in a loot chest having an enchantment with this rarity.
- */
- @Getter
- private final double lootProbability;
- /**
- * The custom display color, or null if not enabled.
- */
- @Getter
- private final String customColor;
-
- /**
- * Create new EnchantmentRarity.
- *
- * @param name The name of the rarity
- * @param tableProbability The probability of getting an enchantment with this rarity from an enchanting table.
- * @param minimumLevel The minimum xp level
- * @param villagerProbability The probability of a villager obtaining an enchantment with this rarity
- * @param lootProbability The probability of an item in a loot chest having an enchantment with this rarity
- * @param customColor The custom display color, or null if not enabled
- */
- public EnchantmentRarity(@NotNull final String name,
- final double tableProbability,
- final int minimumLevel,
- final double villagerProbability,
- final double lootProbability,
- @Nullable final String customColor) {
- this.name = name;
- this.tableProbability = tableProbability;
- this.minimumLevel = minimumLevel;
- this.villagerProbability = villagerProbability;
- this.lootProbability = lootProbability;
- this.customColor = customColor;
- }
-
- /**
- * Get EnchantmentRarity matching name.
- *
- * @param name The name to search for.
- * @return The matching EnchantmentRarity, or null if not found.
- */
- public static EnchantmentRarity getByName(@NotNull final String name) {
- Optional matching = REGISTERED.stream().filter(rarity -> rarity.getName().equalsIgnoreCase(name)).findFirst();
- return matching.orElse(null);
- }
-
- /**
- * Update all rarities.
- *
- * @param plugin Instance of EcoEnchants.
- */
- @ConfigUpdater
- public static void update(@NotNull final EcoEnchantsPlugin plugin) {
- RarityYml rarityYml = plugin.getRarityYml();
- List raritiesNames = rarityYml.getRarities();
- raritiesNames.forEach(rarity -> {
- double probability = rarityYml.getDouble("rarities." + rarity + ".table-probability");
- int minimumLevel = rarityYml.getInt("rarities." + rarity + ".minimum-level");
- double villagerProbability = rarityYml.getDouble("rarities." + rarity + ".villager-probability");
- double lootProbability = rarityYml.getDouble("rarities." + rarity + ".loot-probability");
- String customColor = null;
- if (rarityYml.getBool("rarities." + rarity + ".custom-color.enabled")) {
- customColor = rarityYml.getString("rarities." + rarity + ".custom-color.color");
- }
-
- new EnchantmentRarity(rarity, probability, minimumLevel, villagerProbability, lootProbability, customColor).register();
- });
- }
-
- /**
- * Get all rarities.
- *
- * @return A set of all rarities.
- */
- public static Set values() {
- return REGISTERED;
- }
-
- /**
- * Register rarity.
- */
- private void register() {
- Optional matching = REGISTERED.stream().filter(rarity -> rarity.getName().equalsIgnoreCase(name)).findFirst();
- matching.ifPresent(REGISTERED::remove);
-
- REGISTERED.add(this);
- }
-
- /**
- * Is custom color enabled.
- *
- * @return If has enabled custom color.
- */
- public boolean hasCustomColor() {
- return this.customColor != null;
- }
-
- @Override
- public boolean equals(@NotNull final Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof EnchantmentRarity that)) {
- return false;
- }
- return Objects.equals(getName(), that.getName());
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(getName());
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java
deleted file mode 100644
index c3835b62..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package com.willfp.ecoenchants.enchantments.meta;
-
-import com.google.common.collect.ImmutableSet;
-import com.willfp.eco.core.config.updating.ConfigUpdater;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import lombok.Getter;
-import org.bukkit.Material;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-
-public class EnchantmentTarget {
- /**
- * Target containing the materials from all other targets.
- */
- public static final EnchantmentTarget ALL = new EnchantmentTarget("all", new HashSet<>(), Slot.ANY);
- /**
- * All registered targets.
- */
- private static final Set REGISTERED = new HashSet<>();
-
- static {
- REGISTERED.add(ALL);
- update(EcoEnchantsPlugin.getInstance());
- }
-
- /**
- * The name of the target.
- */
- @Getter
- private final String name;
-
- /**
- * The materials of the target.
- */
- @Getter
- private final Set materials;
-
- /**
- * The slot to check for custom enchants.
- */
- @Getter
- private final Slot slot;
-
- /**
- * Create new rarity.
- *
- * @param name The name of the rarity
- * @param materials The items for the target
- */
- public EnchantmentTarget(@NotNull final String name,
- @NotNull final Set materials,
- @NotNull final Slot slot) {
- this.name = name;
- materials.removeIf(Objects::isNull);
- this.materials = materials;
- this.slot = slot;
- }
-
- /**
- * Get EnchantmentTarget matching name.
- *
- * @param name The name to search for.
- * @return The matching EnchantmentTarget, or null if not found.
- */
- public static EnchantmentTarget getByName(@NotNull final String name) {
- Optional matching = REGISTERED.stream().filter(rarity -> rarity.getName().equalsIgnoreCase(name)).findFirst();
- return matching.orElse(null);
- }
-
- /**
- * Update all targets.
- *
- * @param plugin Instance of EcoEnchants.
- */
- @ConfigUpdater
- public static void update(@NotNull final EcoEnchantsPlugin plugin) {
- List targetNames = plugin.getTargetYml().getTargets();
- ALL.materials.clear();
- targetNames.forEach(name -> {
- Set materials = plugin.getTargetYml().getTargetMaterials(name);
- new EnchantmentTarget(name, materials, plugin.getTargetYml().getSlot(name)).register();
- });
- }
-
- /**
- * Get all rarities.
- *
- * @return A set of all rarities.
- */
- public static Set values() {
- return ImmutableSet.copyOf(REGISTERED);
- }
-
- private void register() {
- Optional matching = REGISTERED.stream().filter(rarity -> rarity.getName().equalsIgnoreCase(name)).findFirst();
- matching.ifPresent(REGISTERED::remove);
- matching.ifPresent(enchantmentTarget -> ALL.getMaterials().removeAll(enchantmentTarget.getMaterials()));
- REGISTERED.add(this);
- ALL.getMaterials().addAll(this.getMaterials());
- }
-
- /**
- * Enchant slots.
- */
- public enum Slot {
- /**
- * In hands.
- */
- HANDS,
-
- /**
- * In armor.
- */
- ARMOR,
-
- /**
- * In inventory.
- */
- ANY
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java
deleted file mode 100644
index 02d2ef0e..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java
+++ /dev/null
@@ -1,253 +0,0 @@
-package com.willfp.ecoenchants.enchantments.meta;
-
-import com.google.common.collect.ImmutableList;
-import com.willfp.eco.core.config.updating.ConfigUpdater;
-import com.willfp.ecoenchants.EcoEnchantsPlugin;
-import com.willfp.ecoenchants.enchantments.EcoEnchant;
-import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
-import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.function.Supplier;
-
-public class EnchantmentType {
- /**
- * Instance of EcoEnchants.
- */
- private static final EcoEnchantsPlugin PLUGIN = EcoEnchantsPlugin.getInstance();
-
- /**
- * All registered types.
- */
- private static final List REGISTERED = new ArrayList<>();
-
- /**
- * Most enchantments are like this.
- *
- * eg: Arachnid, Telekinesis, Sharpness.
- */
- public static final EnchantmentType NORMAL = new EnchantmentType(
- "normal",
- false,
- () -> PLUGIN.getLangYml().getString("normal-color")
- );
-
- /**
- * Negative enchantments.
- *
- * eg: Curse of Decay, Curse of Vanishing.
- */
- public static final EnchantmentType CURSE = new EnchantmentType(
- "curse",
- false,
- () -> PLUGIN.getLangYml().getString("curse-color")
- );
-
- /**
- * Extremely powerful enchantments.
- *
- * eg: Razor, Force.
- */
- public static final EnchantmentType SPECIAL = new EnchantmentType(
- "special",
- () -> !PLUGIN.getConfigYml().getBool("types.special.allow-multiple"),
- () -> PLUGIN.getLangYml().getString("special-color")
- );
-
- /**
- * Cosmetic enchantments.
- *
- * eg: Ash Artifact, Totem Artifact.
- */
- public static final EnchantmentType ARTIFACT = new EnchantmentType(
- "artifact",
- () -> !PLUGIN.getConfigYml().getBool("types.artifact.allow-multiple"),
- () -> PLUGIN.getLangYml().getString("artifact-color"),
- Artifact.class
- );
-
- /**
- * Ability enchantments.
- *
- * eg: Missile, Quake.
- */
- public static final EnchantmentType SPELL = new EnchantmentType(
- "spell",
- true,
- () -> PLUGIN.getLangYml().getString("spell-color"),
- Spell.class
- );
-
- /**
- * Lambda to fetch the color of the type.
- */
- private final Supplier colorSupplier;
-
- /**
- * Lambda to fetch the singularity of the type.
- */
- private final Supplier singularSupplier;
-
- /**
- * The name of the type.
- */
- @Getter
- private final String name;
-
- /**
- * The class that all enchantments of this type must extend.
- *
- * Null if not required.
- */
- @Getter
- @Nullable
- private final Class extends EcoEnchant> requiredToExtend;
-
- /**
- * If only one enchantment of this type is allowed on an item.
- */
- @Getter
- private boolean singular;
-
- /**
- * The color of enchantments of this type to have in lore.
- */
- @Getter
- private String color;
-
- /**
- * Create simple EnchantmentType.
- *
- * Singularity and Color will not be updated using this constructor.
- *
- * @param name The name of the type.
- * @param singular Whether an item can have several enchantments of this type.
- * @param color The color for enchantments with this type in lore to have.
- */
- public EnchantmentType(@NotNull final String name,
- final boolean singular,
- @NotNull final String color) {
- this(name, () -> singular, () -> color);
- }
-
- /**
- * Create EnchantmentType with updatable color.
- *
- * Singularity will not be updated using this constructor.
- *
- * @param name The name of the type.
- * @param singular Whether an item can have several enchantments of this type.
- * @param colorSupplier Lambda to fetch the color of enchantments with this type to have. Updates on /ecoreload.
- */
- public EnchantmentType(@NotNull final String name,
- final boolean singular,
- @NotNull final Supplier colorSupplier) {
- this(name, () -> singular, colorSupplier);
- }
-
- /**
- * Create EnchantmentType with updatable color that must extend a specified class.
- *
- * Singularity will not be updated using this constructor.
- *
- * @param name The name of the type.
- * @param singular Whether an item can have several enchantments of this type.
- * @param colorSupplier Lambda to fetch the color of enchantments with this type to have. Updates on /ecoreload.
- * @param requiredToExtend Class that all enchantments of this type must extend - or null if not required.
- */
- public EnchantmentType(@NotNull final String name,
- final boolean singular,
- @NotNull final Supplier colorSupplier,
- @Nullable final Class extends EcoEnchant> requiredToExtend) {
- this(name, () -> singular, colorSupplier, requiredToExtend);
- }
-
- /**
- * Create EnchantmentType with updatable color and singularity.
- *
- * @param name The name of the type.
- * @param singularSupplier Lambda to fetch whether an item can have several enchantments of this type. Updates on /ecoreload.
- * @param colorSupplier Lambda to fetch the color of enchantments with this type to have. Updates on /ecoreload.
- */
- public EnchantmentType(@NotNull final String name,
- @NotNull final Supplier singularSupplier,
- @NotNull final Supplier colorSupplier) {
- this(name, singularSupplier, colorSupplier, null);
- }
-
- /**
- * Create EnchantmentType with updatable color and singularity that must extend a specified class.
- *
- * @param name The name of the type.
- * @param singularSupplier Lambda to fetch whether an item can have several enchantments of this type. Updates on /ecoreload.
- * @param colorSupplier Lambda to fetch the color of enchantments with this type to have. Updates on /ecoreload.
- * @param requiredToExtend Class that all enchantments of this type must extend - or null if not required.
- */
- public EnchantmentType(@NotNull final String name,
- @NotNull final Supplier singularSupplier,
- @NotNull final Supplier colorSupplier,
- @Nullable final Class extends EcoEnchant> requiredToExtend) {
- this.name = name;
- this.singularSupplier = singularSupplier;
- this.colorSupplier = colorSupplier;
- this.requiredToExtend = requiredToExtend;
- color = colorSupplier.get();
- singular = singularSupplier.get();
- REGISTERED.add(this);
- }
-
- /**
- * Get EnchantmentType matching name.
- *
- * @param name The name to search for.
- * @return The matching EnchantmentType, or null if not found.
- */
- public static EnchantmentType getByName(@NotNull final String name) {
- Optional matching = REGISTERED.stream().filter(enchantmentType -> enchantmentType.getName().equalsIgnoreCase(name)).findFirst();
- return matching.orElse(null);
- }
-
- /**
- * Update suppliers of all types.
- */
- @ConfigUpdater
- public static void update() {
- REGISTERED.forEach(EnchantmentType::refresh);
- }
-
- /**
- * All registered enchantment types.
- *
- * @return All registered types.
- */
- public static List values() {
- return ImmutableList.copyOf(REGISTERED);
- }
-
- private void refresh() {
- this.color = colorSupplier.get();
- this.singular = singularSupplier.get();
- }
-
- @Override
- public boolean equals(@NotNull final Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof EnchantmentType that)) {
- return false;
- }
- return Objects.equals(getName(), that.getName());
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(getName());
- }
-}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilListeners.java
deleted file mode 100644
index 8d1dd192..00000000
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilListeners.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package com.willfp.ecoenchants.enchantments.support.merging.anvil;
-
-import com.willfp.eco.core.EcoPlugin;
-import com.willfp.eco.core.PluginDependent;
-import com.willfp.eco.core.fast.FastItemStack;
-import com.willfp.eco.core.proxy.ProxyConstants;
-import com.willfp.eco.util.NumberUtils;
-import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy;
-import org.bukkit.Material;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.inventory.PrepareAnvilEvent;
-import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.UUID;
-
-public class AnvilListeners extends PluginDependent implements Listener {
- /**
- * Map to prevent incrementing cost several times as inventory events are fired 3 times.
- */
- private static final Map