diff --git a/build.gradle b/build.gradle index 39de726d..0886b251 100644 --- a/build.gradle +++ b/build.gradle @@ -49,7 +49,7 @@ allprojects { } dependencies { - compileOnly 'com.willfp:eco:5.0.0' + compileOnly 'com.willfp:eco:5.2.0' compileOnly 'org.jetbrains:annotations:19.0.0' diff --git a/eco-core/core-nms/build.gradle b/eco-core/core-nms/build.gradle deleted file mode 100644 index 4aa1efc1..00000000 --- a/eco-core/core-nms/build.gradle +++ /dev/null @@ -1,9 +0,0 @@ -group 'com.willfp' -version rootProject.version - -subprojects { - dependencies { - compileOnly project(':eco-core:core-proxy') - compileOnly project(':eco-core:core-plugin') - } -} \ No newline at end of file diff --git a/eco-core/core-nms/v1_16_R1/build.gradle b/eco-core/core-nms/v1_16_R1/build.gradle deleted file mode 100644 index 49623620..00000000 --- a/eco-core/core-nms/v1_16_R1/build.gradle +++ /dev/null @@ -1,6 +0,0 @@ -group 'com.willfp' -version rootProject.version - -dependencies { - compileOnly 'org.spigotmc:spigot:1.16.1-R0.1-SNAPSHOT' -} \ No newline at end of file diff --git a/eco-core/core-nms/v1_16_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R1/FastGetEnchants.java b/eco-core/core-nms/v1_16_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R1/FastGetEnchants.java deleted file mode 100644 index f1ac15ed..00000000 --- a/eco-core/core-nms/v1_16_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R1/FastGetEnchants.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_16_R1; - -import com.willfp.ecoenchants.proxy.proxies.FastGetEnchantsProxy; -import net.minecraft.server.v1_16_R1.NBTBase; -import net.minecraft.server.v1_16_R1.NBTTagCompound; -import net.minecraft.server.v1_16_R1.NBTTagList; -import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack; -import org.bukkit.craftbukkit.v1_16_R1.util.CraftNamespacedKey; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.HashMap; -import java.util.Map; - -public final class FastGetEnchants implements FastGetEnchantsProxy { - @Override - public Map getEnchantmentsOnItem(@NotNull final ItemStack itemStack) { - net.minecraft.server.v1_16_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - NBTTagList enchantmentNBT = nmsStack.getEnchantments(); - HashMap foundEnchantments = new HashMap<>(); - - for (NBTBase base : enchantmentNBT) { - NBTTagCompound compound = (NBTTagCompound) base; - String key = compound.getString("id"); - int level = '\uffff' & compound.getShort("lvl"); - - Enchantment found = Enchantment.getByKey(CraftNamespacedKey.fromStringOrNull(key)); - if (found != null) { - foundEnchantments.put(found, level); - } - } - return foundEnchantments; - } - - @Override - public int getLevelOnItem(@NotNull final ItemStack itemStack, - @NotNull final Enchantment enchantment) { - net.minecraft.server.v1_16_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - NBTTagList enchantmentNBT = nmsStack.getEnchantments(); - - for (NBTBase base : enchantmentNBT) { - NBTTagCompound compound = (NBTTagCompound) base; - String key = compound.getString("id"); - if (!key.equals(enchantment.getKey().toString())) { - continue; - } - - return '\uffff' & compound.getShort("lvl"); - } - return 0; - } -} diff --git a/eco-core/core-nms/v1_16_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R1/OpenInventory.java b/eco-core/core-nms/v1_16_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R1/OpenInventory.java deleted file mode 100644 index 7ed7bc16..00000000 --- a/eco-core/core-nms/v1_16_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R1/OpenInventory.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_16_R1; - -import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy; -import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public final class OpenInventory implements OpenInventoryProxy { - @Override - public Object getOpenInventory(@NotNull final Player player) { - return ((CraftPlayer) player).getHandle().activeContainer; - } -} diff --git a/eco-core/core-nms/v1_16_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R1/RepairCost.java b/eco-core/core-nms/v1_16_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R1/RepairCost.java deleted file mode 100644 index ffa9c164..00000000 --- a/eco-core/core-nms/v1_16_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R1/RepairCost.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_16_R1; - -import com.willfp.ecoenchants.proxy.proxies.RepairCostProxy; -import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public final class RepairCost implements RepairCostProxy { - @Override - public ItemStack setRepairCost(@NotNull final ItemStack itemStack, - final int cost) { - net.minecraft.server.v1_16_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - nmsStack.setRepairCost(cost); - return CraftItemStack.asBukkitCopy(nmsStack); - } - - @Override - public int getRepairCost(@NotNull final ItemStack itemStack) { - net.minecraft.server.v1_16_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - return nmsStack.getRepairCost(); - } -} diff --git a/eco-core/core-nms/v1_16_R2/build.gradle b/eco-core/core-nms/v1_16_R2/build.gradle deleted file mode 100644 index 3f4d50cf..00000000 --- a/eco-core/core-nms/v1_16_R2/build.gradle +++ /dev/null @@ -1,6 +0,0 @@ -group 'com.willfp' -version rootProject.version - -dependencies { - compileOnly 'org.spigotmc:spigot:1.16.3-R0.1-SNAPSHOT' -} \ No newline at end of file diff --git a/eco-core/core-nms/v1_16_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R2/FastGetEnchants.java b/eco-core/core-nms/v1_16_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R2/FastGetEnchants.java deleted file mode 100644 index a82894b4..00000000 --- a/eco-core/core-nms/v1_16_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R2/FastGetEnchants.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_16_R2; - -import com.willfp.ecoenchants.proxy.proxies.FastGetEnchantsProxy; -import net.minecraft.server.v1_16_R2.NBTBase; -import net.minecraft.server.v1_16_R2.NBTTagCompound; -import net.minecraft.server.v1_16_R2.NBTTagList; -import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack; -import org.bukkit.craftbukkit.v1_16_R2.util.CraftNamespacedKey; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.HashMap; -import java.util.Map; - -public final class FastGetEnchants implements FastGetEnchantsProxy { - @Override - public Map getEnchantmentsOnItem(@NotNull final ItemStack itemStack) { - net.minecraft.server.v1_16_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - NBTTagList enchantmentNBT = nmsStack.getEnchantments(); - HashMap foundEnchantments = new HashMap<>(); - - for (NBTBase base : enchantmentNBT) { - NBTTagCompound compound = (NBTTagCompound) base; - String key = compound.getString("id"); - int level = '\uffff' & compound.getShort("lvl"); - - Enchantment found = Enchantment.getByKey(CraftNamespacedKey.fromStringOrNull(key)); - if (found != null) { - foundEnchantments.put(found, level); - } - } - return foundEnchantments; - } - - @Override - public int getLevelOnItem(@NotNull final ItemStack itemStack, - @NotNull final Enchantment enchantment) { - net.minecraft.server.v1_16_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - NBTTagList enchantmentNBT = nmsStack.getEnchantments(); - - for (NBTBase base : enchantmentNBT) { - NBTTagCompound compound = (NBTTagCompound) base; - String key = compound.getString("id"); - if (!key.equals(enchantment.getKey().toString())) { - continue; - } - - return '\uffff' & compound.getShort("lvl"); - } - return 0; - } -} diff --git a/eco-core/core-nms/v1_16_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R2/OpenInventory.java b/eco-core/core-nms/v1_16_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R2/OpenInventory.java deleted file mode 100644 index ff876898..00000000 --- a/eco-core/core-nms/v1_16_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R2/OpenInventory.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_16_R2; - -import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy; -import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public final class OpenInventory implements OpenInventoryProxy { - @Override - public Object getOpenInventory(@NotNull final Player player) { - return ((CraftPlayer) player).getHandle().activeContainer; - } -} diff --git a/eco-core/core-nms/v1_16_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R2/RepairCost.java b/eco-core/core-nms/v1_16_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R2/RepairCost.java deleted file mode 100644 index fd0cc8c5..00000000 --- a/eco-core/core-nms/v1_16_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R2/RepairCost.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_16_R2; - -import com.willfp.ecoenchants.proxy.proxies.RepairCostProxy; -import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public final class RepairCost implements RepairCostProxy { - @Override - public ItemStack setRepairCost(@NotNull final ItemStack itemStack, - final int cost) { - net.minecraft.server.v1_16_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - nmsStack.setRepairCost(cost); - return CraftItemStack.asBukkitCopy(nmsStack); - } - - @Override - public int getRepairCost(@NotNull final ItemStack itemStack) { - net.minecraft.server.v1_16_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - return nmsStack.getRepairCost(); - } -} diff --git a/eco-core/core-nms/v1_16_R3/build.gradle b/eco-core/core-nms/v1_16_R3/build.gradle deleted file mode 100644 index 5930f17d..00000000 --- a/eco-core/core-nms/v1_16_R3/build.gradle +++ /dev/null @@ -1,6 +0,0 @@ -group 'com.willfp' -version rootProject.version - -dependencies { - compileOnly 'org.spigotmc:spigot:1.16.4-R0.1-SNAPSHOT' -} \ No newline at end of file diff --git a/eco-core/core-nms/v1_16_R3/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R3/FastGetEnchants.java b/eco-core/core-nms/v1_16_R3/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R3/FastGetEnchants.java deleted file mode 100644 index af748a63..00000000 --- a/eco-core/core-nms/v1_16_R3/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R3/FastGetEnchants.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_16_R3; - -import com.willfp.ecoenchants.proxy.proxies.FastGetEnchantsProxy; -import net.minecraft.server.v1_16_R3.NBTBase; -import net.minecraft.server.v1_16_R3.NBTTagCompound; -import net.minecraft.server.v1_16_R3.NBTTagList; -import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack; -import org.bukkit.craftbukkit.v1_16_R3.util.CraftNamespacedKey; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.HashMap; -import java.util.Map; - -public final class FastGetEnchants implements FastGetEnchantsProxy { - @Override - public Map getEnchantmentsOnItem(@NotNull final ItemStack itemStack) { - net.minecraft.server.v1_16_R3.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - NBTTagList enchantmentNBT = nmsStack.getEnchantments(); - HashMap foundEnchantments = new HashMap<>(); - - for (NBTBase base : enchantmentNBT) { - NBTTagCompound compound = (NBTTagCompound) base; - String key = compound.getString("id"); - int level = '\uffff' & compound.getShort("lvl"); - - Enchantment found = Enchantment.getByKey(CraftNamespacedKey.fromStringOrNull(key)); - if (found != null) { - foundEnchantments.put(found, level); - } - } - return foundEnchantments; - } - - @Override - public int getLevelOnItem(@NotNull final ItemStack itemStack, - @NotNull final Enchantment enchantment) { - net.minecraft.server.v1_16_R3.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - NBTTagList enchantmentNBT = nmsStack.getEnchantments(); - - for (NBTBase base : enchantmentNBT) { - NBTTagCompound compound = (NBTTagCompound) base; - String key = compound.getString("id"); - if (!key.equals(enchantment.getKey().toString())) { - continue; - } - - return '\uffff' & compound.getShort("lvl"); - } - return 0; - } -} diff --git a/eco-core/core-nms/v1_16_R3/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R3/OpenInventory.java b/eco-core/core-nms/v1_16_R3/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R3/OpenInventory.java deleted file mode 100644 index c6549c6b..00000000 --- a/eco-core/core-nms/v1_16_R3/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R3/OpenInventory.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_16_R3; - -import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy; -import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public final class OpenInventory implements OpenInventoryProxy { - @Override - public Object getOpenInventory(@NotNull final Player player) { - return ((CraftPlayer) player).getHandle().activeContainer; - } -} diff --git a/eco-core/core-nms/v1_16_R3/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R3/RepairCost.java b/eco-core/core-nms/v1_16_R3/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R3/RepairCost.java deleted file mode 100644 index fc4e6868..00000000 --- a/eco-core/core-nms/v1_16_R3/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R3/RepairCost.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_16_R3; - -import com.willfp.ecoenchants.proxy.proxies.RepairCostProxy; -import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public final class RepairCost implements RepairCostProxy { - @Override - public ItemStack setRepairCost(@NotNull final ItemStack itemStack, - final int cost) { - net.minecraft.server.v1_16_R3.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - nmsStack.setRepairCost(cost); - return CraftItemStack.asBukkitCopy(nmsStack); - } - - @Override - public int getRepairCost(@NotNull final ItemStack itemStack) { - net.minecraft.server.v1_16_R3.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - return nmsStack.getRepairCost(); - } -} diff --git a/eco-core/core-plugin/build.gradle b/eco-core/core-plugin/build.gradle index bea24b39..c9c7dd90 100644 --- a/eco-core/core-plugin/build.gradle +++ b/eco-core/core-plugin/build.gradle @@ -2,7 +2,6 @@ group 'com.willfp' version rootProject.version dependencies { - compileOnly project(":eco-core:core-proxy") compileOnly 'org.spigotmc:spigot:1.16.4-R0.1-SNAPSHOT' compileOnly 'commons-io:commons-io:2.8.0' compileOnly 'com.comphenix.protocol:ProtocolLib:4.6.0-SNAPSHOT' diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java deleted file mode 100644 index 249493be..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.willfp.ecoenchants; - -import com.willfp.eco.core.AbstractPacketAdapter; -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.command.AbstractCommand; -import com.willfp.eco.core.display.DisplayModule; -import com.willfp.eco.core.integrations.IntegrationLoader; -import com.willfp.eco.util.TelekinesisUtils; -import com.willfp.ecoenchants.command.commands.CommandEcodebug; -import com.willfp.ecoenchants.command.commands.CommandEcoreload; -import com.willfp.ecoenchants.command.commands.CommandEnchantinfo; -import com.willfp.ecoenchants.command.commands.CommandGiverandombook; -import com.willfp.ecoenchants.command.commands.CommandRandomenchant; -import com.willfp.ecoenchants.command.tabcompleters.TabCompleterEnchantinfo; -import com.willfp.ecoenchants.config.RarityYml; -import com.willfp.ecoenchants.config.TargetYml; -import com.willfp.ecoenchants.display.EnchantDisplay; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -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.support.merging.anvil.AnvilListeners; -import com.willfp.ecoenchants.enchantments.support.merging.grindstone.GrindstoneListeners; -import com.willfp.ecoenchants.enchantments.support.obtaining.EnchantingListeners; -import com.willfp.ecoenchants.enchantments.support.obtaining.LootPopulator; -import com.willfp.ecoenchants.enchantments.support.obtaining.VillagerListeners; -import com.willfp.ecoenchants.enchantments.util.ItemConversions; -import com.willfp.ecoenchants.enchantments.util.TimedRunnable; -import com.willfp.ecoenchants.enchantments.util.WatcherTriggers; -import com.willfp.ecoenchants.integrations.essentials.EssentialsManager; -import com.willfp.ecoenchants.integrations.essentials.plugins.IntegrationEssentials; -import com.willfp.ecoenchants.proxy.proxies.FastGetEnchantsProxy; -import com.willfp.ecoenchants.util.ProxyUtils; -import lombok.Getter; -import org.bukkit.Bukkit; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.generator.BlockPopulator; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -@SuppressWarnings("unused") -public class EcoEnchantsPlugin extends EcoPlugin { - /** - * Instance of the plugin. - */ - @Getter - private static EcoEnchantsPlugin instance; - - /** - * Rarity.yml. - */ - @Getter - private final RarityYml rarityYml; - - /** - * Target.yml. - */ - @Getter - private final TargetYml targetYml; - - /** - * Internal constructor called by bukkit on plugin load. - */ - public EcoEnchantsPlugin() { - super("EcoEnchants", 79573, 7666, "com.willfp.ecoenchants.proxy", "&a"); - instance = this; - - rarityYml = new RarityYml(this); - targetYml = new TargetYml(this); - } - - /** - * Code executed on plugin enable. - */ - @Override - public void enable() { - this.getExtensionLoader().loadExtensions(); - - if (this.getExtensionLoader().getLoadedExtensions().isEmpty()) { - this.getLogger().info("&cNo extensions found"); - } else { - this.getLogger().info("Extensions Loaded:"); - this.getExtensionLoader().getLoadedExtensions().forEach(extension -> this.getLogger().info("- " + extension.getName() + " v" + extension.getVersion())); - } - - this.getLogger().info(EcoEnchants.values().size() + " Enchantments Loaded"); - - TelekinesisUtils.registerTest(player -> ProxyUtils.getProxy(FastGetEnchantsProxy.class).getLevelOnItem(player.getInventory().getItemInMainHand(), EcoEnchants.TELEKINESIS) > 0); - } - - /** - * Code executed on plugin disable. - */ - @Override - public void disable() { - Bukkit.getServer().getWorlds().forEach(world -> { - List populators = new ArrayList<>(world.getPopulators()); - populators.forEach((blockPopulator -> { - if (blockPopulator instanceof LootPopulator) { - world.getPopulators().remove(blockPopulator); - } - })); - }); - - this.getExtensionLoader().unloadExtensions(); - } - - /** - * Nothing is called on plugin load. - */ - @Override - public void load() { - // Nothing needs to be called on load - } - - /** - * Code executed on /ecoreload. - */ - @Override - public void onReload() { - targetYml.update(); - rarityYml.update(); - ((EnchantDisplay) this.getDisplayModule()).update(); - EcoEnchants.values().forEach((ecoEnchant -> { - HandlerList.unregisterAll(ecoEnchant); - - this.getScheduler().runLater(() -> { - if (ecoEnchant.isEnabled()) { - this.getEventManager().registerListener(ecoEnchant); - - if (ecoEnchant instanceof TimedRunnable) { - this.getScheduler().syncRepeating((TimedRunnable) ecoEnchant, 5, ((TimedRunnable) ecoEnchant).getTime()); - } - } - }, 1); - })); - } - - /** - * Code executed after server is up. - */ - @Override - public void postLoad() { - if (this.getConfigYml().getBool("loot.enabled")) { - Bukkit.getServer().getWorlds().forEach(world -> { - List populators = new ArrayList<>(world.getPopulators()); - populators.forEach((blockPopulator -> { - if (blockPopulator instanceof LootPopulator) { - world.getPopulators().remove(blockPopulator); - } - })); - world.getPopulators().add(new LootPopulator(this)); - }); - } - EssentialsManager.registerEnchantments(); - } - - /** - * EcoEnchants-specific integrations. - * - * @return A list of all integrations. - */ - @Override - public List getIntegrationLoaders() { - return Arrays.asList( - new IntegrationLoader("Essentials", () -> EssentialsManager.register(new IntegrationEssentials())) - ); - } - - /** - * EcoEnchants-specific commands. - * - * @return A list of all commands. - */ - @Override - public List getCommands() { - return Arrays.asList( - new CommandEcodebug(this), - new CommandEcoreload(this), - new CommandEnchantinfo(this), - new CommandRandomenchant(this), - new CommandGiverandombook(this) - ); - } - - /** - * Packet Adapters for enchant display. - * - * @return A list of packet adapters. - */ - @Override - public List getPacketAdapters() { - return new ArrayList<>(); - } - - /** - * EcoEnchants-specific listeners. - * - * @return A list of all listeners. - */ - @Override - public List getListeners() { - return Arrays.asList( - new EnchantingListeners(this), - new GrindstoneListeners(this), - new AnvilListeners(this), - new WatcherTriggers(this), - new VillagerListeners(this), - new ItemConversions(this) - ); - } - - @Override - public List> getUpdatableClasses() { - return Arrays.asList( - EnchantmentCache.class, - EnchantmentRarity.class, - EnchantmentTarget.class, - EcoEnchants.class, - TabCompleterEnchantinfo.class, - EnchantmentType.class, - WatcherTriggers.class - ); - } - - @Override - @Nullable - protected DisplayModule createDisplayModule() { - return new EnchantDisplay(this); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEcodebug.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEcodebug.java deleted file mode 100644 index 98d407e0..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEcodebug.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.willfp.ecoenchants.command.commands; - -import com.comphenix.protocol.ProtocolLibrary; -import com.comphenix.protocol.events.ListenerPriority; -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.command.AbstractCommand; -import com.willfp.eco.core.proxy.ProxyConstants; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -@SuppressWarnings("unchecked") -public class CommandEcodebug extends AbstractCommand { - /** - * Instantiate a new /ecodebug command handler. - * - * @param plugin The plugin for the commands to listen for. - */ - public CommandEcodebug(@NotNull final EcoPlugin plugin) { - super(plugin, "ecodebug", "ecoenchants.ecodebug", false); - } - - @Override - public void onExecute(@NotNull final CommandSender sender, - @NotNull final List args) { - if (!args.isEmpty() && args.get(0).equalsIgnoreCase("full")) { - Bukkit.getLogger().info("--------------- BEGIN DEBUG ----------------"); - if (sender instanceof Player) { - Player player = (Player) sender; - player.sendMessage("Held Item: " + player.getInventory().getItemInMainHand().toString()); - Bukkit.getLogger().info(""); - - Bukkit.getLogger().info("Held Item: " + player.getInventory().getItemInMainHand().toString()); - Bukkit.getLogger().info(""); - } - - Bukkit.getLogger().info("Running Version: " + this.getPlugin().getDescription().getVersion()); - Bukkit.getLogger().info(""); - - Bukkit.getLogger().info("Loaded Extensions: " + this.getPlugin().getExtensionLoader().getLoadedExtensions().stream() - .map(extension -> extension.getName() + " v" + extension.getVersion()) - .collect(Collectors.joining())); - Bukkit.getLogger().info(""); - - Bukkit.getLogger().info("EcoEnchants.getAll(): " + EcoEnchants.values().toString()); - Bukkit.getLogger().info(""); - - Bukkit.getLogger().info("Enchantment.values(): " + Arrays.toString(Enchantment.values())); - Bukkit.getLogger().info(""); - - Bukkit.getLogger().info("Enchantment Cache: " + EnchantmentCache.getCache().toString()); - Bukkit.getLogger().info(""); - - try { - Field byNameField = Enchantment.class.getDeclaredField("byName"); - byNameField.setAccessible(true); - Map byName = (Map) byNameField.get(null); - Bukkit.getLogger().info("Enchantment.byName: " + byName.toString()); - } catch (NoSuchFieldException | IllegalAccessException e) { - e.printStackTrace(); - } - Bukkit.getLogger().info(""); - - - List extern = Arrays.stream(Enchantment.values()).collect(Collectors.toList()); - extern.removeAll(EcoEnchants.values().stream().map(EcoEnchant::getEnchantment).collect(Collectors.toList())); - extern.removeIf(enchantment -> enchantment.getClass().toString().toLowerCase().contains("craftbukkit")); - String external = extern.stream().map(enchantment -> "{" + enchantment.toString() + ", Provider: " + enchantment.getClass().toString() + "}").collect(Collectors.joining(", ")); - Bukkit.getLogger().info("External Enchantments: " + external); - Bukkit.getLogger().info(""); - - List uncached = Arrays.stream(Enchantment.values()).collect(Collectors.toList()); - uncached.removeAll(EnchantmentCache.getCache().values().stream().map(EnchantmentCache.CacheEntry::getEnchantment).collect(Collectors.toList())); - Bukkit.getLogger().info("Uncached Enchantments: " + uncached.toString()); - Bukkit.getLogger().info(""); - - List brokenCache = Arrays.stream(Enchantment.values()).collect(Collectors.toList()); - brokenCache.removeIf(enchantment -> !( - EnchantmentCache.getEntry(enchantment).getName().equalsIgnoreCase("null") - || EnchantmentCache.getEntry(enchantment).getRawName().equalsIgnoreCase("null") - || EnchantmentCache.getEntry(enchantment).getStringDescription().equalsIgnoreCase("null"))); - Bukkit.getLogger().info("Enchantments with broken cache: " + brokenCache.toString()); - Bukkit.getLogger().info(""); - - Bukkit.getLogger().info("Installed Plugins: " + Arrays.stream(Bukkit.getPluginManager().getPlugins()).map(Plugin::getName).collect(Collectors.toList()).toString()); - Bukkit.getLogger().info(""); - - Set withIssues = new HashSet<>(); - EcoEnchants.values().forEach(enchant -> { - if (enchant.getRarity() == null) { - withIssues.add(enchant); - } - if (enchant.getTargets().isEmpty()) { - withIssues.add(enchant); - } - }); - Bukkit.getLogger().info("Enchantments with evident issues: " + withIssues.toString()); - Bukkit.getLogger().info(""); - - Bukkit.getLogger().info("Packets: " + ProtocolLibrary.getProtocolManager().getPacketListeners().stream() - .filter(packetListener -> packetListener.getSendingWhitelist().getPriority().equals(ListenerPriority.MONITOR)) - .collect(Collectors.toList()).toString()); - Bukkit.getLogger().info(""); - - Bukkit.getLogger().info("Server Information: "); - Bukkit.getLogger().info("Players Online: " + Bukkit.getServer().getOnlinePlayers().size()); - Bukkit.getLogger().info("Bukkit IP: " + Bukkit.getIp()); - Bukkit.getLogger().info("Running Version: " + Bukkit.getVersion() - + ", Bukkit Version: " + Bukkit.getBukkitVersion() - + ", Alt Version: " + Bukkit.getServer().getVersion() - + ", NMS: " + ProxyConstants.NMS_VERSION); - Bukkit.getLogger().info("Motd: " + Bukkit.getServer().getMotd()); - Bukkit.getLogger().info("--------------- END DEBUG ----------------"); - } else { - if (sender instanceof Player) { - Player player = (Player) sender; - player.sendMessage("Held Item: " + player.getInventory().getItemInMainHand().toString()); - player.sendMessage("Lore: "); - Bukkit.getLogger().info(""); - - Bukkit.getLogger().info("Held Item: " + player.getInventory().getItemInMainHand().toString()); - 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/commands/CommandEnchantinfo.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEnchantinfo.java deleted file mode 100644 index 05f7545c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEnchantinfo.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.willfp.ecoenchants.command.commands; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.command.AbstractCommand; -import com.willfp.eco.core.command.AbstractTabCompleter; -import com.willfp.eco.util.StringUtils; -import com.willfp.ecoenchants.command.tabcompleters.TabCompleterEnchantinfo; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -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.jetbrains.annotations.NotNull; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class CommandEnchantinfo extends AbstractCommand { - /** - * 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.enchantinfo", false); - } - - @Override - public AbstractTabCompleter getTab() { - return new TabCompleterEnchantinfo(this); - } - - @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.getName()).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 -> { - EcoEnchant ecoEnchant = EcoEnchants.getFromEnchantment(enchantment1); - if (ecoEnchant != null && !ecoEnchant.isEnabled()) { - conflicts.remove(enchantment1); - } - }); - - conflicts.forEach((enchantment1 -> { - if (EcoEnchants.getFromEnchantment(enchantment1) != null) { - conflictNames.add(EcoEnchants.getFromEnchantment(enchantment1).getName()); - } else { - conflictNames.add(this.getPlugin().getLangYml().getString("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 = StringUtils.translate(this.getPlugin().getLangYml().getString("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 = StringUtils.translate(this.getPlugin().getLangYml().getString("no-targets")); - } - - String maxLevel = String.valueOf(enchantment.getMaxLevel()); - - final String finalName = EnchantmentCache.getEntry(enchantment).getName(); - final String finalDescription = EnchantmentCache.getEntry(enchantment).getStringDescription(); - 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("%target%", finalTargets) - .replace("%conflicts%", finalConflicts) - .replace("%maxlevel%", finalMaxLevel); - sender.sendMessage(string); - })); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandGiverandombook.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandGiverandombook.java deleted file mode 100644 index e982eb93..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandGiverandombook.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.willfp.ecoenchants.command.commands; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.command.AbstractCommand; -import com.willfp.eco.core.command.AbstractTabCompleter; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.command.tabcompleters.TabCompleterRandomEnchant; -import com.willfp.ecoenchants.display.EnchantmentCache; -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.jetbrains.annotations.NotNull; - -import java.util.List; - -public class CommandGiverandombook extends AbstractCommand { - /** - * Instantiate a new /ecoreload command handler. - * - * @param plugin The plugin for the commands to listen for. - */ - public CommandGiverandombook(@NotNull final EcoPlugin plugin) { - super(plugin, "giverandombook", "ecoenchants.randombook", false); - } - - @Override - public AbstractTabCompleter getTab() { - return new TabCompleterRandomEnchant(this); - } - - @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)); - - if (player == null) { - sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-player")); - return; - } - - ItemStack itemStack = new ItemStack(Material.ENCHANTED_BOOK); - EnchantmentStorageMeta meta = (EnchantmentStorageMeta) itemStack.getItemMeta(); - Enchantment enchantment = Enchantment.values()[NumberUtils.randInt(0, Enchantment.values().length - 1)]; - int level = NumberUtils.randInt(1, enchantment.getMaxLevel()); - meta.addStoredEnchant(enchantment, level, true); - itemStack.setItemMeta(meta); - - 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); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandRandomenchant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandRandomenchant.java deleted file mode 100644 index 3371010d..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandRandomenchant.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.willfp.ecoenchants.command.commands; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.command.AbstractCommand; -import com.willfp.eco.core.command.AbstractTabCompleter; -import com.willfp.ecoenchants.command.tabcompleters.TabCompleterRandomEnchant; -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.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class CommandRandomenchant extends AbstractCommand { - /** - * 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.randomenchant", false); - } - - @Override - public AbstractTabCompleter getTab() { - return new TabCompleterRandomEnchant(this); - } - - @Override - public void onExecute(@NotNull final CommandSender sender, - @NotNull final List args) { - Player player; - - if ((args.isEmpty() && sender instanceof Player) || !sender.hasPermission("ecoenchants.randomenchant.others")) { - player = (Player) sender; - } else { - player = Bukkit.getServer().getPlayer(args.get(0)); - } - - 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 (onItem.stream().noneMatch(enchantment -> enchantment.conflictsWith(ecoEnchant))) { - if (!onItem.contains(ecoEnchant)) { - boolean conflicts = false; - for (Enchantment enchantment : onItem) { - if (EcoEnchants.getFromEnchantment(enchantment) != null) { - EcoEnchant ecoEnchantOnItem = EcoEnchants.getFromEnchantment(enchantment); - if (ecoEnchantOnItem.getType().equals(ecoEnchant.getType()) && ecoEnchantOnItem.getType().isSingular()) { - conflicts = true; - } - } - } - if (this.getPlugin().getConfigYml().getBool("anvil.hard-cap.enabled") - && !player.hasPermission("ecoenchants.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); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/tabcompleters/TabCompleterEnchantinfo.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/tabcompleters/TabCompleterEnchantinfo.java deleted file mode 100644 index fc4bb9a2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/tabcompleters/TabCompleterEnchantinfo.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.willfp.ecoenchants.command.tabcompleters; - -import com.willfp.eco.core.command.AbstractCommand; -import com.willfp.eco.core.command.AbstractTabCompleter; -import com.willfp.eco.core.config.ConfigUpdater; -import com.willfp.eco.util.StringUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -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 TabCompleterEnchantinfo extends AbstractTabCompleter { - /** - * The cached enchantment names. - */ - private static final List ENCHANT_NAMES = EcoEnchants.values().stream().filter(EcoEnchant::isEnabled).map(EcoEnchant::getName).map(ChatColor::stripColor).collect(Collectors.toList()); - - /** - * Instantiate a new tab-completer for /enchantinfo. - * - * @param command /enchantinfo. - */ - public TabCompleterEnchantinfo(@NotNull final AbstractCommand command) { - super(command); - } - - /** - * Called on /ecoreload. - */ - @ConfigUpdater - public static void reload() { - ENCHANT_NAMES.clear(); - ENCHANT_NAMES.addAll(EcoEnchants.values().stream().filter(EcoEnchant::isEnabled).map(EcoEnchant::getName).map(ChatColor::stripColor).collect(Collectors.toList())); - } - - /** - * The execution of the tabcompleter. - * - * @param sender The sender of the command. - * @param args The arguments of the command. - * @return A list of tab-completions. - */ - @Override - public List onTab(@NotNull final CommandSender sender, - @NotNull final List args) { - List completions = new ArrayList<>(); - - if (args.isEmpty()) { - // Currently, this case is not ever reached - return ENCHANT_NAMES; - } - - StringUtil.copyPartialMatches(String.join(" ", args), ENCHANT_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/tabcompleters/TabCompleterRandomEnchant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/tabcompleters/TabCompleterRandomEnchant.java deleted file mode 100644 index 4f32c00b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/tabcompleters/TabCompleterRandomEnchant.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.willfp.ecoenchants.command.tabcompleters; - -import com.willfp.eco.core.command.AbstractCommand; -import com.willfp.eco.core.command.AbstractTabCompleter; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -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 TabCompleterRandomEnchant extends AbstractTabCompleter { - /** - * Instantiate a new tab-completer for /randomenchant. - * - * @param command /randomenchant. - */ - public TabCompleterRandomEnchant(@NotNull final AbstractCommand command) { - super(command); - } - - /** - * The execution of the tabcompleter. - * - * @param sender The sender of the command. - * @param args The arguments of the command. - * @return A list of tab-completions. - */ - @Override - public List onTab(@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.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/config/RarityYml.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/RarityYml.java deleted file mode 100644 index 86a63bac..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/RarityYml.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.willfp.ecoenchants.config; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.config.BaseConfig; -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", false, plugin); - } - - /** - * 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 b32e51eb..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/TargetYml.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.willfp.ecoenchants.config; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.config.BaseConfig; -import org.bukkit.Material; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.List; -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", false, plugin); - } - - /** - * 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())); - }); - - return materials; - } -} 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 8246705a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.willfp.ecoenchants.config.configs; - -import com.willfp.eco.core.config.ExtendableConfig; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import lombok.Getter; -import org.bukkit.Bukkit; -import org.bukkit.NamespacedKey; -import org.bukkit.enchantments.Enchantment; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class EnchantmentConfig extends ExtendableConfig { - /** - * The name of the config. - */ - @Getter - private final String name; - - /** - * Instantiate a new config for an enchantment. - * - * @param name The name of the config. - * @param plugin The provider of the enchantment. - * @param type The {@link EnchantmentType} of the enchantment. - */ - public EnchantmentConfig(@NotNull final String name, - @NotNull final Class plugin, - @NotNull final EnchantmentType type) { - super(name, true, EcoEnchantsPlugin.getInstance(), plugin, "enchants/" + type.getName() + "/"); - this.name = name; - } - - /** - * 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); - enchantmentKeys.forEach((key -> 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.getName())) { - return; - } - - this.set("name", this.getPlugin().getLangYml().getString("enchantments." + this.getName() + ".name")); - this.set("description", this.getPlugin().getLangYml().getString("enchantments." + this.getName() + ".description")); - try { - this.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 c816c6bc..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java +++ /dev/null @@ -1,253 +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.util.NumberUtils; -import com.willfp.ecoenchants.display.options.DisplayOptions; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import com.willfp.ecoenchants.proxy.proxies.FastGetEnchantsProxy; -import com.willfp.ecoenchants.util.ProxyUtils; -import lombok.Getter; -import org.bukkit.NamespacedKey; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemFlag; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.persistence.PersistentDataType; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; - -/** - * 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.HIGH); - 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 - protected void display(@NotNull final ItemStack itemStack, - @NotNull final Object... args) { - if (options.isRequireTarget()) { - if (!EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) { - return; - } - } - - ItemMeta meta = itemStack.getItemMeta(); - - assert meta != null; - - boolean hide = (boolean) args[0]; - - List itemLore = null; - - if (hide || meta.getPersistentDataContainer().has(keySkip, PersistentDataType.INTEGER)) { - meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); - if (meta instanceof EnchantmentStorageMeta) { - meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); - } - meta.getPersistentDataContainer().set(keySkip, PersistentDataType.INTEGER, 1); - itemStack.setItemMeta(meta); - return; - } - - if (meta.hasLore()) { - itemLore = meta.getLore(); - } - - if (itemLore == null) { - itemLore = new ArrayList<>(); - } - - List lore = new ArrayList<>(); - - LinkedHashMap enchantments = new LinkedHashMap<>(); - List forRemoval = new ArrayList<>(); - - if (meta instanceof EnchantmentStorageMeta) { - enchantments.putAll(((EnchantmentStorageMeta) meta).getStoredEnchants()); - } else { - enchantments.putAll(meta.getEnchants()); - } - - enchantments.entrySet().removeIf(enchantmentIntegerEntry -> enchantmentIntegerEntry.getValue().equals(0)); - - List unsorted = new ArrayList<>(); - enchantments.forEach((enchantment, integer) -> unsorted.add(enchantment)); - - HashMap tempEnchantments = new HashMap<>(enchantments); - - options.getSorter().sortEnchantments(unsorted); - - enchantments.clear(); - unsorted.forEach(enchantment -> enchantments.put(enchantment, tempEnchantments.get(enchantment))); - - enchantments.forEach((enchantment, level) -> { - if (EcoEnchants.getFromEnchantment(enchantment) == null) { - return; - } - - EcoEnchant ecoEnchant = EcoEnchants.getFromEnchantment(enchantment); - - if (!ecoEnchant.isEnabled()) { - forRemoval.add(enchantment); - } - }); - - forRemoval.forEach(enchantment -> { - enchantments.remove(enchantment); - if (meta instanceof EnchantmentStorageMeta) { - ((EnchantmentStorageMeta) meta).removeStoredEnchant(enchantment); - } else { - meta.removeEnchant(enchantment); - } - }); - - enchantments.forEach((enchantment, level) -> { - String name = EnchantmentCache.getEntry(enchantment).getName(); - - if (!(enchantment.getMaxLevel() == 1 && level == 1)) { - if (options.getNumbersOptions().isUseNumerals() && ProxyUtils.getProxy(FastGetEnchantsProxy.class).getLevelOnItem(itemStack, enchantment) < options.getNumbersOptions().getThreshold()) { - name += " " + NumberUtils.toNumeral(level); - } else { - name += " " + level; - } - } - - lore.add(Display.PREFIX + name); - if (enchantments.size() <= options.getDescriptionOptions().getThreshold() && options.getDescriptionOptions().isEnabled()) { - lore.addAll(EnchantmentCache.getEntry(enchantment).getDescription()); - } - }); - - 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 (meta instanceof EnchantmentStorageMeta) { - meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); - } - - meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); - lore.addAll(itemLore); - meta.setLore(lore); - itemStack.setItemMeta(meta); - } - - @Override - protected void revert(@NotNull final ItemStack itemStack) { - ItemMeta meta = itemStack.getItemMeta(); - - assert meta != null; - - List lore = meta.getLore() == null ? new ArrayList<>() : new ArrayList<>(meta.getLore()); - - lore.removeIf(s -> s.startsWith("§w")); - meta.setLore(lore); - - meta.getPersistentDataContainer().remove(legacyV); - - if (!meta.getPersistentDataContainer().has(keySkip, PersistentDataType.INTEGER)) { - meta.removeItemFlags(ItemFlag.HIDE_POTION_EFFECTS); - meta.removeItemFlags(ItemFlag.HIDE_ENCHANTS); - } - - meta.getPersistentDataContainer().remove(keySkip); - itemStack.setItemMeta(meta); - } - - @Override - protected Object[] generateVarArgs(@NotNull final ItemStack itemStack) { - ItemMeta meta = itemStack.getItemMeta(); - if (meta == null) { - return new Object[]{false}; - } - boolean hideEnchants = false; - - if (meta.hasItemFlag(ItemFlag.HIDE_ENCHANTS) || meta.hasItemFlag(ItemFlag.HIDE_POTION_EFFECTS)) { - hideEnchants = true; - } - - if (meta.getPersistentDataContainer().has(legacyV, PersistentDataType.INTEGER)) { - hideEnchants = false; - } - - if (Display.isFinalized(itemStack)) { - hideEnchants = false; - } - - if (options.isUsingExperimentalHideFixer() && options.isUsingForceHideFixer()) { - hideEnchants = false; - } - - if (options.isUsingExperimentalHideFixer() && meta.hasItemFlag(ItemFlag.HIDE_ENCHANTS) && meta.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 6e882e34..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java +++ /dev/null @@ -1,211 +0,0 @@ -package com.willfp.ecoenchants.display; - -import com.google.common.collect.ImmutableMap; -import com.willfp.eco.core.config.ConfigUpdater; -import com.willfp.eco.core.display.Display; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -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.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.jetbrains.annotations.NotNull; - -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@UtilityClass -@SuppressWarnings("deprecation") -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", - "INVALID", - Collections.singletonList(Display.PREFIX + "INVALID ENCHANTMENT: " + enchantment.getClass().getName()), - EnchantmentType.NORMAL, - EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-rarity")) - )); - return; - } - - String name; - String color; - EnchantmentType type; - EnchantmentRarity rarity; - List description; - if (EcoEnchants.getFromEnchantment(enchantment) != null) { - EcoEnchant ecoEnchant = EcoEnchants.getFromEnchantment(enchantment); - description = ecoEnchant.getWrappedDescription(); - name = ecoEnchant.getName(); - type = ecoEnchant.getType(); - rarity = ecoEnchant.getRarity(); - } else { - description = Arrays.asList( - WordUtils.wrap( - String.valueOf(PLUGIN.getLangYml().getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".description")), - PLUGIN.getConfigYml().getInt("lore.describe.wrap"), - "\n", false - ).split("\\r?\\n") - ); - name = String.valueOf(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.hasCustomColor() && type != EnchantmentType.CURSE) { - color = rarity.getCustomColor(); - } - - if (rarity == null) { - rarity = EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-rarity")); - } - - String rawName = name; - name = color + name; - description.replaceAll(line -> Display.PREFIX + ((EnchantDisplay) PLUGIN.getDisplayModule()).getOptions().getDescriptionOptions().getColor() + line); - CACHE.put(enchantment.getKey(), new CacheEntry(enchantment, name, rawName, description, type, rarity)); - } - - @ToString - public static final class CacheEntry { - /** - * The enchantment that this cache is for. - */ - @Getter - private final Enchantment enchantment; - - /** - * The formatted name of the enchantment. - */ - @Getter - private final String name; - - /** - * The raw (unformatted) name of the enchantment. - */ - @Getter - private final String rawName; - - /** - * The description, line-wrapped. - */ - @Getter - private final List description; - - /** - * The description, not line-wrapped or colorized. - */ - @Getter - private final String stringDescription; - - /** - * The type of the enchantment. - */ - @Getter - private final EnchantmentType type; - - /** - * The rarity of the enchantment. - */ - @Getter - private final EnchantmentRarity rarity; - - private CacheEntry(@NotNull final Enchantment enchantment, - @NotNull final String name, - @NotNull final String rawName, - @NotNull final List description, - @NotNull final EnchantmentType type, - @NotNull final EnchantmentRarity rarity) { - this.enchantment = enchantment; - this.name = name; - this.rawName = rawName; - this.description = description; - this.type = type; - this.rarity = rarity; - - StringBuilder descriptionBuilder = new StringBuilder(); - - description.forEach(s -> { - descriptionBuilder.append(s); - descriptionBuilder.append(" "); - }); - - String processedStringDescription = descriptionBuilder.toString(); - processedStringDescription = processedStringDescription.replace(Display.PREFIX, ""); - this.stringDescription = processedStringDescription.replaceAll(((EnchantDisplay) PLUGIN.getDisplayModule()).getOptions().getDescriptionOptions().getColor(), ""); - } - } -} 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 48d20cfd..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.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 com.willfp.eco.util.StringUtils; -import lombok.Getter; -import org.jetbrains.annotations.NotNull; - -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; - - /** - * 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 = StringUtils.translate(this.getPlugin().getLangYml().getString("description-color")); - } -} 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 7574a820..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DisplayOptions.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.willfp.ecoenchants.display.options; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -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 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; - /** - * Allow reading enchantments from lore-based plugins. - */ - @Getter - private boolean usingLoreGetter = false; - - /** - * Allow reading enchantments from lore-based plugins aggressively. - */ - @Getter - private boolean usingAggressiveLoreGetter = false; - - /** - * If the experimental hide fixer is being used. - */ - @Getter - private boolean usingExperimentalHideFixer = false; - - /** - * If the aggressive experimental hide fixer is being used. - */ - @Getter - private boolean usingAggressiveExperimentalHideFixer = false; - - /** - * If all items should have hide enchants removed. - */ - @Getter - private boolean usingForceHideFixer = false; - - /** - * If item must be a target. - */ - @Getter - private boolean requireTarget = true; - - /** - * 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(); - - 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) - .collect(Collectors.toList())); - sortedTypes.addAll(EnchantmentType.values().stream().filter(enchantmentType -> !sortedTypes.contains(enchantmentType)).collect(Collectors.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) - .collect(Collectors.toList())); - sortedRarities.addAll(EnchantmentRarity.values().stream().filter(enchantmentRarity -> !sortedRarities.contains(enchantmentRarity)).collect(Collectors.toList())); - - usingLoreGetter = this.getPlugin().getConfigYml().getBool("advanced.lore-getter.enabled"); - usingAggressiveLoreGetter = this.getPlugin().getConfigYml().getBool("advanced.lore-getter.aggressive"); - usingExperimentalHideFixer = this.getPlugin().getConfigYml().getBool("advanced.hide-fixer.enabled"); - usingAggressiveExperimentalHideFixer = this.getPlugin().getConfigYml().getBool("advanced.hide-fixer.aggressive"); - usingForceHideFixer = this.getPlugin().getConfigYml().getBool("advanced.hide-fixer.force"); - - requireTarget = this.getPlugin().getConfigYml().getBool("lore.require-target"); - - 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/NumbersOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/NumbersOptions.java deleted file mode 100644 index 227681f1..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/ShrinkOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/ShrinkOptions.java deleted file mode 100644 index 879b9e83..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 7e912849..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.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -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 EcoPlugin 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 16578b3d..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.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -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 EcoPlugin 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 2d42e66a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityAlphabeticSorter.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting.implementations; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.display.EnchantDisplay; -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 EcoPlugin plugin) { - super(plugin); - } - - @Override - public void sortEnchantments(@NotNull final List toSort) { - if (((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().getSortedRarities().isEmpty() - || ((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().getSortedTypes().isEmpty()) { - ((EnchantDisplay) this.getPlugin().getDisplayModule()).update(); - } - - List sorted = new ArrayList<>(); - - ((EnchantDisplay) 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 91d411fd..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityLengthSorter.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting.implementations; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.display.EnchantDisplay; -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 EcoPlugin plugin) { - super(plugin); - } - - @Override - public void sortEnchantments(@NotNull final List toSort) { - if (((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().getSortedRarities().isEmpty() - || ((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().getSortedTypes().isEmpty()) { - ((EnchantDisplay) this.getPlugin().getDisplayModule()).update(); - } - - List sorted = new ArrayList<>(); - ((EnchantDisplay) 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 0fcd6f98..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityTypeAlphabeticSorter.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting.implementations; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.display.EnchantDisplay; -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 EcoPlugin plugin) { - super(plugin); - } - - @Override - public void sortEnchantments(@NotNull final List toSort) { - if (((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().getSortedRarities().isEmpty() - || ((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().getSortedTypes().isEmpty()) { - ((EnchantDisplay) this.getPlugin().getDisplayModule()).update(); - } - - List sorted = new ArrayList<>(); - ((EnchantDisplay) 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())); - - ((EnchantDisplay) 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 256e1562..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityTypeLengthSorter.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting.implementations; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.display.EnchantDisplay; -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 EcoPlugin plugin) { - super(plugin); - } - - @Override - public void sortEnchantments(@NotNull final List toSort) { - if (((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().getSortedRarities().isEmpty() - || ((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().getSortedTypes().isEmpty()) { - ((EnchantDisplay) this.getPlugin().getDisplayModule()).update(); - } - - List sorted = new ArrayList<>(); - ((EnchantDisplay) 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())); - - ((EnchantDisplay) 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 08d9ba21..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/TypeAlphabeticSorter.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting.implementations; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.display.EnchantDisplay; -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 EcoPlugin plugin) { - super(plugin); - } - - @Override - public void sortEnchantments(@NotNull final List toSort) { - if (((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().getSortedRarities().isEmpty() - || ((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().getSortedTypes().isEmpty()) { - ((EnchantDisplay) this.getPlugin().getDisplayModule()).update(); - } - - List sorted = new ArrayList<>(); - ((EnchantDisplay) 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 126c87e2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/TypeLengthSorter.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting.implementations; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.display.EnchantDisplay; -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 EcoPlugin plugin) { - super(plugin); - } - - @Override - public void sortEnchantments(@NotNull final List toSort) { - if (((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().getSortedRarities().isEmpty() - || ((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().getSortedTypes().isEmpty()) { - ((EnchantDisplay) this.getPlugin().getDisplayModule()).update(); - } - - List sorted = new ArrayList<>(); - ((EnchantDisplay) 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 e545369a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java +++ /dev/null @@ -1,367 +0,0 @@ -package com.willfp.ecoenchants.enchantments; - -import com.willfp.eco.core.Prerequisite; -import com.willfp.eco.util.StringUtils; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.config.configs.EnchantmentConfig; -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 lombok.AccessLevel; -import lombok.Getter; -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.event.Listener; -import org.bukkit.inventory.ItemStack; -import org.bukkit.permissions.Permission; -import org.bukkit.permissions.PermissionDefault; -import org.jetbrains.annotations.NotNull; - -import java.lang.reflect.Field; -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.stream.Collectors; - -@SuppressWarnings({"unchecked", "deprecation", "RedundantSuppression"}) -public abstract class EcoEnchant extends Enchantment implements Listener, Watcher { - /** - * Instance of EcoEnchants for enchantments to be able to access. - */ - @Getter(AccessLevel.PROTECTED) - 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. - */ - private String name; - /** - * 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 rarity; - /** - * If the enchantment is enabled. - */ - @Getter - private boolean enabled; - - /** - * 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) { - super(NamespacedKey.minecraft(key)); - - this.type = type; - this.permissionName = key.replace("_", ""); - this.config = new EnchantmentConfig(this.permissionName, this.getClass(), this.type); - - 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)) { - return; - } - - if (!Prerequisite.areMet(prerequisites)) { - return; - } - - enabled = config.getBool("enabled"); - - if (!this.isEnabled() && this.getPlugin().getConfigYml().getBool("advanced.hard-disable.enabled")) { - return; - } - - this.update(); - - EcoEnchants.addNewEcoEnchant(this); - } - - /** - * Update the enchantment based off config values. - * This can be overridden but may lead to unexpected behavior. - */ - public void update() { - config.update(); - config.loadFromLang(); - rarity = config.getRarity(); - Validate.notNull(rarity, "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); - name = StringUtils.translate(config.getString("name")); - description = StringUtils.translate(config.getString("description")); - disabledWorldNames.clear(); - disabledWorldNames.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "disabled-in-worlds")); - disabledWorlds.clear(); - List worldNames = Bukkit.getWorlds().stream().map(World::getName).map(String::toLowerCase).collect(Collectors.toList()); - List disabledExistingWorldNames = disabledWorldNames.stream().filter(s -> worldNames.contains(s.toLowerCase())).collect(Collectors.toList()); - disabledWorlds.addAll(Bukkit.getWorlds().stream().filter(world -> disabledExistingWorldNames.contains(world.getName().toLowerCase())).collect(Collectors.toList())); - targets.clear(); - targetMaterials.clear(); - targets.addAll(config.getTargets()); - targets.forEach(enchantmentTarget -> targetMaterials.addAll(enchantmentTarget.getMaterials())); - enabled = config.getBool("enabled"); - EnchantmentUtils.registerPlaceholders(this); - - postUpdate(); - this.register(); - } - - 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() { - try { - Field byIdField = Enchantment.class.getDeclaredField("byKey"); - Field byNameField = Enchantment.class.getDeclaredField("byName"); - byIdField.setAccessible(true); - byNameField.setAccessible(true); - Map byKey = (Map) byIdField.get(null); - Map byName = (Map) byNameField.get(null); - byKey.remove(this.getKey()); - byName.remove(this.getName()); - - Map byNameClone = new HashMap<>(byName); - for (Map.Entry entry : byNameClone.entrySet()) { - if (entry.getValue().getKey().equals(this.getKey())) { - byName.remove(entry.getKey()); - } - } - - Field f = Enchantment.class.getDeclaredField("acceptingNew"); - f.setAccessible(true); - f.set(null, true); - f.setAccessible(false); - - Enchantment.registerEnchantment(this); - } catch (NoSuchFieldException | IllegalAccessException ignored) { - } - } - - /** - * 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 enchantments) { - return conflicts.stream().anyMatch(enchantments::contains); - } - - /** - * Get enchantment cast to {@link Enchantment}. - * - * @return The enchantment. - */ - public Enchantment getEnchantment() { - return this; - } - - /** - * Get the display name of the enchantment. - *

- * Not deprecated, unlike superclass. - * - * @return The name. - */ - @Override - @NotNull - public String getName() { - return name; - } - - /** - * 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 false; - } - - /** - * 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) { - return targetMaterials.contains(itemStack.getType()) || itemStack.getType().equals(Material.BOOK) || itemStack.getType().equals(Material.ENCHANTED_BOOK); - } -} 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 1f3ca5e2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchants.java +++ /dev/null @@ -1,605 +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.ConfigUpdater; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.AngerArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.AshArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.BarrierArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.CloudsArtifact; -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.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.RedstoneArtifact; -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.SparkleArtifact; -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.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.Aversion; -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.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.MagmaWalker; -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 lombok.experimental.UtilityClass; -import org.bukkit.NamespacedKey; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.atomic.AtomicBoolean; - -@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 MAGMA_WALKER = new MagmaWalker(); - 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 AVERSION = new Aversion(); - public static final EcoEnchant INTROVERSION = new Introversion(); - public static final EcoEnchant BARRIER_ARTIFACT = new BarrierArtifact(); - 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(); - - /** - * Get all registered {@link EcoEnchant}s. - * - * @return A list of all {@link EcoEnchant}s. - */ - public static List values() { - return ImmutableList.copyOf(BY_KEY.values()); - } - - /** - * Gets {@link EcoEnchant} from {@link Enchantment}. - * - * @param enchantment The enchantment. - * @return The matching {@link EcoEnchant}, or null if not found. - */ - public static EcoEnchant getFromEnchantment(@NotNull final Enchantment enchantment) { - return getByKey(enchantment.getKey()); - } - - /** - * 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) { - AtomicBoolean hasOfType = new AtomicBoolean(false); - - if (item.getItemMeta() instanceof EnchantmentStorageMeta) { - ((EnchantmentStorageMeta) item.getItemMeta()).getStoredEnchants().forEach(((enchantment, integer) -> { - if (getFromEnchantment(enchantment) != null && getFromEnchantment(enchantment).getType().equals(type)) { - hasOfType.set(true); - } - })); - } else { - item.getEnchantments().forEach((enchantment, integer) -> { - if (getFromEnchantment(enchantment) != null && (getFromEnchantment(enchantment).getType().equals(type))) { - hasOfType.set(true); - } - }); - } - return hasOfType.get(); - } - - /** - * Update all {@link EcoEnchant}s. - */ - @ConfigUpdater - public static void update() { - for (EcoEnchant ecoEnchant : new HashSet<>(values())) { - ecoEnchant.update(); - } - } - - /** - * 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.getName(), 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/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/BarrierArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/BarrierArtifact.java deleted file mode 100644 index 5b15416e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/BarrierArtifact.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 BarrierArtifact extends Artifact { - public BarrierArtifact() { - super( - "barrier_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.BARRIER; - } -} 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/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/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/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/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/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/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/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 9548dd70..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/BreaklessnessCurse.java +++ /dev/null @@ -1,29 +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 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 dc0843e0..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/CallingCurse.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.curse; - -import com.willfp.eco.core.events.ArmorEquipEvent; -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; - -public class CallingCurse extends EcoEnchant implements TimedRunnable { - private final HashMap players = new HashMap<>(); - private double distance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance"); - - public CallingCurse() { - super( - "calling_curse", EnchantmentType.CURSE - ); - } - - @EventHandler - public void onArmorEquip(@NotNull final ArmorEquipEvent 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) { - 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 c3669ff5..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/DecayCurse.java +++ /dev/null @@ -1,120 +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))) { - 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))) { - 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 b3d71b37..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/FragilityCurse.java +++ /dev/null @@ -1,37 +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 - ); - } - - @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; - } - - 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 2521ff04..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/HarmlessnessCurse.java +++ /dev/null @@ -1,29 +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 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 afeba0de..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/HungerCurse.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.curse; - -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 - ); - } - - @EventHandler - public void onHunger(@NotNull final FoodLevelChangeEvent event) { - if (!(event.getEntity() instanceof Player)) { - return; - } - - Player player = (Player) event.getEntity(); - - if (!EnchantChecks.helmet(player, this)) { - return; - } - - if (event.getFoodLevel() > player.getFoodLevel()) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - 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 cf423826..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/MisfortuneCurse.java +++ /dev/null @@ -1,29 +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 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 1b42ab32..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abattoir.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.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 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 a579c0e5..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abrasion.java +++ /dev/null @@ -1,61 +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.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 void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity uncastVictim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(uncastVictim instanceof Player)) { - return; - } - Player victim = (Player) uncastVictim; - - 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; - } - - if (armorPiece.equals(victim.getInventory().getHelmet())) { - DurabilityUtils.damageItem(victim, victim.getInventory().getHelmet(), level, 39); - } - if (armorPiece.equals(victim.getInventory().getChestplate())) { - DurabilityUtils.damageItem(victim, victim.getInventory().getChestplate(), level, 38); - } - if (armorPiece.equals(victim.getInventory().getLeggings())) { - DurabilityUtils.damageItem(victim, victim.getInventory().getLeggings(), level, 37); - } - if (armorPiece.equals(victim.getInventory().getBoots())) { - DurabilityUtils.damageItem(victim, victim.getInventory().getBoots(), level, 36); - } - } - } -} 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 503a7855..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aerial.java +++ /dev/null @@ -1,50 +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.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 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 07691ea0..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aquatic.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.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 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 a427d5f1..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arachnid.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.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 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 3cb557f8..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arborist.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.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 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 3d60c3f1..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arcanic.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.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 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 3fc94e47..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Atmospheric.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.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 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/Aversion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aversion.java deleted file mode 100644 index 47a8c397..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aversion.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.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Enderman; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.entity.EntityTargetLivingEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Aversion extends EcoEnchant { - public Aversion() { - super( - "aversion", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onEndermanTarget(@NotNull final EntityTargetLivingEntityEvent event) { - if (!(event.getEntity() instanceof Enderman)) { - return; - } - - Enderman enderman = (Enderman) event.getEntity(); - LivingEntity target = event.getTarget(); - - if (event.getReason() != EntityTargetEvent.TargetReason.CLOSEST_PLAYER) { - return; - } - - if (target == null) { - return; - } - - int level = EnchantChecks.getHelmetLevel(target, this); - - if (level == 0) { - return; - } - - if (this.getDisabledWorlds().contains(target.getWorld())) { - return; - } - - event.setCancelled(true); - } -} 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 638557a0..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Backstab.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.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Backstab extends EcoEnchant { - public Backstab() { - super( - "backstab", EnchantmentType.NORMAL - ); - } - - @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 dea660af..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Beheading.java +++ /dev/null @@ -1,79 +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 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 - ); - } - - @EventHandler - public void onDeath(@NotNull final EntityDeathEvent event) { - if (event.getEntity().getKiller() == null) { - return; - } - - Player player = event.getEntity().getKiller(); - - 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 { - 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); - } -} 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 7390693f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java +++ /dev/null @@ -1,85 +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.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 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; - } - - AnticheatManager.exemptPlayer(player); - - 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 (!AntigriefManager.canBreakBlock(player, block1)) { - continue; - } - - toBreak.add(block1); - } - } - } - - toBreak.forEach((block1 -> { - block1.setMetadata("block-ignore", this.getPlugin().getMetadataValueFactory().create(true)); - BlockUtils.breakBlock(player, 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/Bleed.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java deleted file mode 100644 index 5360adcf..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java +++ /dev/null @@ -1,51 +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 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 765ab4f9..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Blind.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.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 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 6d7c256a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlockBreather.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.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 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 50bd8a96..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Buckshot.java +++ /dev/null @@ -1,57 +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 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) { - event.getProjectile().remove(); - if (shooter instanceof Player) { - ((Player) shooter).playSound(shooter.getLocation(), Sound.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0f, 1.0f); - } - - int numberPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "amount-per-level"); - int number = numberPerLevel * level; - double spread = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "spread-per-level"); - spread *= level; - - for (int i = 0; i < number; i += 1) { - - 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); - } - } -} 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 b9f5471f..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)); - ((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 6396856f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Conclude.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 Conclude extends EcoEnchant { - public Conclude() { - super( - "conclude", 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 (!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 98ec9a7c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Corrosive.java +++ /dev/null @@ -1,56 +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.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)) { - return; - } - Player victim = (Player) uncastVictim; - - ArrayList armor = new ArrayList<>(Arrays.asList(victim.getInventory().getArmorContents())); - if (armor.isEmpty()) { - return; - } - - for (ItemStack armorPiece : armor) { - if (armorPiece == null) { - continue; - } - - - if (armorPiece.equals(victim.getInventory().getHelmet())) { - DurabilityUtils.damageItem(victim, victim.getInventory().getHelmet(), level, 39); - } else if (armorPiece.equals(victim.getInventory().getChestplate())) { - DurabilityUtils.damageItem(victim, victim.getInventory().getChestplate(), level, 38); - } else if (armorPiece.equals(victim.getInventory().getLeggings())) { - DurabilityUtils.damageItem(victim, victim.getInventory().getLeggings(), level, 37); - } else if (armorPiece.equals(victim.getInventory().getBoots())) { - DurabilityUtils.damageItem(victim, victim.getInventory().getBoots(), level, 36); - } - } - } -} 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 04784a39..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Criticals.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 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 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 50b3f771..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Defender.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 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)) { - return; - } - - Tameable pet = (Tameable) victim; - - 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 617db5f0..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Deflection.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.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; - } - - 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 ce6510ea..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dexterous.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.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; - } - - 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 7bd38647..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disable.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.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 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 14cf3c6a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.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 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; - } - - 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/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/Drill.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java deleted file mode 100644 index 66d4cff4..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java +++ /dev/null @@ -1,63 +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.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.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 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; - } - - 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; - } - - BlockUtils.breakBlock(player, 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 664ebdca..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dullness.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.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 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 b6ca77a6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Economical.java +++ /dev/null @@ -1,33 +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 - ); - } - - @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; - } - 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 77521e8e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Electroshock.java +++ /dev/null @@ -1,33 +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 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; - } - - LightningUtils.strike(attacker, damage); - } -} 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 c9904cdc..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)) { - return; - } - if (!(((Arrow) event.getDamager()).getShooter() instanceof Player)) { - return; - } - - Player player = (Player) ((Arrow) event.getDamager()).getShooter(); - Arrow arrow = (Arrow) event.getDamager(); - - assert player != null; - if (!player.getWorld().getEnvironment().equals(World.Environment.THE_END)) { - 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 bb95fb06..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Evasion.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.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 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 5546f11a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extinguishing.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.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 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 039ff92a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Famine.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.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 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 * 40, level)); - victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, level * 40, 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 a73755d6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Farmhand.java +++ /dev/null @@ -1,101 +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 (!(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, player.getInventory().getHeldItemSlot()); - } - - 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, player.getInventory().getHeldItemSlot()); - } - } - } -} 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 911988e5..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)) { - return; - } - - Wolf wolf = (Wolf) event.getKiller(); - - if (!wolf.isTamed() || wolf.getOwner() == null) { - return; - } - - if (!(wolf.getOwner() instanceof Player)) { - return; - } - - Player player = (Player) wolf.getOwner(); - - 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 80d284b7..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Finality.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.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 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 23df4797..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Finishing.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 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 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 1afedef7..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Flinch.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.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 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 c016b8e1..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Forcefield.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.events.ArmorEquipEvent; -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.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; - -public class Forcefield extends EcoEnchant implements TimedRunnable { - private final HashMap 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 ArmorEquipEvent 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) { - 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() { - 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; - } - - ((Monster) e).damage(damage); - - if (NumberUtils.randFloat(0, 1) < 0.2) { - 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 c6db7e1b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Freerunner.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.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 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 990a17d6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Frozen.java +++ /dev/null @@ -1,57 +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 - ); - } - - @EventHandler - public void onHurt(@NotNull final EntityDamageByEntityEvent event) { - if (!(event.getEntity() instanceof Player)) { - return; - } - - if (!(event.getDamager() instanceof LivingEntity)) { - return; - } - - Player player = (Player) event.getEntity(); - LivingEntity victim = (LivingEntity) event.getDamager(); - - 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 08123a21..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fury.java +++ /dev/null @@ -1,58 +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 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 c724bee7..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Graceful.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.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 - ); - } - - @EventHandler - public void onFall(@NotNull final PlayerMoveEvent event) { - Player player = event.getPlayer(); - - if (player.isOnGround()) { - 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 e1f1008a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/GreenThumb.java +++ /dev/null @@ -1,61 +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 (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, player.getInventory().getHeldItemSlot()); - } - - 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 247205a9..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grit.java +++ /dev/null @@ -1,58 +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)) { - return; - } - - if (!(event.getDamager() instanceof Player)) { - return; - } - - Player player = (Player) event.getEntity(); - Player attacker = (Player) event.getDamager(); - - 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, attacker.getInventory().getHeldItemSlot()); - } - -} 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 0324ea6e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IceShot.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 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 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 95684921..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Identify.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.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 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 3ea0194e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Ignite.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.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 void onArrowHit(@NotNull final LivingEntity uncastShooter, - final int level, - @NotNull final ProjectileHitEvent event) { - if (!(uncastShooter instanceof Player)) { - return; - } - - if (event.getHitBlock() == null) { - return; - } - - Player shooter = (Player) uncastShooter; - 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 ead91aa4..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IllusionAspect.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.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 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 cd8deb48..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Impact.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 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 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 3a1c64f1..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Incandescence.java +++ /dev/null @@ -1,58 +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)) { - return; - } - - if (!(event.getDamager() instanceof LivingEntity)) { - return; - } - - Player player = (Player) event.getEntity(); - LivingEntity victim = (LivingEntity) event.getDamager(); - - 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 1a3e135e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/InfernalTouch.java +++ /dev/null @@ -1,131 +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.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -public class InfernalTouch extends EcoEnchant { - private static final HashMap> 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)) { - continue; - } - FurnaceRecipe furnaceRecipe = (FurnaceRecipe) recipe; - int xp = (int) Math.ceil(furnaceRecipe.getExperience()); - RECIPES.put(furnaceRecipe.getInput().getType(), new Pair<>(furnaceRecipe.getResult().getType(), xp)); - } - } - - 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 (!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; - } - - Collection 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++; - } - } - - event.getItems().clear(); - - if (!this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "drop-xp")) { - experience = 0; - } - - new DropQueue(player) - .setLocation(block.getLocation()) - .addItems(drops) - .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 19979274..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Infuriate.java +++ /dev/null @@ -1,54 +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 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 c509bc4c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java +++ /dev/null @@ -1,38 +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.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 Instantaneous extends EcoEnchant { - public Instantaneous() { - super( - "instantaneous", EnchantmentType.NORMAL - ); - } - - @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; - } - - 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 6c7c72f0..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Invigoration.java +++ /dev/null @@ -1,72 +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)) { - return; - } - - Player player = (Player) event.getEntity(); - - 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 damageReduction = totalInvigorationPoints * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "reduction-multiplier") * 0.01; - damageReduction += 1; - event.setDamage(event.getDamage() * damageReduction); - } - - @EventHandler - public void onInvigorationDamage(@NotNull final EntityDamageByEntityEvent event) { - if (!(event.getDamager() instanceof Player)) { - return; - } - - Player player = (Player) event.getDamager(); - - 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 83402c7e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Launch.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.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 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 (!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); - - this.getPlugin().getScheduler().run(() -> player.setVelocity(player.getVelocity().multiply(boost))); - } -} 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 b0410c9f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lesion.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.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 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 2f6f3ab1..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Levitate.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.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 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 422cf375..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/LuckyCatch.java +++ /dev/null @@ -1,55 +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 - ); - } - - @EventHandler - public void onFish(@NotNull final PlayerFishEvent event) { - Player player = event.getPlayer(); - ItemStack item = player.getInventory().getItemInMainHand(); - - if (!EnchantChecks.item(item, this)) { - 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)) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - Item caughtItem = (Item) caught; - - 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 e5991c36..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.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.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 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 { - public Lumberjack() { - super( - "lumberjack", 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 = new ArrayList<>(); - this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "whitelisted-blocks").forEach(name -> materials.add(Material.getMaterial(name.toUpperCase()))); - - 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); - - AnticheatManager.exemptPlayer(player); - - for (Block treeBlock : treeBlocks) { - treeBlock.setMetadata("block-ignore", this.getPlugin().getMetadataValueFactory().create(true)); - if (!AntigriefManager.canBreakBlock(player, treeBlock)) { - continue; - } - - BlockUtils.breakBlock(player, treeBlock); - - this.getPlugin().getScheduler().runLater(() -> treeBlock.removeMetadata("block-ignore", this.getPlugin()), 1); - } - - AnticheatManager.unexemptPlayer(player); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/MagmaWalker.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/MagmaWalker.java deleted file mode 100644 index a99f19ce..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/MagmaWalker.java +++ /dev/null @@ -1,101 +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.core.scheduling.RunnableTask; -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.block.data.Levelled; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class MagmaWalker extends EcoEnchant { - public MagmaWalker() { - super( - "magma_walker", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onLavaWalk(@NotNull final PlayerMoveEvent event) { - Player player = event.getPlayer(); - - if (event.getTo() == null) { - return; - } - - if (event.getFrom().getBlock().equals(event.getTo().getBlock())) { - return; - } - - if (!EnchantChecks.boots(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - Vector[] circle = VectorUtils.getCircle(this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "initial-radius") - + (this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "per-level-radius") * EnchantChecks.getBootsLevel(player, this) - 1)); - - AnticheatManager.exemptPlayer(player); - - for (Vector vector : circle) { - Location loc = player.getLocation().add(vector).add(0, -1, 0); - - Block block = player.getWorld().getBlockAt(loc); - - if (!AntigriefManager.canPlaceBlock(player, player.getWorld().getBlockAt(loc))) { - continue; - } - - if (!block.getType().equals(Material.LAVA)) { - continue; - } - - Levelled data = (Levelled) block.getBlockData(); - - if (data.getLevel() != 0) { - continue; - } - - block.setType(Material.OBSIDIAN); - - block.setMetadata("byMagmaWalker", this.getPlugin().getMetadataValueFactory().create(true)); - - long afterTicks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "remove-after-ticks"); - - RunnableTask replace = this.getPlugin().getRunnableFactory().create(bukkitRunnable -> { - if (block.getType().equals(Material.OBSIDIAN) && !player.getWorld().getBlockAt(player.getLocation().add(0, -1, 0)).equals(block)) { - block.setType(Material.LAVA); - block.removeMetadata("byMagmaWalker", this.getPlugin()); - bukkitRunnable.cancel(); - } - }); - - this.getPlugin().getScheduler().runLater(() -> { - if (block.getType().equals(Material.OBSIDIAN)) { - if (!player.getWorld().getBlockAt(player.getLocation().add(0, -1, 0)).equals(block)) { - block.setType(Material.LAVA); - block.removeMetadata("byMagmaWalker", this.getPlugin()); - } else { - replace.runTaskTimer(afterTicks, afterTicks); - } - } - }, afterTicks); - } - - 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 33f16750..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Magnetic.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.events.ArmorEquipEvent; -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; - -public class Magnetic extends EcoEnchant implements TimedRunnable { - private final HashMap players = new HashMap<>(); - private double initialDistance = 1; - private double bonus = 1; - - public Magnetic() { - super( - "magnetic", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onArmorEquip(@NotNull final ArmorEquipEvent 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) { - 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; - } - - 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 b56d0f41..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marking.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 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)) { - return; - } - - LivingEntity victim = (LivingEntity) event.getEntity(); - - 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 619506a9..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marksman.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.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)) { - return; - } - - Player player = (Player) event.getEntity().getShooter(); - - 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 57d26ce0..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Necrotic.java +++ /dev/null @@ -1,58 +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 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 - ); - } - - @EventHandler - public void necroticKill(@NotNull final EntityDeathEvent event) { - if (event.getEntity().getKiller() == null) { - return; - } - - if (!(event.getEntity() instanceof WitherSkeleton)) { - return; - } - - Player player = event.getEntity().getKiller(); - WitherSkeleton victim = (WitherSkeleton) event.getEntity(); - - 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; - } - - 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 3a0bc066..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Oxygenate.java +++ /dev/null @@ -1,35 +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.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 = NumberUtils.equalIfOver(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 f711475f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Paralyze.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.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 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 2b6f30ae..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parasitic.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.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(); - } - 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 cece6cd3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parry.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 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)) { - return; - } - - if (event.isCancelled()) { - return; - } - - Player player = (Player) event.getEntity(); - - 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 df067057..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Protector.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 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)) { - return; - } - - Tameable victim = (Tameable) uncastVictim; - 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 c966275f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Proximity.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.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) { - 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 f2f969df..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Radiance.java +++ /dev/null @@ -1,47 +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)) { - continue; - } - LivingEntity entity = (LivingEntity) e; - - 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 c1782869..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rage.java +++ /dev/null @@ -1,55 +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 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 9841544e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rapid.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.Arrow; -import org.bukkit.entity.LivingEntity; -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) { - 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)); - } -} 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 52abe244..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reaper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; - -public class Reaper extends EcoEnchant { - public Reaper() { - super( - "reaper", EnchantmentType.NORMAL - ); - } - - // 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 1da6bd04..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rebounding.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.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)) { - return; - } - - if (!(event.getDamager() instanceof LivingEntity)) { - return; - } - - if (event.isCancelled()) { - return; - } - - LivingEntity victim = (LivingEntity) event.getEntity(); - LivingEntity attacker = (LivingEntity) event.getDamager(); - - 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 dff5d409..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reel.java +++ /dev/null @@ -1,61 +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)) { - return; - } - - Player player = event.getPlayer(); - - LivingEntity victim = (LivingEntity) event.getCaught(); - - 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 8b679236..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rejuvenation.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 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)) { - return; - } - - if (!event.getRegainReason().equals(EntityRegainHealthEvent.RegainReason.SATIATED) && !event.getRegainReason().equals(EntityRegainHealthEvent.RegainReason.REGEN)) { - return; - } - - Player player = (Player) event.getEntity(); - - 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 b7f107f6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.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 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)) { - return; - } - - if (block.getType().equals(Material.SUGAR_CANE) || block.getType().equals(Material.SWEET_BERRY_BUSH)) { - return; - } - - Ageable data = (Ageable) block.getBlockData(); - 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 61b0cb7f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sating.java +++ /dev/null @@ -1,47 +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 - ); - } - - @EventHandler - public void onSatingHunger(@NotNull final FoodLevelChangeEvent event) { - if (!(event.getEntity() instanceof Player)) { - return; - } - - Player player = (Player) event.getEntity(); - - 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 425f0b71..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.eco.util.TridentUtils; -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)) { - return; - } - - if (!(event.getEntity().getShooter() instanceof Player)) { - return; - } - - Player player = (Player) event.getEntity().getShooter(); - - AbstractArrow entity = (AbstractArrow) event.getEntity(); - ItemStack item = player.getInventory().getItemInMainHand(); - if (entity instanceof Trident) { - item = TridentUtils.getItemStack((Trident) entity); - } - - 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 40fbb1ee..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/ShotAssist.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.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)) { - return; - } - - if (!(event.getEntity() instanceof LivingEntity)) { - return; - } - - if (event.isCancelled()) { - return; - } - - Player player = (Player) ((Arrow) event.getDamager()).getShooter(); - - 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 85d3b246..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sickening.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.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 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 eac25ea6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slicing.java +++ /dev/null @@ -1,66 +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 (!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.getMainhandLevel(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, 38); - } - } - } -} 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 3c5d6b71..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spearfishing.java +++ /dev/null @@ -1,91 +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.eco.util.TridentUtils; -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 - ); - } - - @EventHandler - public void onSpearfishingLand(@NotNull final ProjectileHitEvent event) { - if (event.getEntityType() != EntityType.TRIDENT) { - return; - } - - if (!(event.getEntity().getShooter() instanceof Player)) { - return; - } - - if (!(event.getEntity() instanceof Trident)) { - return; - } - - Trident trident = (Trident) event.getEntity(); - - if (!trident.getWorld().getBlockAt(trident.getLocation().add(0, 0.2, 0)).getType().equals(Material.WATER)) { - return; - } - - Player player = (Player) event.getEntity().getShooter(); - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - ItemStack item = TridentUtils.getItemStack(trident); - - 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 ea56b70f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spiked.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.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)) { - return; - } - - Player player = event.getPlayer(); - - LivingEntity victim = (LivingEntity) event.getCaught(); - - 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 b49e63b4..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Splash.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.util.TridentUtils; -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; - -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 = TridentUtils.getItemStack(trident); - - 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)) { - continue; - } - - LivingEntity entity = (LivingEntity) victim; - - 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 d99a0e96..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stalwart.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.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 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 082669b5..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stamina.java +++ /dev/null @@ -1,51 +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 - ); - } - - @EventHandler - public void onStaminaHunger(@NotNull final FoodLevelChangeEvent event) { - if (!(event.getEntity() instanceof Player)) { - return; - } - - Player player = (Player) event.getEntity(); - - if (!player.isSprinting()) { - 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 4e94d0e6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StoneSwitcher.java +++ /dev/null @@ -1,62 +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 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 = NumberUtils.equalIfOver(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 a064e3fc..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StrayAspect.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.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 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 ccca20b3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Succession.java +++ /dev/null @@ -1,46 +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.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); - - 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, ((Player) shooter).getInventory().getHeldItemSlot()); - } - }, i * 2L); - } - } -} 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 e6911baf..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Supercritical.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 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 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 af5fb9e3..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 = 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/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 7aa3f641..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java +++ /dev/null @@ -1,199 +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.eco.util.TridentUtils; -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.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; - -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)) { - 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)) { - 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 (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) { - if (((Trident) event.getKiller()).getShooter() instanceof Player) { - player = (Player) ((Trident) event.getKiller()).getShooter(); - item = TridentUtils.getItemStack((Trident) event.getKiller()); - } - } - - if (player == null || item == null) { - 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; - } - 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 beb37eaa..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thor.java +++ /dev/null @@ -1,36 +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 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"); - - LightningUtils.strike(victim, damage); - } -} 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 b264003d..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thrive.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.events.ArmorEquipEvent; -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 ArmorEquipEvent event) { - Player player = event.getPlayer(); - - this.getPlugin().getScheduler().runLater(() -> { - int points = EnchantChecks.getArmorPoints(player, this); - - AttributeInstance inst = player.getAttribute(Attribute.GENERIC_MAX_HEALTH); - - assert inst != null; - - inst.setBaseValue(inst.getDefaultValue()); - - if (this.getDisabledWorlds().contains(player.getWorld())) { - points = 0; - } - - inst.removeModifier(modifier); - - if (player.getHealth() >= inst.getValue()) { - this.getPlugin().getScheduler().runLater(() -> { - player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); - }, 1); - } - - 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 - ) - ); - } - }, 1); - } -} 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 a038668b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.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.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); - - 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 cb57fcc3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Toxic.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.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 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 d95e8e59..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Transfuse.java +++ /dev/null @@ -1,65 +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; - -import java.util.stream.Collectors; - -public class Transfuse extends EcoEnchant { - public Transfuse() { - super( - "transfuse", EnchantmentType.NORMAL - ); - } - - @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; - } - - event.setDropItems(false); - - if (!this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "works-on").stream() - .map(string -> Material.getMaterial(string.toUpperCase())) - .collect(Collectors.toList()).contains(block.getType())) { - return; - } - - 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 = NumberUtils.equalIfOver(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 2e86cf94..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tripleshot.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.EnchantChecks; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.AbstractArrow; -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 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) { - 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); - } - } -} 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 41a873b5..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VampireAspect.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.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 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 5c0f2295..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.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.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 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 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 = new ArrayList<>(); - this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "whitelisted-blocks").forEach(name -> materials.add(Material.getMaterial(name.toUpperCase()))); - - if (!materials.contains(block.getType())) { - return; - } - - int blocksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "blocks-per-level"); - int limit = level * blocksPerLevel; - - Set blockSet = BlockUtils.getVein(block, materials, limit); - - AnticheatManager.exemptPlayer(player); - - for (Block veinBlock : blockSet) { - veinBlock.setMetadata("block-ignore", this.getPlugin().getMetadataValueFactory().create(true)); - if (!AntigriefManager.canBreakBlock(player, veinBlock)) { - continue; - } - - BlockUtils.breakBlock(player, veinBlock); - - this.getPlugin().getScheduler().runLater(() -> veinBlock.removeMetadata("block-ignore", this.getPlugin()), 1); - } - - 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 db5c73d4..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Venom.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.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 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 99e44249..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.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.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)) { - return; - } - - LivingEntity victim = (LivingEntity) event.getEntity(); - - 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 b41a0ed0..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Wisdom.java +++ /dev/null @@ -1,39 +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.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; - } - - 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 34c3f6f1..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WoodSwitcher.java +++ /dev/null @@ -1,63 +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 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 = NumberUtils.equalIfOver(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 3bc20a94..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Wound.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.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 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 fdc9cd5b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Zeus.java +++ /dev/null @@ -1,34 +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 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"); - - LightningUtils.strike(victim, damage); - } -} 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 782e092e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -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.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.Arrays; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -@SuppressWarnings({"unchecked", "unused"}) -public class Aiming extends EcoEnchant { - public Aiming() { - super( - "aiming", EnchantmentType.SPECIAL - ); - } - - @EventHandler - public void aimingLaunch(@NotNull final ProjectileLaunchEvent event) { - if (!(event.getEntity().getShooter() instanceof Player)) { - return; - } - - if (!(event.getEntity() instanceof Arrow)) { - return; - } - - if (event.isCancelled()) { - return; - } - - Player player = (Player) event.getEntity().getShooter(); - Arrow arrow = (Arrow) event.getEntity(); - - if (!EnchantChecks.mainhand(player, this)) { - 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 = NumberUtils.equalIfOver(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) - .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 4ad1a095..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bladed.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.entity.LivingEntity; -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) { - 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 7ca827f2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bolt.java +++ /dev/null @@ -1,35 +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 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"); - - LightningUtils.strike(victim, damage); - } -} 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 66e97350..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("carved")) { - 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("carved", this.getPlugin().getMetadataValueFactory().create(true)); - ((LivingEntity) entity).damage(damage, attacker); - this.getPlugin().getScheduler().runLater(() -> entity.removeMetadata("carved", 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 3db9d3f9..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Confusion.java +++ /dev/null @@ -1,52 +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 void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity uncastVictim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(uncastVictim instanceof Player)) { - return; - } - Player victim = (Player) uncastVictim; - - 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 e92ee028..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Force.java +++ /dev/null @@ -1,29 +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.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) { - 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 a00af005..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Frenzy.java +++ /dev/null @@ -1,43 +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 (!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 c463bef6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Harpoon.java +++ /dev/null @@ -1,57 +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)) { - return; - } - - Player player = event.getPlayer(); - - LivingEntity victim = (LivingEntity) event.getCaught(); - - 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 30615882..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Indestructibility.java +++ /dev/null @@ -1,42 +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; - } - - 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 d5dd3465..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Instability.java +++ /dev/null @@ -1,65 +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.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.jetbrains.annotations.NotNull; - -public class Instability extends EcoEnchant { - public Instability() { - super( - "instability", EnchantmentType.SPECIAL - ); - } - - @EventHandler - public void onInstabilityLand(@NotNull final ProjectileHitEvent event) { - if (event.getEntityType() != EntityType.ARROW) { - return; - } - - if (!(event.getEntity().getShooter() instanceof Player)) { - return; - } - - Player player = (Player) event.getEntity().getShooter(); - - 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())); - } - - 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 4e1d8855..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Intellect.java +++ /dev/null @@ -1,39 +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.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; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - - if (level == 0) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - 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 b290960a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Pentashot.java +++ /dev/null @@ -1,46 +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.enchantments.Enchantment; -import org.bukkit.entity.AbstractArrow; -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 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) { - int bonusPerSide = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "side-arrows-per-level") * level; - - 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); - } - } -} 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 9a6fc25d..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Prosperity.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.eco.core.events.ArmorEquipEvent; -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 ArmorEquipEvent event) { - Player player = event.getPlayer(); - - this.getPlugin().getScheduler().runLater(() -> { - int points = EnchantChecks.getArmorPoints(player, this); - - AttributeInstance inst = player.getAttribute(Attribute.GENERIC_MAX_HEALTH); - - assert inst != null; - - inst.setBaseValue(inst.getDefaultValue()); - - if (this.getDisabledWorlds().contains(player.getWorld())) { - points = 0; - } - - inst.removeModifier(modifier); - - if (player.getHealth() >= inst.getValue()) { - this.getPlugin().getScheduler().runLater(() -> { - player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); - }, 1); - } - - 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 - ) - ); - } - }, 1); - } -} 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 bef73e33..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Razor.java +++ /dev/null @@ -1,32 +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) { - 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 edbbd7b9..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Repairing.java +++ /dev/null @@ -1,123 +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))) { - 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))) { - 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 a29fc2c8..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java +++ /dev/null @@ -1,139 +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.Material; -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 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 (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 (itemStack.getItemMeta() instanceof EnchantmentStorageMeta && (((EnchantmentStorageMeta) itemStack.getItemMeta()).getStoredEnchants().containsKey(this.getEnchantment()))) { - 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 (meta instanceof EnchantmentStorageMeta) { - ((EnchantmentStorageMeta) meta).removeStoredEnchant(this); - } - meta.removeEnchant(this); - } - - itemStack.setItemMeta(meta); - } - - player.setMetadata("soulbound-items", this.getPlugin().getMetadataValueFactory().create(soulboundItems)); - } - - public boolean hasEmptyInventory(@NotNull final Player player) { - for (ItemStack itemStack : player.getInventory().getContents()) { - if (itemStack != null && itemStack.getType() != Material.AIR) { - return false; - } - } - return true; - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void onSoulboundRespawn(@NotNull final PlayerRespawnEvent event) { - Player player = event.getPlayer(); - - this.getPlugin().getScheduler().runLater(() -> { - if (!hasEmptyInventory(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()); - }, 1); - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void onDeath(@NotNull final PlayerDeathEvent event) { - event.getDrops().removeIf(itemStack -> itemStack.getItemMeta().getPersistentDataContainer().has(this.getPlugin().getNamespacedKeyFactory().create("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 d9a4f657..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Spring.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.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) { - double multiplier = 0.5 + ((double) (level * level) / 4 - 0.2) / 3; - player.setVelocity(player.getLocation().getDirection().multiply(multiplier).setY(multiplier)); - } -} 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 2e2c92da..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.ArmorEquipEvent; -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 ArmorEquipEvent event) { - if (level == 0) { - player.setWalkSpeed(0.2f); - return; - } - - player.setWalkSpeed((float) (0.2 + (level * EcoEnchants.STREAMLINING.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 69afafde..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Volatile.java +++ /dev/null @@ -1,56 +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 void onMeleeAttack(@NotNull final LivingEntity uncastAttacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(uncastAttacker instanceof Player)) { - return; - } - - Player attacker = (Player) uncastAttacker; - - 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 334ebeda..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Charge.java +++ /dev/null @@ -1,27 +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.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) { - 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(velocity); - - return true; - } -} 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 2732a851..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java +++ /dev/null @@ -1,90 +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.eco.util.BlockUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -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); - } - } - } - - toBreak.forEach((block1 -> { - block1.setMetadata("block-ignore", this.getPlugin().getMetadataValueFactory().create(true)); - BlockUtils.breakBlock(player, block1); - block1.removeMetadata("block-ignore", 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 ef9754a2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Vitalize.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.spell; - -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -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()); - - return true; - } -} 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 9da5ea63..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Artifact.java +++ /dev/null @@ -1,179 +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 Particle.DustOptions 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 Particle.DustOptions 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 (!EnchantChecks.chestplate(player, this)) { - return; - } - - 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); - } - } - }).runTaskTimer(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); - }).runTaskTimer(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 96470d45..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java +++ /dev/null @@ -1,248 +0,0 @@ -package com.willfp.ecoenchants.enchantments.itemtypes; - -import com.willfp.eco.core.Prerequisite; -import com.willfp.eco.core.integrations.placeholder.PlaceholderEntry; -import com.willfp.eco.core.integrations.placeholder.PlaceholderManager; -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 org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.SoundCategory; -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.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; - -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 - ); - /** - * 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 PlaceholderEntry( - this.getPermissionName() + "_" + "cooldown", - player -> StringUtils.internalToString(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 - || event.getClickedBlock().getType() == Material.CRAFTING_TABLE - || event.getClickedBlock().getType() == Material.GRINDSTONE - || event.getClickedBlock().getType() == Material.ENCHANTING_TABLE - || event.getClickedBlock().getType() == Material.ANVIL - || event.getClickedBlock().getType() == Material.FURNACE - || event.getClickedBlock().getType() == Material.SMITHING_TABLE) { - return; - } - } - - if (cooldown > 0) { - 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)) { - 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. - */ - 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 df8fa597..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.ConfigUpdater; -import com.willfp.eco.util.StringUtils; -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(); - } - - /** - * 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. - */ - @ConfigUpdater - public static void update() { - RarityYml rarityYml = EcoEnchantsPlugin.getInstance().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 = StringUtils.translate(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)) { - return false; - } - EnchantmentRarity that = (EnchantmentRarity) o; - 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 92280e0c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.willfp.ecoenchants.enchantments.meta; - -import com.google.common.collect.ImmutableSet; -import com.willfp.eco.core.config.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<>()); - /** - * All registered targets. - */ - private static final Set REGISTERED = new HashSet<>(); - - static { - REGISTERED.add(ALL); - update(); - } - - /** - * The name of the target. - */ - @Getter - private final String name; - /** - * The materials of the target. - */ - @Getter - private final Set materials; - - /** - * 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) { - this.name = name; - materials.removeIf(Objects::isNull); - this.materials = materials; - } - - /** - * 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. - */ - @ConfigUpdater - public static void update() { - List targetNames = EcoEnchantsPlugin.getInstance().getTargetYml().getTargets(); - ALL.materials.clear(); - targetNames.forEach(name -> { - Set materials = EcoEnchantsPlugin.getInstance().getTargetYml().getTargetMaterials(name); - new EnchantmentTarget(name, materials).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()); - } -} 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 4582ffe0..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.willfp.ecoenchants.enchantments.meta; - -import com.google.common.collect.ImmutableList; -import com.willfp.eco.core.config.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.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("not-curse-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 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 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 requiredToExtend) { - this.name = name; - this.singularSupplier = singularSupplier; - this.colorSupplier = colorSupplier; - this.requiredToExtend = requiredToExtend; - color = colorSupplier.get(); - singular = singularSupplier.get(); - REGISTERED.add(this); - } - - /** - * 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)) { - return false; - } - EnchantmentType that = (EnchantmentType) o; - 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 4e6afb0e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilListeners.java +++ /dev/null @@ -1,143 +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.proxy.ProxyConstants; -import com.willfp.eco.core.tuples.Pair; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy; -import com.willfp.ecoenchants.proxy.proxies.RepairCostProxy; -import com.willfp.ecoenchants.util.ProxyUtils; -import org.bukkit.Material; -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.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 HashMap ANTI_REPEAT = new HashMap<>(); - - /** - * Class for AnvilGUI wrappers to ignore them. - */ - private static final String ANVIL_GUI_CLASS = "net.wesjd.anvilgui.version.Wrapper" + ProxyConstants.NMS_VERSION.substring(1) + "$AnvilContainer"; - - /** - * Instantiate anvil listeners and link them to a specific plugin. - * - * @param plugin The plugin to link to. - */ - public AnvilListeners(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Called when items are placed into an anvil. - * - * @param event The event to listen to. - */ - @EventHandler(priority = EventPriority.HIGHEST) - public void onAnvilPrepare(@NotNull final PrepareAnvilEvent event) { - ItemStack left = event.getInventory().getItem(0); - ItemStack right = event.getInventory().getItem(1); - ItemStack out = event.getResult(); - String name = event.getInventory().getRenameText(); - - if (event.getViewers().isEmpty()) { - return; // Prevent ArrayIndexOutOfBoundsException when using AnvilGUI - } - - event.setResult(null); - event.getInventory().setItem(2, null); - - Player player = (Player) event.getViewers().get(0); - if (ProxyUtils.getProxy(OpenInventoryProxy.class).getOpenInventory(player).getClass().toString().equals(ANVIL_GUI_CLASS)) { - return; - } - - if (name == null) { - name = ""; - } - - Pair newOut = AnvilMerge.doMerge(left, right, out, name, player); - - if (newOut.getFirst() == null) { - newOut.setFirst(new ItemStack(Material.AIR, 0)); - } - - int modCost; - if (newOut.getSecond() == null) { - modCost = 0; - } else { - modCost = newOut.getSecond(); - } - - this.getPlugin().getScheduler().run(() -> { - - // This is a disgusting bodge - if (!ANTI_REPEAT.containsKey(player.getUniqueId())) { - ANTI_REPEAT.put(player.getUniqueId(), 0); - } - - Integer num = ANTI_REPEAT.get(player.getUniqueId()); - num += 1; - ANTI_REPEAT.put(player.getUniqueId(), num); - - this.getPlugin().getScheduler().runLater(() -> ANTI_REPEAT.remove(player.getUniqueId()), 1); - - // End pain - - int preCost = event.getInventory().getRepairCost(); - ItemStack item = newOut.getFirst(); - - if (event.getInventory().getItem(0) == null) { - return; - } - - if (!Objects.requireNonNull(event.getInventory().getItem(0)).getType().equals(item.getType())) { - return; - } - - if (this.getPlugin().getConfigYml().getBool("anvil.rework-cost")) { - int repairCost = ProxyUtils.getProxy(RepairCostProxy.class).getRepairCost(item); - int reworkCount = NumberUtils.log2(repairCost + 1); - if (repairCost == 0) { - reworkCount = 0; - } - reworkCount++; - repairCost = (int) Math.pow(2, reworkCount) - 1; - item = ProxyUtils.getProxy(RepairCostProxy.class).setRepairCost(item, repairCost); - } - - int cost; - - if (ANTI_REPEAT.get(player.getUniqueId()) == 1) { - cost = preCost + modCost; - } else { - cost = preCost; - } - - if (!Objects.equals(left, player.getOpenInventory().getItem(0))) { - return; - } - if (cost == 0) { - return; - } - - event.getInventory().setRepairCost(cost); - event.setResult(item); - event.getInventory().setItem(2, item); - player.updateInventory(); - }); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilMerge.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilMerge.java deleted file mode 100644 index f8f2be83..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilMerge.java +++ /dev/null @@ -1,274 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.merging.anvil; - -import com.willfp.eco.core.tuples.Pair; -import com.willfp.eco.util.StringUtils; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -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 lombok.experimental.UtilityClass; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.Damageable; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; - -@UtilityClass -public class AnvilMerge { - /** - * Instance of EcoEnchants. - */ - private static final EcoEnchantsPlugin PLUGIN = EcoEnchantsPlugin.getInstance(); - - /** - * Config key for allowing unsafe levels. - */ - private static final String ALLOW_UNSAFE_KEY = "anvil.allow-unsafe-levels"; - - /** - * Merge items in anvil. - * - * @param left The {@link ItemStack} on the left of the anvil. - * @param right The {@link ItemStack} in the middle of the anvil. - * @param old The previous {@link ItemStack} result. - * @param itemName The anvil display name. - * @param player The player merging (for permissions). - * @return The result, stored as a {@link Pair} of {@link ItemStack} and {@link Integer}. - */ - public Pair doMerge(@Nullable final ItemStack left, - @Nullable final ItemStack right, - @Nullable final ItemStack old, - @NotNull final String itemName, - @NotNull final Player player) { - // Here so it can be accessed later (scope) - - // Copied to non-final string. - String name = itemName; - - int outDamage = -1; - if (old != null && old.getItemMeta() instanceof Damageable) { - outDamage = ((Damageable) old.getItemMeta()).getDamage(); - } - - if (left == null) { - return new Pair<>(null, null); - } - - if (left.getEnchantments().containsKey(EcoEnchants.PERMANENCE_CURSE)) { - return new Pair<>(null, null); - } - - name = name.replace("§", "&"); - - if (player.hasPermission("ecoenchants.anvil.color")) { - name = StringUtils.translate(name); - } - - if (!EnchantmentTarget.ALL.getMaterials().contains(left.getType()) || right == null || !EnchantmentTarget.ALL.getMaterials().contains(right.getType())) { - ItemStack out = left.clone(); - ItemMeta outMeta = out.getItemMeta(); - assert outMeta != null; - ItemMeta meta = left.getItemMeta(); - assert meta != null; - - outMeta.setDisplayName(name); - - if (meta.getDisplayName().equals(name)) { - - if (meta instanceof Damageable) { - int leftDamage = ((Damageable) meta).getDamage(); - - if (outDamage >= leftDamage || outDamage == -1) { - return new Pair<>(null, null); - } else { - ((Damageable) outMeta).setDamage(outDamage); - } - } else { - return new Pair<>(null, null); - } - if (right == null) { - return new Pair<>(null, null); - } - } - - out.setItemMeta(outMeta); - - if (out.equals(left)) { - return new Pair<>(null, null); - } - return new Pair<>(out, 0); - } - - if (left.getItemMeta() instanceof Damageable && right.getItemMeta() instanceof EnchantmentStorageMeta) { - outDamage = ((Damageable) left.getItemMeta()).getDamage(); - } - - if (!left.getType().equals(right.getType()) && !(right.getItemMeta() instanceof EnchantmentStorageMeta)) { - return new Pair<>(null, null); - } - - if (left.getAmount() != right.getAmount()) { - return new Pair<>(null, null); - } - - HashMap leftEnchants = new HashMap<>(); - HashMap rightEnchants = new HashMap<>(); - - Map outEnchants = new HashMap<>(); - - if (left.getItemMeta() instanceof EnchantmentStorageMeta) { - leftEnchants.putAll(((EnchantmentStorageMeta) left.getItemMeta()).getStoredEnchants()); - } else { - leftEnchants.putAll(left.getItemMeta().getEnchants()); - } - - if (right.getItemMeta() instanceof EnchantmentStorageMeta) { - rightEnchants.putAll(((EnchantmentStorageMeta) right.getItemMeta()).getStoredEnchants()); - } else { - rightEnchants.putAll(right.getItemMeta().getEnchants()); - } - - leftEnchants.forEach(((enchantment, integer) -> { - int level = integer; - - if (rightEnchants.containsKey(enchantment)) { - int rightLevel = rightEnchants.get(enchantment); - if (rightLevel > level) { - level = rightLevel; - } else if (rightLevel == level - && ((rightLevel > enchantment.getMaxLevel() && PLUGIN.getConfigYml().getBool("anvil.allow-combining-unsafe")) - || ((rightLevel + 1) <= enchantment.getMaxLevel() || PLUGIN.getConfigYml().getBool(ALLOW_UNSAFE_KEY)))) { - level++; - } - rightEnchants.remove(enchantment); - } - - outEnchants.put(enchantment, level); - })); - - rightEnchants.forEach(((enchantment, integer) -> { - AtomicBoolean doesConflict = new AtomicBoolean(false); - - EnchantmentType.values().forEach(enchantmentType -> { - EcoEnchant enchant = EcoEnchants.getFromEnchantment(enchantment); - if (enchant == null) { - return; - } - if (enchant.getType().equals(enchantmentType) && EcoEnchants.hasAnyOfType(left, enchantmentType) && enchantmentType.isSingular()) { - doesConflict.set(true); - } - }); - - leftEnchants.forEach((enchantment1, integer1) -> { - if (enchantment.conflictsWith(enchantment1)) { - doesConflict.set(true); - } - if (enchantment1.conflictsWith(enchantment)) { - doesConflict.set(true); - } - }); - - boolean canEnchantItem = enchantment.canEnchantItem(left); - if (left.getItemMeta() instanceof EnchantmentStorageMeta) { - canEnchantItem = true; - } - - if (canEnchantItem && !doesConflict.get()) { - if (PLUGIN.getConfigYml().getBool("anvil.hard-cap.enabled") && !player.hasPermission("ecoenchants.anvil.bypasshardcap") && outEnchants.size() >= PLUGIN.getConfigYml().getInt("anvil.hard-cap.cap")) { - return; - } - outEnchants.put(enchantment, integer); - } - })); - - // Test if the output is the same as left - if (outEnchants.equals(leftEnchants) && left.getItemMeta().getDisplayName().equals(name) && left.getItemMeta() instanceof Damageable) { - int leftDamage = ((Damageable) left.getItemMeta()).getDamage(); - - if (outDamage == leftDamage) { - return new Pair<>(null, null); - } - } - - ItemStack output = left.clone(); - - if (output.getItemMeta() instanceof EnchantmentStorageMeta) { - EnchantmentStorageMeta meta = (EnchantmentStorageMeta) output.getItemMeta(); - meta.getStoredEnchants().forEach(((enchantment, integer) -> { - meta.removeStoredEnchant(enchantment); - })); - - outEnchants.forEach(((enchantment, integer) -> { - meta.addStoredEnchant(enchantment, integer, PLUGIN.getConfigYml().getBool("anvil.allow-existing-unsafe-levels") || PLUGIN.getConfigYml().getBool(ALLOW_UNSAFE_KEY)); - })); - - meta.setDisplayName(name); - - output.setItemMeta(meta); - } else { - ItemMeta meta = output.getItemMeta(); - meta.getEnchants().forEach(((enchantment, integer) -> { - meta.removeEnchant(enchantment); - })); - - outEnchants.forEach(((enchantment, integer) -> { - meta.addEnchant(enchantment, integer, PLUGIN.getConfigYml().getBool("anvil.allow-existing-unsafe-levels") || PLUGIN.getConfigYml().getBool(ALLOW_UNSAFE_KEY)); - })); - - if (output.getItemMeta() instanceof Damageable) { - ((Damageable) meta).setDamage(outDamage); - } - - meta.setDisplayName(name); - - output.setItemMeta(meta); - } - - - // Calculate difference in enchant levels - int totalEnchantLevelDelta; - AtomicInteger outEnchantLevels = new AtomicInteger(); - AtomicInteger inEnchantLevels = new AtomicInteger(); - - outEnchants.forEach(((enchantment, integer) -> { - if (EcoEnchants.getFromEnchantment(enchantment) != null) { - outEnchantLevels.addAndGet(integer); - } - })); - leftEnchants.forEach(((enchantment, integer) -> { - if (EcoEnchants.getFromEnchantment(enchantment) != null) { - outEnchantLevels.addAndGet(integer); - } - })); - - totalEnchantLevelDelta = Math.abs(outEnchantLevels.intValue() - inEnchantLevels.intValue()); - - if (output.equals(left)) { - return new Pair<>(null, null); - } - - if (PLUGIN.getConfigYml().getBool("anvil.cost-exponent.enabled")) { - double exponent = PLUGIN.getConfigYml().getDouble("anvil.cost-exponent.exponent"); - int prevDelta = totalEnchantLevelDelta; - - double costMultiplier = Math.pow(exponent, totalEnchantLevelDelta); - double modifiedCost = Math.ceil((double) totalEnchantLevelDelta * costMultiplier); - totalEnchantLevelDelta = (int) modifiedCost; - - if (prevDelta > 0 && totalEnchantLevelDelta == 0) { - totalEnchantLevelDelta = prevDelta; - } - } - - return new Pair<>(output, totalEnchantLevelDelta); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneListeners.java deleted file mode 100644 index a05fb91a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneListeners.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.merging.grindstone; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.inventory.GrindstoneInventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.jetbrains.annotations.NotNull; - -import java.util.Map; - -public class GrindstoneListeners extends PluginDependent implements Listener { - /** - * Instantiate grindstone listeners and link them to a specific plugin. - * - * @param plugin The plugin to link to. - */ - public GrindstoneListeners(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Called when items are grindstoned. - * - * @param event The event to listen to. - */ - @EventHandler - public void onGrindstone(@NotNull final InventoryClickEvent event) { - Player player = (Player) event.getWhoClicked(); - - if (player.getOpenInventory().getTopInventory().getType() != InventoryType.GRINDSTONE) { - return; - } - - GrindstoneInventory inventory = (GrindstoneInventory) player.getOpenInventory().getTopInventory(); - - this.getPlugin().getScheduler().runLater(() -> { - ItemStack top = inventory.getItem(0); - ItemStack bottom = inventory.getItem(1); - ItemStack out = inventory.getItem(2); - - Map toKeep = GrindstoneMerge.doMerge(top, bottom); - - if (toKeep.isEmpty()) { - inventory.setItem(2, out); - } - if (out == null) { - return; - } - - ItemStack newOut = out.clone(); - if (newOut.getItemMeta() instanceof EnchantmentStorageMeta) { - EnchantmentStorageMeta meta = (EnchantmentStorageMeta) newOut.getItemMeta(); - toKeep.forEach(((enchantment, integer) -> { - meta.addStoredEnchant(enchantment, integer, true); - })); - newOut.setItemMeta(meta); - } else { - ItemMeta meta = newOut.getItemMeta(); - toKeep.forEach(((enchantment, integer) -> { - meta.addEnchant(enchantment, integer, true); - })); - newOut.setItemMeta(meta); - } - - final ItemStack finalOut = newOut; - - this.getPlugin().getScheduler().run(() -> { - inventory.setItem(2, finalOut); - }); - }, 1); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneMerge.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneMerge.java deleted file mode 100644 index 66ade936..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneMerge.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.merging.grindstone; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import lombok.experimental.UtilityClass; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.Map; - -@SuppressWarnings("deprecation") -@UtilityClass -public class GrindstoneMerge { - - /** - * Merge items in a grindstone. - * - * @param top The item at the top of the GUI. - * @param bottom The item at the bottom of the GUI. - * @return All enchantments for the output item to have. - */ - public static Map doMerge(@Nullable final ItemStack top, - @Nullable final ItemStack bottom) { - Map bottomEnchants = new HashMap<>(); - Map topEnchants = new HashMap<>(); - - Map toKeep = new HashMap<>(); - - if (top != null) { - if (top.getItemMeta() instanceof EnchantmentStorageMeta) { - topEnchants = new HashMap<>(((EnchantmentStorageMeta) top.getItemMeta()).getStoredEnchants()); - } else { - topEnchants = new HashMap<>(top.getEnchantments()); - } - } - - if (bottom != null) { - if (bottom.getItemMeta() instanceof EnchantmentStorageMeta) { - bottomEnchants = new HashMap<>(((EnchantmentStorageMeta) bottom.getItemMeta()).getStoredEnchants()); - } else { - bottomEnchants = new HashMap<>(bottom.getEnchantments()); - } - } - - bottomEnchants.forEach(((enchantment, integer) -> { - if (EcoEnchants.getFromEnchantment(enchantment) != null) { - EcoEnchant ecoEnchant = EcoEnchants.getFromEnchantment(enchantment); - if (!ecoEnchant.isGrindstoneable()) { - toKeep.putIfAbsent(enchantment, integer); - } - } else { - if (enchantment.isCursed()) { - toKeep.putIfAbsent(enchantment, integer); - } - } - })); - topEnchants.forEach(((enchantment, integer) -> { - if (EcoEnchants.getFromEnchantment(enchantment) != null) { - EcoEnchant ecoEnchant = EcoEnchants.getFromEnchantment(enchantment); - if (!ecoEnchant.isGrindstoneable()) { - toKeep.putIfAbsent(enchantment, integer); - } - } else { - if (enchantment.isCursed()) { - toKeep.putIfAbsent(enchantment, integer); - } - } - })); - - return toKeep; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/EnchantingListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/EnchantingListeners.java deleted file mode 100644 index 6df726c7..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/EnchantingListeners.java +++ /dev/null @@ -1,295 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.obtaining; - -import com.google.common.collect.ImmutableSet; -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -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.GameMode; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.enchantments.EnchantmentOffer; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.enchantment.EnchantItemEvent; -import org.bukkit.event.enchantment.PrepareItemEnchantEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; - -public class EnchantingListeners extends PluginDependent implements Listener { - /** - * All players currently enchanting a secondary item. - */ - public static final Map CURRENTLY_ENCHANTING_SECONDARY = new HashMap<>(); - /** - * All enchantments that by default cannot be enchanted in a table but are in EcoEnchants. - */ - private static final Set SECONDARY_ENCHANTABLE = new ImmutableSet.Builder() - .add(Material.ELYTRA) - .add(Material.SHIELD) - .add(Material.FLINT_AND_STEEL) - .add(Material.SHEARS) - .add(Material.CARROT_ON_A_STICK).build(); - - /** - * Instantiate enchanting listeners and link them to a specific plugin. - * - * @param plugin The plugin to link to. - */ - public EnchantingListeners(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Called on player leave. - * - * @param event The event to listen to. - */ - @EventHandler - public void onPlayerLeave(@NotNull final PlayerQuitEvent event) { - CURRENTLY_ENCHANTING_SECONDARY.remove(event.getPlayer()); - } - - /** - * Called on player enchant item. - * - * @param event The event to listen to. - */ - @EventHandler - public void enchantItem(@NotNull final EnchantItemEvent event) { - Player player = event.getEnchanter(); - ItemStack item = event.getItem(); - int cost = event.getExpLevelCost(); - - Map toAdd = event.getEnchantsToAdd(); - if (!this.getPlugin().getConfigYml().getBool("enchanting-table.enabled")) { - this.getPlugin().getScheduler().runLater(() -> { - ItemStack item0 = event.getInventory().getItem(0); - event.getInventory().setItem(0, item0); - }, 1); - return; - } - - if (SECONDARY_ENCHANTABLE.contains(event.getItem().getType())) { - ItemStack lapis = event.getInventory().getItem(1); - if (!player.getGameMode().equals(GameMode.CREATIVE)) { - if (lapis == null) { - event.setCancelled(true); - return; - } - - if (lapis.getAmount() < event.whichButton() + 1) { - event.setCancelled(true); - return; - } - - lapis.setAmount(lapis.getAmount() - (event.whichButton() + 1)); - - event.getInventory().setItem(1, lapis); - } - } - - double multiplier = 0.01; - if (item.getType().equals(Material.BOOK) || item.getType().equals(Material.ENCHANTED_BOOK)) { - multiplier /= this.getPlugin().getConfigYml().getInt("enchanting-table.book-times-less-likely"); - } - - if (this.getPlugin().getConfigYml().getBool("enchanting-table.reduce-probability.enabled")) { - multiplier /= this.getPlugin().getConfigYml().getDouble("enchanting-table.reduce-probability.factor"); - } - - ArrayList enchantments = new ArrayList<>(EcoEnchants.values()); - Collections.shuffle(enchantments); // Prevent list bias towards early enchantments like telekinesis - - boolean gotSpecial = false; - - for (EcoEnchant enchantment : enchantments) { - if (!enchantment.canEnchantItem(item)) { - continue; - } - if (NumberUtils.randFloat(0, 1) > enchantment.getRarity().getTableProbability() * multiplier) { - continue; - } - if (enchantment.getRarity().getMinimumLevel() > cost) { - continue; - } - if (!enchantment.isEnabled()) { - continue; - } - if (!enchantment.isAvailableFromTable()) { - continue; - } - if (!player.hasPermission("ecoenchants.fromtable." + enchantment.getPermissionName())) { - continue; - } - - AtomicBoolean anyConflicts = new AtomicBoolean(false); - - toAdd.forEach((enchant, integer) -> { - if (enchantment.conflictsWithAny(toAdd.keySet())) { - anyConflicts.set(true); - } - if (enchant.conflictsWith(enchantment)) { - anyConflicts.set(true); - } - - if (EcoEnchants.getFromEnchantment(enchant) != null) { - EcoEnchant ecoEnchant = EcoEnchants.getFromEnchantment(enchant); - if (enchantment.getType().equals(ecoEnchant.getType()) && ecoEnchant.getType().isSingular()) { - anyConflicts.set(true); - } - } - }); - if (anyConflicts.get()) { - continue; - } - - int level; - - double maxLevelDouble = enchantment.getMaxLevel(); - - if (enchantment.getType().equals(EnchantmentType.SPECIAL)) { - double enchantlevel1 = NumberUtils.randFloat(0, 1); - double enchantlevel2 = NumberUtils.bias(enchantlevel1, this.getPlugin().getConfigYml().getDouble("enchanting-table.special-bias")); - double enchantlevel3 = 1 / maxLevelDouble; - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } else { - int maxLevel = this.getPlugin().getConfigYml().getInt("enchanting-table.maximum-obtainable-level"); - double enchantlevel1 = (cost / (double) enchantment.getRarity().getMinimumLevel()) / (maxLevel / (double) enchantment.getRarity().getMinimumLevel()); - double enchantlevel2 = NumberUtils.triangularDistribution(0, 1, enchantlevel1); - double enchantlevel3 = 1 / maxLevelDouble; - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } - - level = NumberUtils.equalIfOver(level, enchantment.getMaxLevel()); - toAdd.put(enchantment, level); - - if (this.getPlugin().getConfigYml().getBool("enchanting-table.cap-amount.enabled") && toAdd.size() >= this.getPlugin().getConfigYml().getInt("enchanting-table.cap-amount.limit")) { - break; - } - - if (enchantment.getType().equals(EnchantmentType.SPECIAL)) { - gotSpecial = true; - } - - if (this.getPlugin().getConfigYml().getBool("enchanting-table.reduce-probability.enabled")) { - multiplier /= this.getPlugin().getConfigYml().getDouble("enchanting-table.reduce-probability.factor"); - } - } - toAdd.forEach(event.getEnchantsToAdd()::putIfAbsent); - - if (SECONDARY_ENCHANTABLE.contains(event.getItem().getType()) && !toAdd.containsKey(EcoEnchants.INDESTRUCTIBILITY)) { - event.getEnchantsToAdd().put(Enchantment.DURABILITY, CURRENTLY_ENCHANTING_SECONDARY.get(player)[event.whichButton()]); - CURRENTLY_ENCHANTING_SECONDARY.remove(player); - } - - if (gotSpecial && this.getPlugin().getConfigYml().getBool("enchanting-table.notify-on-special")) { - player.sendMessage(this.getPlugin().getLangYml().getMessage("got-special")); - } - - // Ew - this.getPlugin().getScheduler().runLater(() -> { - ItemStack item0 = event.getInventory().getItem(0); - assert item0 != null; - if (item0.getItemMeta() instanceof EnchantmentStorageMeta) { - EnchantmentStorageMeta meta = (EnchantmentStorageMeta) item0.getItemMeta(); - for (Enchantment enchantment : meta.getStoredEnchants().keySet()) { - meta.removeStoredEnchant(enchantment); - } - event.getEnchantsToAdd().forEach(((enchantment, integer) -> { - meta.addStoredEnchant(enchantment, integer, false); - })); - item0.setItemMeta(meta); - } - event.getInventory().setItem(0, item0); - }, 1); - } - - /** - * Called on prepare enchant. - * For secondary enchantments, generates unbreaking tooltips. - * - * @param event The event to listen to. - */ - @EventHandler - public void secondaryEnchant(@NotNull final PrepareItemEnchantEvent event) { - int maxLevel = this.getPlugin().getConfigYml().getInt("enchanting-table.maximum-obtainable-level"); - - try { - event.getOffers()[2].setCost(NumberUtils.equalIfOver(event.getOffers()[2].getCost(), maxLevel)); - } catch (ArrayIndexOutOfBoundsException | NullPointerException ignored) { - } - - if (!SECONDARY_ENCHANTABLE.contains(event.getItem().getType())) { - return; - } - - int bonus = event.getEnchantmentBonus(); - if (bonus > 15) { - bonus = 15; - } - if (bonus == 0) { - bonus = 1; - } - - double baseLevel = NumberUtils.randInt(1, 8) + Math.floor((double) bonus / 2) + NumberUtils.randInt(0, bonus); - - int bottomEnchantLevel = (int) Math.ceil(Math.max(baseLevel / 3, 1)); - int midEnchantLevel = (int) ((baseLevel * 2) / 3) + 1; - int topEnchantLevel = (int) Math.max(baseLevel, bonus * 2); - - bottomEnchantLevel *= (int) Math.ceil((double) maxLevel / 30); - midEnchantLevel *= (int) Math.ceil((double) maxLevel / 30); - topEnchantLevel *= (int) Math.ceil((double) maxLevel / 30); - - bottomEnchantLevel = NumberUtils.equalIfOver(bottomEnchantLevel, maxLevel); - - int midUnbreakingLevel = NumberUtils.randInt(1, 3); - if (midUnbreakingLevel < 2) { - midUnbreakingLevel = 2; - } - if (midEnchantLevel < 15) { - midUnbreakingLevel = 1; - } - - int topUnbreakingLevel = 3; - if (topEnchantLevel < 20) { - topUnbreakingLevel = 2; - } - if (topEnchantLevel < 10) { - topUnbreakingLevel = 1; - } - - EnchantmentOffer[] offers = { - new EnchantmentOffer(Enchantment.DURABILITY, 1, bottomEnchantLevel), - new EnchantmentOffer(Enchantment.DURABILITY, midUnbreakingLevel, midEnchantLevel), - new EnchantmentOffer(Enchantment.DURABILITY, topUnbreakingLevel, topEnchantLevel), - }; - - for (int i = 0; i < offers.length; i++) { - event.getOffers()[i] = offers[i]; - } - - CURRENTLY_ENCHANTING_SECONDARY.remove(event.getEnchanter()); - - int[] unbLevels = { - event.getOffers()[0].getEnchantmentLevel(), - event.getOffers()[1].getEnchantmentLevel(), - event.getOffers()[2].getEnchantmentLevel() - }; - - CURRENTLY_ENCHANTING_SECONDARY.put(event.getEnchanter(), unbLevels); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/LootPopulator.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/LootPopulator.java deleted file mode 100644 index 96206f93..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/LootPopulator.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.obtaining; - -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -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.Chunk; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.block.BlockState; -import org.bukkit.block.Chest; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.generator.BlockPopulator; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Random; -import java.util.concurrent.atomic.AtomicBoolean; - -public class LootPopulator extends BlockPopulator { - /** - * Instance of ecoenchants. - */ - private final EcoEnchantsPlugin plugin; - - /** - * Create a new loot populator. - * - * @param plugin The plugin. - */ - public LootPopulator(@NotNull final EcoEnchantsPlugin plugin) { - this.plugin = plugin; - } - - /** - * Populate a chunk's loot chests. - * - * @param world The world to populate. - * @param random Bukkit parity. - * @param chunk The chunk to populate. - */ - public void populate(@NotNull final World world, - @NotNull final Random random, - @NotNull final Chunk chunk) { - if (!plugin.getConfigYml().getBool("loot.enabled")) { - return; - } - - for (BlockState state : chunk.getTileEntities()) { - Block block = state.getBlock(); - if (!(block.getState() instanceof Chest)) { - continue; - } - - Chest chestState = (Chest) block.getState(); - Inventory inventory = chestState.getBlockInventory(); - - for (ItemStack item : inventory) { - if (item == null) { - continue; - } - if (!EnchantmentTarget.ALL.getMaterials().contains(item.getType())) { - continue; - } - if (item.getType().equals(Material.BOOK)) { - continue; - } - - HashMap toAdd = new HashMap<>(); - - ArrayList enchantments = new ArrayList<>(EcoEnchants.values()); - Collections.shuffle(enchantments); // Prevent list bias towards early enchantments like telekinesis - - double multiplier = 0.01; - if (item.getType().equals(Material.BOOK) || item.getType().equals(Material.ENCHANTED_BOOK)) { - multiplier /= plugin.getConfigYml().getInt("loot.book-times-less-likely"); - } - - if (plugin.getConfigYml().getBool("loot.reduce-probability.enabled")) { - multiplier /= plugin.getConfigYml().getDouble("loot.reduce-probability.factor"); - } - - for (EcoEnchant enchantment : enchantments) { - if (enchantment == null || enchantment.getRarity() == null) { - continue; - } - - if (NumberUtils.randFloat(0, 1) > enchantment.getRarity().getLootProbability() * multiplier) { - continue; - } - - if (!enchantment.isAvailableFromLoot()) { - continue; - } - - if (!enchantment.canEnchantItem(item)) { - continue; - } - - if (!enchantment.isEnabled()) { - continue; - } - - AtomicBoolean anyConflicts = new AtomicBoolean(false); - toAdd.forEach((enchant, integer) -> { - if (enchantment.conflictsWithAny(toAdd.keySet())) { - anyConflicts.set(true); - } - if (enchant.conflictsWith(enchantment)) { - anyConflicts.set(true); - } - - EcoEnchant ecoEnchant = EcoEnchants.getFromEnchantment(enchant); - if (enchantment.getType().equals(ecoEnchant.getType()) && ecoEnchant.getType().isSingular()) { - anyConflicts.set(true); - } - }); - if (anyConflicts.get()) { - continue; - } - - int level; - - if (enchantment.getType().equals(EnchantmentType.SPECIAL)) { - double enchantlevel1 = NumberUtils.randFloat(0, 1); - double enchantlevel2 = NumberUtils.bias(enchantlevel1, plugin.getConfigYml().getDouble("enchanting-table.special-bias")); - double enchantlevel3 = 1 / (double) enchantment.getMaxLevel(); - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } else { - double enchantlevel2 = NumberUtils.triangularDistribution(0, 1, 1); - double enchantlevel3 = 1 / (double) enchantment.getMaxLevel(); - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } - - toAdd.put(enchantment, level); - - if (plugin.getConfigYml().getBool("loot.reduce-probability.enabled")) { - multiplier /= plugin.getConfigYml().getDouble("loot.reduce-probability.factor"); - } - } - - if (item.getItemMeta() instanceof EnchantmentStorageMeta) { - EnchantmentStorageMeta meta = (EnchantmentStorageMeta) item.getItemMeta(); - toAdd.forEach(((enchantment, integer) -> meta.addStoredEnchant(enchantment, integer, false))); - item.setItemMeta(meta); - } else { - ItemMeta meta = item.getItemMeta(); - toAdd.forEach(((enchantment, integer) -> meta.addEnchant(enchantment, integer, false))); - item.setItemMeta(meta); - } - } - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java deleted file mode 100644 index 001d433a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.obtaining; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.util.NumberUtils; -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.Material; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.VillagerAcquireTradeEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.MerchantRecipe; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -public class VillagerListeners extends PluginDependent implements Listener { - /** - * Create new villager listeners. - * - * @param plugin The plugin. - */ - public VillagerListeners(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Called on villager gain trade. - * - * @param event The event to listen for. - */ - @EventHandler - public void onVillagerGainBookTrade(@NotNull final VillagerAcquireTradeEvent event) { - if (!event.getRecipe().getResult().getType().equals(Material.ENCHANTED_BOOK)) { - return; - } - - if (!this.getPlugin().getConfigYml().getBool("villager.enabled")) { - return; - } - - ItemStack result = event.getRecipe().getResult().clone(); - int uses = event.getRecipe().getUses(); - int maxUses = event.getRecipe().getMaxUses(); - boolean experienceReward = event.getRecipe().hasExperienceReward(); - int villagerExperience = event.getRecipe().getVillagerExperience(); - float priceMultiplier = event.getRecipe().getPriceMultiplier(); - List ingredients = event.getRecipe().getIngredients(); - - if (!(result.getItemMeta() instanceof EnchantmentStorageMeta)) { - return; - } - - EnchantmentStorageMeta meta = (EnchantmentStorageMeta) result.getItemMeta(); - - ArrayList enchantments = new ArrayList<>(EcoEnchants.values()); - Collections.shuffle(enchantments); // Prevent list bias towards early enchantments like telekinesis - - double multiplier = 0.01 / this.getPlugin().getConfigYml().getDouble("villager.book-times-less-likely"); - - for (EcoEnchant enchantment : enchantments) { - if (NumberUtils.randFloat(0, 1) > enchantment.getRarity().getVillagerProbability() * multiplier) { - continue; - } - - if (!enchantment.isAvailableFromVillager()) { - continue; - } - - if (!enchantment.isEnabled()) { - continue; - } - - int level; - - if (enchantment.getType().equals(EnchantmentType.SPECIAL)) { - double enchantlevel1 = NumberUtils.randFloat(0, 1); - double enchantlevel2 = NumberUtils.bias(enchantlevel1, this.getPlugin().getConfigYml().getDouble("enchanting-table.special-bias")); - double enchantlevel3 = 1 / (double) enchantment.getMaxLevel(); - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } else { - int cost = event.getRecipe().getIngredients().get(0).getAmount(); - double enchantlevel1 = (double) cost / 64; - double enchantlevel2 = NumberUtils.triangularDistribution(0, 1, enchantlevel1); - double enchantlevel3 = 1 / (double) enchantment.getMaxLevel(); - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } - - meta.getStoredEnchants().forEach(((enchantment1, integer) -> meta.removeStoredEnchant(enchantment1))); - - meta.addStoredEnchant(enchantment, level, false); - break; - } - - result.setItemMeta(meta); - - MerchantRecipe recipe = new MerchantRecipe(result, uses, maxUses, experienceReward, villagerExperience, priceMultiplier); - recipe.setIngredients(ingredients); - event.setRecipe(recipe); - } - - /** - * Called on villager gain trade. - * - * @param event The event to listen for. - */ - @EventHandler - public void onVillagerGainItemTrade(@NotNull final VillagerAcquireTradeEvent event) { - - if (!EnchantmentTarget.ALL.getMaterials().contains(event.getRecipe().getResult().getType())) { - return; - } - - if (event.getRecipe().getResult().getType().equals(Material.BOOK)) { - return; - } - - if (!this.getPlugin().getConfigYml().getBool("villager.enabled")) { - return; - } - - ItemStack result = event.getRecipe().getResult().clone(); - int uses = event.getRecipe().getUses(); - int maxUses = event.getRecipe().getMaxUses(); - boolean experienceReward = event.getRecipe().hasExperienceReward(); - int villagerExperience = event.getRecipe().getVillagerExperience(); - float priceMultiplier = event.getRecipe().getPriceMultiplier(); - List ingredients = event.getRecipe().getIngredients(); - - if (result.getItemMeta() instanceof EnchantmentStorageMeta) { - return; - } - - ItemMeta meta = result.getItemMeta(); - - ArrayList enchantments = new ArrayList<>(EcoEnchants.values()); - Collections.shuffle(enchantments); // Prevent list bias towards early enchantments like telekinesis - - Map toAdd = new HashMap<>(); - - double multiplier = 0.01; - - for (EcoEnchant enchantment : enchantments) { - if (NumberUtils.randFloat(0, 1) > enchantment.getRarity().getVillagerProbability() * multiplier) { - continue; - } - - if (!enchantment.isAvailableFromVillager()) { - continue; - } - - if (!enchantment.canEnchantItem(result)) { - continue; - } - - if (!enchantment.isEnabled()) { - continue; - } - - AtomicBoolean anyConflicts = new AtomicBoolean(false); - toAdd.forEach((enchant, integer) -> { - if (enchantment.conflictsWithAny(toAdd.keySet())) { - anyConflicts.set(true); - } - - if (enchant.conflictsWith(enchantment)) { - anyConflicts.set(true); - } - - if (enchantment.conflictsWith(enchant)) { - anyConflicts.set(true); - } - - EcoEnchant ecoEnchant = EcoEnchants.getFromEnchantment(enchant); - - if (enchantment.getType().equals(ecoEnchant.getType()) && ecoEnchant.getType().isSingular()) { - anyConflicts.set(true); - } - }); - - if (anyConflicts.get()) { - continue; - } - - int level; - - if (enchantment.getType().equals(EnchantmentType.SPECIAL)) { - double enchantlevel1 = NumberUtils.randFloat(0, 1); - double enchantlevel2 = NumberUtils.bias(enchantlevel1, this.getPlugin().getConfigYml().getDouble("enchanting-table.special-bias")); - double enchantlevel3 = 1 / (double) enchantment.getMaxLevel(); - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } else { - int cost = event.getRecipe().getIngredients().get(0).getAmount(); - double enchantlevel1 = (double) cost / 64; - double enchantlevel2 = NumberUtils.triangularDistribution(0, 1, enchantlevel1); - double enchantlevel3 = 1 / (double) enchantment.getMaxLevel(); - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } - - toAdd.put(enchantment, level); - - if (this.getPlugin().getConfigYml().getBool("villager.reduce-probability.enabled")) { - multiplier /= this.getPlugin().getConfigYml().getDouble("villager.reduce-probability.factor"); - } - } - - toAdd.forEach(((enchantment, integer) -> meta.addEnchant(enchantment, integer, false))); - - result.setItemMeta(meta); - - MerchantRecipe recipe = new MerchantRecipe(result, uses, maxUses, experienceReward, villagerExperience, priceMultiplier); - recipe.setIngredients(ingredients); - event.setRecipe(recipe); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantChecks.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantChecks.java deleted file mode 100644 index e3fc575e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantChecks.java +++ /dev/null @@ -1,437 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - - -import com.willfp.eco.util.DurabilityUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.proxy.proxies.FastGetEnchantsProxy; -import com.willfp.ecoenchants.util.ProxyUtils; -import lombok.experimental.UtilityClass; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.metadata.MetadataValue; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; - -@SuppressWarnings("unchecked") -@UtilityClass -public class EnchantChecks { - /** - * Proxy instance of FastGetEnchants. - */ - private static final FastGetEnchantsProxy PROXY = ProxyUtils.getProxy(FastGetEnchantsProxy.class); - - /** - * Does the specified ItemStack have a certain Enchantment present? - * - * @param item The {@link ItemStack} to check - * @param enchantment The enchantment to query - * @return If the item has the queried enchantment - */ - public static boolean item(@Nullable final ItemStack item, - @NotNull final Enchantment enchantment) { - return getItemLevel(item, enchantment) != 0; - } - - /** - * What level of the specified enchantment does the specified ItemStack have? - * - * @param item The {@link ItemStack} to check - * @param enchantment The enchantment to query - * @return The level of the enchantment, or 0 if not found - */ - public static int getItemLevel(@Nullable final ItemStack item, - @NotNull final Enchantment enchantment) { - if (item == null) { - return 0; - } - if (item.getType().equals(Material.AIR)) { - return 0; - } - - return PROXY.getLevelOnItem(item, enchantment); - } - - /** - * Get all {@link EcoEnchant}s on a specified ItemStack. - * - * @param item The ItemStack to query. - * @return A {@link HashMap} of all EcoEnchants, where the key represents the level. - */ - public static Map getEnchantsOnItem(@Nullable final ItemStack item) { - if (item == null) { - return new HashMap<>(); - } - if (item.getType().equals(Material.AIR)) { - return new HashMap<>(); - } - - Map ecoEnchants = new HashMap<>(); - for (Map.Entry enchantmentIntegerEntry : PROXY.getEnchantmentsOnItem(item).entrySet()) { - EcoEnchant enchant = EcoEnchants.getFromEnchantment(enchantmentIntegerEntry.getKey()); - if (enchant != null) { - ecoEnchants.put(enchant, enchantmentIntegerEntry.getValue()); - } - } - - return ecoEnchants; - } - - /** - * Does the specified Arrow have a certain Enchantment present? - *

- * EcoEnchants automatically gives an arrow NBT data consisting of the enchantments present to avoid switching errors. - * - * @param arrow The {@link Arrow} to check. - * @param enchantment The enchantment to query. - * @return If the arrow has the queried enchantment. - */ - public static boolean arrow(@NotNull final Arrow arrow, - @NotNull final Enchantment enchantment) { - return getArrowLevel(arrow, enchantment) != 0; - } - - /** - * What level specified Arrow has of a certain Enchantment present? - *

- * EcoEnchants automatically gives an arrow NBT data consisting of the enchantments present to avoid switching errors. - * - * @param arrow The {@link Arrow} to check. - * @param enchantment The enchantment to query. - * @return The level found on the arrow, or 0 if not found. - */ - public static int getArrowLevel(@NotNull final Arrow arrow, - @NotNull final Enchantment enchantment) { - if (arrow.getMetadata("shot-from").isEmpty()) { - return 0; - } - - MetadataValue enchantmentsMetaValue = arrow.getMetadata("shot-from").get(0); - if (!(enchantmentsMetaValue.value() instanceof ItemStack)) { - return 0; - } - - ItemStack shotFrom = (ItemStack) enchantmentsMetaValue.value(); - return getItemLevel(shotFrom, enchantment); - } - - /** - * Get all {@link EcoEnchant}s on a specified Arrow. - * - * @param arrow The Arrow to query. - * @return A {@link HashMap} of all EcoEnchants, where the key represents the level. - */ - public static Map getEnchantsOnArrow(@NotNull final Arrow arrow) { - if (arrow.getMetadata("shot-from").isEmpty()) { - return new HashMap<>(); - } - - MetadataValue enchantmentsMetaValue = arrow.getMetadata("shot-from").get(0); - if (!(enchantmentsMetaValue.value() instanceof ItemStack)) { - return new HashMap<>(); - } - - ItemStack shotFrom = (ItemStack) enchantmentsMetaValue.value(); - return getEnchantsOnItem(shotFrom); - } - - /** - * Does the specified {@link LivingEntity} have a certain Enchantment present on the item in their main hand? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return If the LivingEntity has the enchantment. - */ - public static boolean mainhand(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - return getMainhandLevel(entity, enchantment) != 0; - } - - /** - * What level of the specified enchantment does the queried {@link LivingEntity} have on their main hand item? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return The level found on the mainhand item, or 0 if not found. - */ - public static int getMainhandLevel(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - if (entity.getEquipment() == null) { - return 0; - } - - ItemStack item = entity.getEquipment().getItemInMainHand(); - - return getItemLevel(item, enchantment); - } - - /** - * Get all {@link EcoEnchant}s on a queried {@link LivingEntity}s main hand item. - * - * @param entity The entity to query. - * @return A {@link HashMap} of all EcoEnchants, where the key represents the level. - */ - public static Map getEnchantsOnMainhand(@NotNull final LivingEntity entity) { - if (entity.getEquipment() == null) { - return new HashMap<>(); - } - - ItemStack item = entity.getEquipment().getItemInMainHand(); - - return getEnchantsOnItem(item); - } - - /** - * Does the specified {@link LivingEntity} have a certain Enchantment present on the item in their offhand? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return If the LivingEntity has the enchantment. - */ - public static boolean offhand(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - return getOffhandLevel(entity, enchantment) != 0; - } - - /** - * What level of the specified enchantment does the queried {@link LivingEntity} have on their offhand item? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return The level found on the offhand item, or 0 if not found. - */ - public static int getOffhandLevel(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - if (entity.getEquipment() == null) { - return 0; - } - - ItemStack item = entity.getEquipment().getItemInOffHand(); - - return getItemLevel(item, enchantment); - } - - /** - * Get all {@link EcoEnchant}s on a queried {@link LivingEntity}s offhand item. - * - * @param entity The entity to query. - * @return A {@link HashMap} of all EcoEnchants, where the key represents the level. - */ - public static Map getEnchantsOnOffhand(@NotNull final LivingEntity entity) { - if (entity.getEquipment() == null) { - return new HashMap<>(); - } - - ItemStack item = entity.getEquipment().getItemInOffHand(); - - return getEnchantsOnItem(item); - } - - /** - * Get a cumulative total of all levels on a {@link LivingEntity}s armor of a certain enchantment. - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return The cumulative total of all levels, ie 4 pieces all with level 3 returns 12 - */ - public static int getArmorPoints(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - return getArmorPoints(entity, enchantment, 0); - } - - /** - * Get a cumulative total of all levels on a {@link LivingEntity}s armor of a certain enchantment. - *

- * Then, apply a specified amount of damage to all items with said enchantment. - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @param damage The amount of damage to deal to all armor pieces. - * @return The cumulative total of all levels, ie 4 pieces all with level 3 returns 12. - */ - public static int getArmorPoints(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment, - final int damage) { - if (entity.getEquipment() == null) { - return 0; - } - - boolean isPlayer = entity instanceof Player; - - AtomicInteger armorPoints = new AtomicInteger(0); - List armor = Arrays.asList(entity.getEquipment().getArmorContents()); - armor.forEach((itemStack -> { - int level = getItemLevel(itemStack, enchantment); - if (level != 0) { - armorPoints.addAndGet(getItemLevel(itemStack, enchantment)); - if (damage > 0 && isPlayer) { - Player player = (Player) entity; - if (itemStack.equals(entity.getEquipment().getHelmet())) { - DurabilityUtils.damageItem(player, player.getInventory().getHelmet(), level, 39); - } - if (itemStack.equals(entity.getEquipment().getChestplate())) { - DurabilityUtils.damageItem(player, player.getInventory().getChestplate(), level, 38); - } - if (itemStack.equals(entity.getEquipment().getLeggings())) { - DurabilityUtils.damageItem(player, player.getInventory().getLeggings(), level, 37); - } - if (itemStack.equals(entity.getEquipment().getBoots())) { - DurabilityUtils.damageItem(player, player.getInventory().getBoots(), level, 36); - } - } - } - })); - - return armorPoints.get(); - } - - /** - * Get all {@link EcoEnchant}s on a queried {@link LivingEntity}s armor. - * - * @param entity The entity to query. - * @return A {@link HashMap} of all EcoEnchants, where the key represents the cumulative total levels. - */ - public static Map getEnchantsOnArmor(@NotNull final LivingEntity entity) { - if (entity.getEquipment() == null) { - return new HashMap<>(); - } - - Map ecoEnchants = new HashMap<>(); - - for (ItemStack itemStack : entity.getEquipment().getArmorContents()) { - ecoEnchants.putAll(EnchantChecks.getEnchantsOnItem(itemStack)); - } - - return ecoEnchants; - } - - /** - * Does the specified {@link LivingEntity} have a certain Enchantment present on their helmet? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return If the LivingEntity has the enchantment. - */ - public static boolean helmet(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - return getHelmetLevel(entity, enchantment) != 0; - } - - /** - * What level of the specified enchantment does the queried {@link LivingEntity} have on their helmet? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return The level found, or 0 if not found. - */ - public static int getHelmetLevel(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - if (entity.getEquipment() == null) { - return 0; - } - - ItemStack item = entity.getEquipment().getHelmet(); - - return getItemLevel(item, enchantment); - } - - /** - * Does the specified {@link LivingEntity} have a certain Enchantment present on their chestplate? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return If the LivingEntity has the enchantment. - */ - public static boolean chestplate(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - return getChestplateLevel(entity, enchantment) != 0; - } - - /** - * What level of the specified enchantment does the queried {@link LivingEntity} have on their chestplate? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return The level found, or 0 if not found. - */ - public static int getChestplateLevel(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - if (entity.getEquipment() == null) { - return 0; - } - - ItemStack item = entity.getEquipment().getChestplate(); - - return getItemLevel(item, enchantment); - } - - /** - * Does the specified {@link LivingEntity} have a certain Enchantment present on their leggings? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return If the LivingEntity has the enchantment. - */ - public static boolean leggings(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - return getLeggingsLevel(entity, enchantment) != 0; - } - - /** - * What level of the specified enchantment does the queried {@link LivingEntity} have on their leggings? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return The level found, or 0 if not found. - */ - public static int getLeggingsLevel(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - if (entity.getEquipment() == null) { - return 0; - } - - ItemStack item = entity.getEquipment().getLeggings(); - - return getItemLevel(item, enchantment); - } - - /** - * Does the specified {@link LivingEntity} have a certain Enchantment present on their boots? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return If the LivingEntity has the enchantment. - */ - public static boolean boots(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - return getBootsLevel(entity, enchantment) != 0; - } - - /** - * What level of the specified enchantment does the queried {@link LivingEntity} have on their boots? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return The level found, or 0 if not found. - */ - public static int getBootsLevel(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - if (entity.getEquipment() == null) { - return 0; - } - - ItemStack item = entity.getEquipment().getBoots(); - - return getItemLevel(item, enchantment); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantmentUtils.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantmentUtils.java deleted file mode 100644 index 43100c3d..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantmentUtils.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -import com.willfp.eco.core.integrations.placeholder.PlaceholderEntry; -import com.willfp.eco.core.integrations.placeholder.PlaceholderManager; -import com.willfp.eco.util.NumberUtils; -import com.willfp.eco.util.StringUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import lombok.experimental.UtilityClass; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -@UtilityClass -public class EnchantmentUtils { - /** - * If the enchantment has successfully passed its specified chance. - * - * @param enchantment The enchantment to query. - * @param level The level to base the chance off of. - * @return If the enchantment should then be executed. - */ - public static boolean passedChance(@NotNull final EcoEnchant enchantment, - final int level) { - return NumberUtils.randFloat(0, 1) < ((enchantment.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "chance-per-level") * level) / 100); - } - - /** - * If attack was fully charged if required. - * - * @param enchantment The enchantment. - * @param entity The attacker. - * @return If was fully charged. - */ - public static boolean isFullyChargeIfRequired(@NotNull final EcoEnchant enchantment, - @NotNull final LivingEntity entity) { - if (entity instanceof Player) { - if (((Player) entity).getAttackCooldown() != 1.0f) { - return enchantment.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"); - } - } - - return true; - } - - /** - * Register the placeholders for an enchantment. - * - * @param enchantment The enchantment to register placeholders for. - */ - public static void registerPlaceholders(@NotNull final EcoEnchant enchantment) { - PlaceholderManager.registerPlaceholder( - new PlaceholderEntry( - enchantment.getPermissionName() + "_" + "enabled", - player -> String.valueOf(enchantment.isEnabled()) - ) - ); - - enchantment.getConfig().getKeys(true).forEach(string -> { - String key = string.replace("\\.", "_").replace("-", "_"); - Object object = enchantment.getConfig().get(string); - - PlaceholderManager.registerPlaceholder( - new PlaceholderEntry( - enchantment.getPermissionName() + "_" + key, - player -> StringUtils.internalToString(object) - ) - ); - }); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/ItemConversions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/ItemConversions.java deleted file mode 100644 index 78d779fa..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/ItemConversions.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.display.EnchantDisplay; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import org.bukkit.ChatColor; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryOpenEvent; -import org.bukkit.event.player.PlayerItemHeldEvent; -import org.bukkit.inventory.BlockInventoryHolder; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemFlag; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class ItemConversions extends PluginDependent implements Listener { - /** - * Instantiate item conversions. - * - * @param plugin Instance of EcoEnchants. - */ - public ItemConversions(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * On player hold item. - *

- * Listener for lore conversion. - * - * @param event The event to listen for. - */ - @EventHandler - public void loreConverter(@NotNull final PlayerItemHeldEvent event) { - if (!((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().isUsingLoreGetter()) { - return; - } - - ItemStack itemStack = event.getPlayer().getInventory().getItem(event.getNewSlot()); - - convertLore(itemStack); - } - - /** - * On player open inventory. - *

- * Listener for lore conversion. - * - * @param event The event to listen for. - */ - @EventHandler - public void aggressiveLoreConverter(@NotNull final InventoryOpenEvent event) { - if (!((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().isUsingAggressiveLoreGetter()) { - return; - } - - Inventory inventory = event.getInventory(); - - if (inventory.getHolder() == null) { - return; - } - - if (!(inventory.getHolder() instanceof BlockInventoryHolder)) { - return; - } - - for (ItemStack itemStack : inventory.getContents()) { - convertLore(itemStack); - } - } - - private void convertLore(@Nullable final ItemStack itemStack) { - if (itemStack == null) { - return; - } - - ItemMeta meta = itemStack.getItemMeta(); - if (meta == null) { - return; - } - - Map toAdd = new HashMap<>(); - - List lore = meta.getLore(); - - if (lore == null) { - return; - } - - for (String line : new ArrayList<>(lore)) { - String rawLine = line; - line = ChatColor.stripColor(line); - - EcoEnchant enchant; - int level; - List lineSplit = new ArrayList<>(Arrays.asList(line.split(" "))); - if (lineSplit.size() == 0) { - continue; - } - if (lineSplit.size() == 1) { - enchant = EcoEnchants.getByName(lineSplit.get(0)); - level = 1; - } else { - EcoEnchant attemptFullLine = EcoEnchants.getByName(line); - - if (attemptFullLine != null) { - enchant = attemptFullLine; - level = 1; - } else { - String levelString = lineSplit.get(lineSplit.size() - 1); - lineSplit.remove(levelString); - levelString = levelString.trim(); - - try { - level = NumberUtils.fromNumeral(levelString); - } catch (IllegalArgumentException e) { - continue; - } - - String enchantName = lineSplit.stream().collect(Collectors.joining(" ")); - enchant = EcoEnchants.getByName(enchantName); - } - } - - if (enchant != null) { - lore.remove(rawLine); - toAdd.put(enchant, level); - } - } - - if (meta instanceof EnchantmentStorageMeta) { - lore.clear(); - toAdd.forEach((enchantment, integer) -> ((EnchantmentStorageMeta) meta).addStoredEnchant(enchantment, integer, true)); - } else { - toAdd.forEach((enchantment, integer) -> meta.addEnchant(enchantment, integer, true)); - } - meta.setLore(lore); - itemStack.setItemMeta(meta); - } - - /** - * On player hold item. - *

- * Listener for hide fixer. - * - * @param event The event to listen for. - */ - @EventHandler - public void hideFixer(@NotNull final PlayerItemHeldEvent event) { - if (!((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().isUsingExperimentalHideFixer()) { - return; - } - - ItemStack itemStack = event.getPlayer().getInventory().getItem(event.getNewSlot()); - - hideFixItem(itemStack); - } - - /** - * On player open inventory. - *

- * Listener for hide fixer. - * - * @param event The event to listen for. - */ - @EventHandler - public void aggressiveHideFixer(@NotNull final InventoryOpenEvent event) { - if (!((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().isUsingAggressiveExperimentalHideFixer()) { - return; - } - - Inventory inventory = event.getInventory(); - - if (inventory.getHolder() == null) { - return; - } - - if (!(inventory.getHolder() instanceof BlockInventoryHolder)) { - return; - } - - for (ItemStack itemStack : inventory.getContents()) { - hideFixItem(itemStack); - } - } - - private void hideFixItem(@Nullable final ItemStack itemStack) { - if (itemStack == null) { - return; - } - - if (!EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) { - return; - } - - ItemMeta meta = itemStack.getItemMeta(); - if (meta == null) { - return; - } - - if (((EnchantDisplay) this.getPlugin().getDisplayModule()).getOptions().isUsingForceHideFixer()) { - meta.removeItemFlags(ItemFlag.HIDE_ENCHANTS); - meta.removeItemFlags(ItemFlag.HIDE_POTION_EFFECTS); - } else { - if (meta.hasItemFlag(ItemFlag.HIDE_ENCHANTS) && meta.hasItemFlag(ItemFlag.HIDE_POTION_EFFECTS)) { - meta.removeItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_POTION_EFFECTS); - } - } - - itemStack.setItemMeta(meta); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/SpellActivateEvent.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/SpellActivateEvent.java deleted file mode 100644 index d67a4d6a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/SpellActivateEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import lombok.Getter; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerEvent; -import org.jetbrains.annotations.NotNull; - -public class SpellActivateEvent extends PlayerEvent implements Cancellable { - /** - * Internal, for bukkit. - */ - private static final HandlerList HANDLERS = new HandlerList(); - - /** - * The spell that was activated. - */ - @Getter - private final Spell spell; - - /** - * If the spell activation was cancelled. - */ - private boolean cancelled; - - /** - * Create new SpellActivateEvent. - * - * @param player The player. - * @param spell The spell. - */ - public SpellActivateEvent(@NotNull final Player player, - @NotNull final Spell spell) { - super(player); - - this.spell = spell; - this.cancelled = false; - } - - /** - * Bukkit parity. - * - * @return The handler list. - */ - public static HandlerList getHandlerList() { - return HANDLERS; - } - - @Override - public boolean isCancelled() { - return cancelled; - } - - @Override - public void setCancelled(final boolean cancel) { - this.cancelled = cancel; - } - - @NotNull - @Override - public HandlerList getHandlers() { - return HANDLERS; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/TimedRunnable.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/TimedRunnable.java deleted file mode 100644 index e6f399f3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/TimedRunnable.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -public interface TimedRunnable extends Runnable { - /** - * Get the time between repetitions. - * - * @return The time. - */ - long getTime(); -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/Watcher.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/Watcher.java deleted file mode 100644 index 6abf2869..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/Watcher.java +++ /dev/null @@ -1,238 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -import com.willfp.eco.core.events.ArmorEquipEvent; -import org.bukkit.block.Block; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.entity.Trident; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockDamageEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.jetbrains.annotations.NotNull; - -public interface Watcher { - - /** - * Called when an entity shoots another entity with an arrow. - * - * @param attacker The shooter. - * @param victim The victim. - * @param arrow The arrow entity. - * @param level The level of the enchantment on the arrow. - * @param event The event that called this watcher. - */ - default void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity damages another entity with a trident throw. - * - * @param attacker The shooter. - * @param victim The victim. - * @param trident The trident entity. - * @param level The level of the enchantment on the trident. - * @param event The event that called this watcher. - */ - default void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when a player jumps. - * - * @param player The player. - * @param level The level of the enchantment found on the player's armor. - * @param event The event that called this watcher. - */ - default void onJump(@NotNull final Player player, - final int level, - @NotNull final PlayerMoveEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity attacks another entity with a melee attack. - * - * @param attacker The attacker. - * @param victim The victim. - * @param level The level of the enchantment found on the attacker's weapon. - * @param event The event that called this watcher. - */ - default void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity shoots a bow. - * - * @param shooter The entity that shot the bow. - * @param arrow The arrow that was shot. - * @param level The level of the enchantment found on the bow. - * @param event The event that called this watcher. - */ - default void onBowShoot(@NotNull final LivingEntity shooter, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityShootBowEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity shoots a projectile. - * - * @param shooter The entity that shot the bow. - * @param projectile The projectile that was shot. - * @param level The level of the enchantment found on the projectile. - * @param event The event that called this watcher. - */ - default void onProjectileLaunch(@NotNull final LivingEntity shooter, - @NotNull final Projectile projectile, - final int level, - @NotNull final ProjectileLaunchEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity takes fall damage. - * - * @param faller The entity that took the fall damage. - * @param level The level of the enchantment found on the entity's armor. - * @param event The event that called this watcher. - */ - default void onFallDamage(@NotNull final LivingEntity faller, - final int level, - @NotNull final EntityDamageEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an arrow hits a block or entity. - * - * @param shooter The entity that shot the arrow. - * @param level The level of the enchantment found on the arrow. - * @param event The event that called this watcher. - */ - default void onArrowHit(@NotNull final LivingEntity shooter, - final int level, - @NotNull final ProjectileHitEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when a trident hits a block or entity. - * - * @param shooter The entity that threw the trident. - * @param level The level of the enchantment found on the trident. - * @param event The event that called this watcher. - */ - default void onTridentHit(@NotNull final LivingEntity shooter, - final int level, - @NotNull final ProjectileHitEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when a player breaks a block. - * - * @param player The player. - * @param block The block that was broken. - * @param level The level of the enchantment found on the player's main hand item. - * @param event The event that called this watcher. - */ - default void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity takes damage wearing armor. - * - * @param victim The entity that took damage. - * @param level The level of the enchantment found on the entity's armor. - * @param event The event that called this watcher. - */ - default void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity puts on or takes off armor with an enchantment. - * - * @param player The player that equipped the armor. - * @param level The level of the enchantment found on the player's armor. - * @param event The event that called this watcher. - */ - default void onArmorEquip(@NotNull final Player player, - final int level, - @NotNull final ArmorEquipEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when a player damages a block. - * - * @param player The player that damaged the block. - * @param block The damaged block. - * @param level The level of the enchantment found on the player's main hand. - * @param event The event that called this watcher. - */ - default void onDamageBlock(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockDamageEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity throws a trident. - * - * @param shooter The entity that threw the trident. - * @param trident The trident that was thrown. - * @param level The level of the enchantment found on the trident. - * @param event The event that called this watcher. - */ - default void onTridentLaunch(@NotNull final LivingEntity shooter, - @NotNull final Trident trident, - final int level, - @NotNull final ProjectileLaunchEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when a player blocks an attack with a shield. - * - * @param blocker The player that blocked the attack. - * @param attacker The attacker. - * @param level The level of the enchantment found on the shield. - * @param event The event that called this watcher. - */ - default void onDeflect(@NotNull final Player blocker, - @NotNull final LivingEntity attacker, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - // Empty default as enchantments only override required watchers. - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WatcherTriggers.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WatcherTriggers.java deleted file mode 100644 index 23fb981d..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WatcherTriggers.java +++ /dev/null @@ -1,733 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -import com.google.common.collect.Sets; -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.core.config.ConfigUpdater; -import com.willfp.eco.core.events.ArmorEquipEvent; -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.core.integrations.mcmmo.McmmoManager; -import com.willfp.eco.util.TridentUtils; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.AbstractArrow; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.entity.Trident; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockDamageEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -import java.text.DecimalFormat; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - -@SuppressWarnings("deprecation") -public class WatcherTriggers extends PluginDependent implements Listener { - /** - * For jump listeners. - */ - private static final Set PREVIOUS_PLAYERS_ON_GROUND = Sets.newHashSet(); - - /** - * For jump listeners. - */ - private static final DecimalFormat FORMAT = new DecimalFormat("0.00"); - - /** - * If watchers should be triggered against npcs. - */ - private static boolean allowOnNPC = false; - - /** - * Create new listener for watcher events. - * - * @param plugin The plugin to link the events to. - */ - public WatcherTriggers(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Update if allowed on npc. - */ - @ConfigUpdater - public static void update() { - allowOnNPC = EcoEnchantsPlugin.getInstance().getConfig().getBoolean("allow-on-npc"); - } - - /** - * Called when an entity shoots another entity with an arrow. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onArrowDamage(@NotNull final EntityDamageByEntityEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getDamager() instanceof Arrow)) { - return; - } - - if (!(event.getEntity() instanceof LivingEntity)) { - return; - } - - if (((Arrow) event.getDamager()).getShooter() == null) { - return; - } - - if (!(((Arrow) event.getDamager()).getShooter() instanceof LivingEntity)) { - return; - } - - LivingEntity attacker = (LivingEntity) ((Arrow) event.getDamager()).getShooter(); - Arrow arrow = (Arrow) event.getDamager(); - LivingEntity victim = (LivingEntity) event.getEntity(); - - if (!allowOnNPC) { - if (victim.hasMetadata("NPC")) { - return; - } - } - - if (attacker instanceof Player && !AntigriefManager.canInjure((Player) attacker, victim)) { - return; - } - - if (event.isCancelled()) { - return; - } - - EnchantChecks.getEnchantsOnArrow(arrow).forEach(((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(attacker.getWorld())) { - return; - } - - enchant.onArrowDamage(attacker, victim, arrow, level, event); - })); - } - - /** - * Called when an entity damages another entity with a trident throw. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onTridentDamage(@NotNull final EntityDamageByEntityEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getDamager() instanceof Trident)) { - return; - } - - if (!(((Trident) event.getDamager()).getShooter() instanceof LivingEntity)) { - return; - } - - if (((Trident) event.getDamager()).getShooter() == null) { - return; - } - - if (!(event.getEntity() instanceof LivingEntity)) { - return; - } - - if (event.isCancelled()) { - return; - } - - LivingEntity attacker = (LivingEntity) ((Trident) event.getDamager()).getShooter(); - Trident trident = (Trident) event.getDamager(); - ItemStack item = TridentUtils.getItemStack(trident); - - LivingEntity victim = (LivingEntity) event.getEntity(); - - if (!allowOnNPC) { - if (victim.hasMetadata("NPC")) { - return; - } - } - - if (attacker instanceof Player && !AntigriefManager.canInjure((Player) attacker, victim)) { - return; - } - - EnchantChecks.getEnchantsOnItem(item).forEach(((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(attacker.getWorld())) { - return; - } - - enchant.onTridentDamage(attacker, victim, trident, level, event); - })); - } - - /** - * Called when a player jumps. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onJump(@NotNull final PlayerMoveEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - Player player = event.getPlayer(); - if (player.getVelocity().getY() > 0) { - float jumpVelocity = 0.42f; - if (player.hasPotionEffect(PotionEffectType.JUMP)) { - jumpVelocity += ((float) player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() + 1) * 0.1F; - } - jumpVelocity = Float.parseFloat(FORMAT.format(jumpVelocity).replace(',', '.')); - if (event.getPlayer().getLocation().getBlock().getType() != Material.LADDER - && PREVIOUS_PLAYERS_ON_GROUND.contains(player.getUniqueId()) - && !player.isOnGround() - && Float.compare((float) player.getVelocity().getY(), jumpVelocity) == 0) { - EnchantChecks.getEnchantsOnArmor(player).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - enchant.onJump(player, level, event); - }); - } - } - if (player.isOnGround()) { - PREVIOUS_PLAYERS_ON_GROUND.add(player.getUniqueId()); - } else { - PREVIOUS_PLAYERS_ON_GROUND.remove(player.getUniqueId()); - } - } - - /** - * Called when an entity attacks another entity with a melee attack. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onMeleeAttack(@NotNull final EntityDamageByEntityEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getDamager() instanceof LivingEntity)) { - return; - } - - if (!(event.getEntity() instanceof LivingEntity)) { - return; - } - - if (event.isCancelled()) { - return; - } - - if (event.getCause() == EntityDamageEvent.DamageCause.THORNS) { - return; - } - - LivingEntity attacker = (LivingEntity) event.getDamager(); - LivingEntity victim = (LivingEntity) event.getEntity(); - - if (!allowOnNPC) { - if (victim.hasMetadata("NPC")) { - return; - } - } - - if (attacker instanceof Player && !AntigriefManager.canInjure((Player) attacker, victim)) { - return; - } - - EnchantChecks.getEnchantsOnMainhand(attacker).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(attacker.getWorld())) { - return; - } - - enchant.onMeleeAttack(attacker, victim, level, event); - }); - } - - /** - * Called when an entity shoots a bow. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onBowShoot(@NotNull final EntityShootBowEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (event.getProjectile().getType() != EntityType.ARROW) { - return; - } - - LivingEntity shooter = event.getEntity(); - Arrow arrow = (Arrow) event.getProjectile(); - - EnchantChecks.getEnchantsOnMainhand(shooter).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(shooter.getWorld())) { - return; - } - - enchant.onBowShoot(shooter, arrow, level, event); - }); - } - - /** - * Called when an entity launches a projectile. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onProjectileLaunch(@NotNull final ProjectileLaunchEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getEntity() instanceof AbstractArrow)) { - return; - } - - if (!(event.getEntity().getShooter() instanceof Player)) { - return; - } - - LivingEntity shooter = (LivingEntity) event.getEntity().getShooter(); - - Projectile projectile = event.getEntity(); - - if (shooter.getEquipment() == null) { - return; - } - - ItemStack item = shooter.getEquipment().getItemInMainHand(); - - if (projectile instanceof Trident) { - item = TridentUtils.getItemStack((Trident) projectile); - } - - EnchantChecks.getEnchantsOnItem(item).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(shooter.getWorld())) { - return; - } - - enchant.onProjectileLaunch(shooter, projectile, level, event); - }); - } - - /** - * Called when an entity takes fall damage. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onFallDamage(@NotNull final EntityDamageEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) { - return; - } - - if (!(event.getEntity() instanceof LivingEntity)) { - return; - } - - LivingEntity victim = (LivingEntity) event.getEntity(); - - EnchantChecks.getEnchantsOnArmor(victim).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(victim.getWorld())) { - return; - } - - enchant.onFallDamage(victim, level, event); - }); - } - - /** - * Called when an arrow hits a block or entity. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onArrowHit(@NotNull final ProjectileHitEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getEntity().getShooter() instanceof LivingEntity)) { - return; - } - - if (!(event.getEntity() instanceof Arrow)) { - return; - } - - if (event.getEntity().getShooter() == null) { - return; - } - - Arrow arrow = (Arrow) event.getEntity(); - LivingEntity shooter = (LivingEntity) event.getEntity().getShooter(); - - EnchantChecks.getEnchantsOnArrow(arrow).forEach(((enchant, level) -> { - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(shooter.getWorld())) { - return; - } - - enchant.onArrowHit(shooter, level, event); - })); - } - - /** - * Called when a trident hits a block or entity. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onTridentHit(@NotNull final ProjectileHitEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getEntity().getShooter() instanceof LivingEntity)) { - return; - } - - if (event.getEntity().getShooter() == null) { - return; - } - - if (!(event.getEntity() instanceof Trident)) { - return; - } - - Trident trident = (Trident) event.getEntity(); - ItemStack item = TridentUtils.getItemStack(trident); - LivingEntity shooter = (LivingEntity) event.getEntity().getShooter(); - - EnchantChecks.getEnchantsOnItem(item).forEach((enchant, level) -> { - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(shooter.getWorld())) { - return; - } - - enchant.onTridentHit(shooter, level, event); - }); - } - - /** - * Called when a player breaks a block. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onBlockBreak(@NotNull final BlockBreakEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - Player player = event.getPlayer(); - Block block = event.getBlock(); - - if (!AntigriefManager.canBreakBlock(player, block)) { - return; - } - - if (event.isCancelled()) { - return; - } - - EnchantChecks.getEnchantsOnMainhand(player).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - enchant.onBlockBreak(player, block, level, event); - }); - } - - /** - * Called when an entity takes damage wearing armor. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onDamageWearingArmor(@NotNull final EntityDamageEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getEntity() instanceof LivingEntity)) { - return; - } - - LivingEntity victim = (LivingEntity) event.getEntity(); - - EnchantChecks.getEnchantsOnArmor(victim).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(victim.getWorld())) { - return; - } - - enchant.onDamageWearingArmor(victim, level, event); - }); - } - - /** - * Called when an entity puts on or takes off armor with an enchantment. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onArmorEquip(@NotNull final ArmorEquipEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - Player player = event.getPlayer(); - - this.getPlugin().getScheduler().runLater(() -> EcoEnchants.values().forEach(enchant -> { - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - int level = EnchantChecks.getArmorPoints(player, enchant); - enchant.onArmorEquip(player, level, event); - }), 1); - } - - /** - * Called when a player damages a block. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onDamageBlock(@NotNull final BlockDamageEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - Player player = event.getPlayer(); - Block block = event.getBlock(); - - if (event.getBlock().getDrops(player.getInventory().getItemInMainHand()).isEmpty()) { - return; - } - - EnchantChecks.getEnchantsOnMainhand(player).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - enchant.onDamageBlock(player, block, level, event); - }); - } - - /** - * Called when an entity throws a trident. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onTridentLaunch(@NotNull final ProjectileLaunchEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getEntity() instanceof Trident)) { - return; - } - - if (!(event.getEntity().getShooter() instanceof LivingEntity)) { - return; - } - - Trident trident = (Trident) event.getEntity(); - LivingEntity shooter = (LivingEntity) trident.getShooter(); - ItemStack item = TridentUtils.getItemStack(trident); - - EnchantChecks.getEnchantsOnItem(item).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(shooter.getWorld())) { - return; - } - - enchant.onTridentLaunch(shooter, trident, level, event); - }); - } - - /** - * Called when a player blocks an attack with a shield. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onDeflect(@NotNull final EntityDamageByEntityEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getEntity() instanceof Player)) { - return; - } - - if (!(event.getDamager() instanceof LivingEntity)) { - return; - } - - Player blocker = (Player) event.getEntity(); - - LivingEntity attacker = (LivingEntity) event.getDamager(); - - if (!blocker.isBlocking()) { - return; - } - - if (!AntigriefManager.canInjure(blocker, attacker)) { - return; - } - - Map enchants = blocker.getInventory().getItemInMainHand().getType() == Material.SHIELD - ? EnchantChecks.getEnchantsOnMainhand(blocker) - : EnchantChecks.getEnchantsOnOffhand(blocker); - - enchants.forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(blocker.getWorld())) { - return; - } - - enchant.onDeflect(blocker, attacker, level, event); - }); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/EssentialsManager.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/EssentialsManager.java deleted file mode 100644 index 86d0c76c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/EssentialsManager.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.willfp.ecoenchants.integrations.essentials; - -import lombok.experimental.UtilityClass; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.Set; - -@UtilityClass -public class EssentialsManager { - /** - * All registered essentials integrations. - */ - private static final Set REGISTERED = new HashSet<>(); - - /** - * Register a new essentials integration. - * - * @param essentials The integration to register. - */ - public static void register(@NotNull final EssentialsWrapper essentials) { - REGISTERED.add(essentials); - } - - /** - * Register all {@link com.willfp.ecoenchants.enchantments.EcoEnchant}s with Essentials. - */ - public static void registerEnchantments() { - REGISTERED.forEach(EssentialsWrapper::registerAllEnchantments); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/EssentialsWrapper.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/EssentialsWrapper.java deleted file mode 100644 index 408f416f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/EssentialsWrapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.willfp.ecoenchants.integrations.essentials; - -import com.willfp.eco.core.integrations.Integration; - -public interface EssentialsWrapper extends Integration { - /** - * @see EssentialsManager#registerEnchantments(); - */ - void registerAllEnchantments(); -} - diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/plugins/IntegrationEssentials.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/plugins/IntegrationEssentials.java deleted file mode 100644 index 743dfb24..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/plugins/IntegrationEssentials.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.willfp.ecoenchants.integrations.essentials.plugins; - -import com.earth2me.essentials.Enchantments; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.integrations.essentials.EssentialsWrapper; -import org.apache.commons.lang.reflect.FieldUtils; -import org.bukkit.enchantments.Enchantment; - -import java.util.Map; - -@SuppressWarnings("unchecked") -public class IntegrationEssentials implements EssentialsWrapper { - @Override - public void registerAllEnchantments() { - try { - for (EcoEnchant enchantment : EcoEnchants.values()) { - ((Map) FieldUtils.readDeclaredStaticField(Enchantments.class, "ENCHANTMENTS", true)).put(enchantment.getKey().getKey(), enchantment); - ((Map) FieldUtils.readDeclaredStaticField(Enchantments.class, "ENCHANTMENTS", true)).put(enchantment.getPermissionName(), enchantment); - } - } catch (IllegalAccessException ignored) { - // Ignore reflective errors that won't happen. - } - } - - @Override - public String getPluginName() { - return "Essentials"; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/util/ProxyUtils.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/util/ProxyUtils.java deleted file mode 100644 index 9a75d687..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/util/ProxyUtils.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.willfp.ecoenchants.util; - -import com.willfp.eco.core.proxy.AbstractProxy; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.proxy.util.ProxyFactory; -import lombok.experimental.UtilityClass; -import org.jetbrains.annotations.NotNull; - -@UtilityClass -public class ProxyUtils { - /** - * Get the implementation of a specified proxy. - * - * @param proxyClass The proxy interface. - * @param The type of the proxy. - * @return The proxy implementation. - */ - public @NotNull T getProxy(@NotNull final Class proxyClass) { - return new ProxyFactory<>(EcoEnchantsPlugin.getInstance(), proxyClass).getProxy(); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/EcoSkillsPlugin.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/EcoSkillsPlugin.java new file mode 100644 index 00000000..73e444bc --- /dev/null +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/EcoSkillsPlugin.java @@ -0,0 +1,165 @@ +package com.willfp.ecoskills; + +import com.willfp.eco.core.AbstractPacketAdapter; +import com.willfp.eco.core.EcoPlugin; +import com.willfp.eco.core.command.AbstractCommand; +import com.willfp.eco.core.integrations.IntegrationLoader; +import com.willfp.ecoskills.command.CommandClasses; +import com.willfp.ecoskills.command.CommandEsreload; +import com.willfp.ecoskills.enchantments.EcoEnchants; +import com.willfp.ecoskills.enchantments.meta.EnchantmentRarity; +import com.willfp.ecoskills.enchantments.meta.EnchantmentTarget; +import com.willfp.ecoskills.enchantments.meta.EnchantmentType; +import com.willfp.ecoskills.enchantments.support.merging.anvil.AnvilListeners; +import com.willfp.ecoskills.enchantments.support.merging.grindstone.GrindstoneListeners; +import com.willfp.ecoskills.enchantments.support.obtaining.EnchantingListeners; +import com.willfp.ecoskills.enchantments.support.obtaining.LootPopulator; +import com.willfp.ecoskills.enchantments.support.obtaining.VillagerListeners; +import com.willfp.ecoskills.enchantments.util.ItemConversions; +import com.willfp.ecoskills.enchantments.util.WatcherTriggers; +import lombok.Getter; +import org.bukkit.Bukkit; +import org.bukkit.event.Listener; +import org.bukkit.generator.BlockPopulator; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +@SuppressWarnings("unused") +public class EcoSkillsPlugin extends EcoPlugin { + /** + * Instance of the plugin. + */ + @Getter + private static EcoSkillsPlugin instance; + + /** + * Internal constructor called by bukkit on plugin load. + */ + public EcoSkillsPlugin() { + super("EcoSkills", 79573, 7666, "com.willfp.ecoskills.proxy", "&3"); + instance = this; + } + + /** + * Code executed on plugin enable. + */ + @Override + public void enable() { + this.getExtensionLoader().loadExtensions(); + + if (this.getExtensionLoader().getLoadedExtensions().isEmpty()) { + this.getLogger().info("&cNo extensions found"); + } else { + this.getLogger().info("Extensions Loaded:"); + this.getExtensionLoader().getLoadedExtensions().forEach(extension -> this.getLogger().info("- " + extension.getName() + " v" + extension.getVersion())); + } + + this.getLogger().info(EcoEnchants.values().size() + " Enchantments Loaded"); + } + + /** + * Code executed on plugin disable. + */ + @Override + public void disable() { + Bukkit.getServer().getWorlds().forEach(world -> { + List populators = new ArrayList<>(world.getPopulators()); + populators.forEach((blockPopulator -> { + if (blockPopulator instanceof LootPopulator) { + world.getPopulators().remove(blockPopulator); + } + })); + }); + + this.getExtensionLoader().unloadExtensions(); + } + + /** + * Nothing is called on plugin load. + */ + @Override + public void load() { + // Nothing needs to be called on load + } + + /** + * Code executed on /ecoreload. + */ + @Override + public void onReload() { + // Nothing needs to be called on reload + } + + /** + * Code executed after server is up. + */ + @Override + public void postLoad() { + // Nothing needs to be called post-loads + } + + /** + * EcoEnchants-specific integrations. + * + * @return A list of all integrations. + */ + @Override + public List getIntegrationLoaders() { + return Arrays.asList( + + ); + } + + /** + * EcoEnchants-specific commands. + * + * @return A list of all commands. + */ + @Override + public List getCommands() { + return Arrays.asList( + new CommandClasses(this), + new CommandEsreload(this) + ); + } + + /** + * Packet Adapters for enchant display. + * + * @return A list of packet adapters. + */ + @Override + public List getPacketAdapters() { + return new ArrayList<>(); + } + + /** + * EcoEnchants-specific listeners. + * + * @return A list of all listeners. + */ + @Override + public List getListeners() { + return Arrays.asList( + new EnchantingListeners(this), + new GrindstoneListeners(this), + new AnvilListeners(this), + new WatcherTriggers(this), + new VillagerListeners(this), + new ItemConversions(this) + ); + } + + @Override + public List> getUpdatableClasses() { + return Arrays.asList( + EnchantmentRarity.class, + EnchantmentTarget.class, + EcoEnchants.class, + EnchantmentType.class, + WatcherTriggers.class + ); + } +} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/classes/ClassesMenu.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/classes/ClassesMenu.java new file mode 100644 index 00000000..8ea774ba --- /dev/null +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/classes/ClassesMenu.java @@ -0,0 +1,36 @@ +package com.willfp.ecoskills.classes; + +import com.willfp.eco.core.gui.menu.Menu; +import lombok.Getter; +import lombok.experimental.UtilityClass; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.jetbrains.annotations.NotNull; + +@UtilityClass +public class ClassesMenu { + /** + * The classes menu. + */ + @Getter + private static Menu menu; + + /** + * Set the menu for /classes. + * + * @param menu The menu. + */ + public void setMenu(@NotNull final Menu menu) { + ClassesMenu.menu = menu; + } + + /** + * Show the menu to a player. + * + * @param player The player. + * @return The inventory. + */ + public Inventory showMenu(@NotNull final Player player) { + return menu.open(player); + } +} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/classes/SkillClass.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/classes/SkillClass.java new file mode 100644 index 00000000..c23f2ad1 --- /dev/null +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/classes/SkillClass.java @@ -0,0 +1,67 @@ +package com.willfp.ecoskills.classes; + +import com.willfp.eco.util.StringUtils; +import com.willfp.ecoskills.config.ClassConfig; +import com.willfp.ecoskills.enchantments.EcoEnchants; +import com.willfp.ecoskills.enchantments.util.EnchantmentUtils; +import lombok.Getter; +import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.jetbrains.annotations.NotNull; + +import java.util.List; +import java.util.stream.Collectors; + +public abstract class SkillClass { + /** + * The name of the class. + */ + @Getter + private final String name; + + /** + * The config for the skill class. + */ + @Getter + private final ClassConfig config; + + protected SkillClass(@NotNull final String name) { + this.name = name; + this.config = new ClassConfig(name, this.getClass()); + + this.update(); + + SkillClasses.addNewSkillClass(this); + } + + public void update() { + config.update(); + config.loadFromLang(); + rarity = config.getRarity(); + Validate.notNull(rarity, "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); + name = StringUtils.translate(config.getString("name")); + description = StringUtils.translate(config.getString("description")); + disabledWorldNames.clear(); + disabledWorldNames.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "disabled-in-worlds")); + disabledWorlds.clear(); + List worldNames = Bukkit.getWorlds().stream().map(World::getName).map(String::toLowerCase).collect(Collectors.toList()); + List disabledExistingWorldNames = disabledWorldNames.stream().filter(s -> worldNames.contains(s.toLowerCase())).collect(Collectors.toList()); + disabledWorlds.addAll(Bukkit.getWorlds().stream().filter(world -> disabledExistingWorldNames.contains(world.getName().toLowerCase())).collect(Collectors.toList())); + targets.clear(); + targetMaterials.clear(); + targets.addAll(config.getTargets()); + targets.forEach(enchantmentTarget -> targetMaterials.addAll(enchantmentTarget.getMaterials())); + enabled = config.getBool("enabled"); + EnchantmentUtils.registerPlaceholders(this); + + postUpdate(); + this.register(); + } +} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/classes/SkillClasses.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/classes/SkillClasses.java new file mode 100644 index 00000000..23570766 --- /dev/null +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/classes/SkillClasses.java @@ -0,0 +1,49 @@ +package com.willfp.ecoskills.classes; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.ImmutableList; +import com.willfp.eco.core.config.ConfigUpdater; +import lombok.experimental.UtilityClass; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +@UtilityClass +public class SkillClasses { + /** + * All registered skill classes. + */ + private static final BiMap BY_NAME = HashBiMap.create(); + + /** + * Get all registered {@link SkillClass}es. + * + * @return A list of all {@link SkillClass}es. + */ + public static List values() { + return ImmutableList.copyOf(BY_NAME.values()); + } + + /** + * Update the skill classes. + */ + @ConfigUpdater + public static void update() { + for (SkillClass skillClass : values()) { + skillClass.update(); + } + } + + /** + * Add new {@link SkillClass} to EcoSkills. + *

+ * Only for internal use, skill classes are automatically added in the constructor. + * + * @param skillClass The {@link SkillClass} to add. + */ + public static void addNewSkillClass(@NotNull final SkillClass skillClass) { + BY_NAME.inverse().remove(skillClass); + BY_NAME.put(skillClass.getName(), skillClass); + } +} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/command/CommandClasses.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/command/CommandClasses.java new file mode 100644 index 00000000..218ceabb --- /dev/null +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/command/CommandClasses.java @@ -0,0 +1,25 @@ +package com.willfp.ecoskills.command; + +import com.willfp.eco.core.EcoPlugin; +import com.willfp.eco.core.command.AbstractCommand; +import org.bukkit.command.CommandSender; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +public class CommandClasses extends AbstractCommand { + /** + * Instantiate a new /ecodebug command handler. + * + * @param plugin The plugin for the commands to listen for. + */ + public CommandClasses(@NotNull final EcoPlugin plugin) { + super(plugin, "classes", "ecoskills.classes", true); + } + + @Override + public void onExecute(@NotNull final CommandSender sender, + @NotNull final List args) { + + } +} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEcoreload.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/command/CommandEsreload.java similarity index 66% rename from eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEcoreload.java rename to eco-core/core-plugin/src/main/java/com/willfp/ecoskills/command/CommandEsreload.java index 42705f5a..6ef005e0 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEcoreload.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/command/CommandEsreload.java @@ -1,4 +1,4 @@ -package com.willfp.ecoenchants.command.commands; +package com.willfp.ecoskills.command; import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.command.AbstractCommand; @@ -7,14 +7,14 @@ import org.jetbrains.annotations.NotNull; import java.util.List; -public class CommandEcoreload extends AbstractCommand { +public class CommandEsreload extends AbstractCommand { /** - * Instantiate a new /ecoreload command handler. + * Instantiate a new /esreload command handler. * * @param plugin The plugin for the commands to listen for. */ - public CommandEcoreload(@NotNull final EcoPlugin plugin) { - super(plugin, "ecoreload", "ecoenchants.reload", false); + public CommandEsreload(@NotNull final EcoPlugin plugin) { + super(plugin, "esreload", "ecoskills.reload", false); } @Override diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/config/ClassConfig.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/config/ClassConfig.java new file mode 100644 index 00000000..d0e63efc --- /dev/null +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/config/ClassConfig.java @@ -0,0 +1,18 @@ +package com.willfp.ecoskills.config; + +import com.willfp.eco.core.config.ExtendableConfig; +import com.willfp.ecoskills.EcoSkillsPlugin; +import org.jetbrains.annotations.NotNull; + +public class ClassConfig extends ExtendableConfig { + /** + * Instantiate a new config for a skill class. + * + * @param name The name of the config. + * @param plugin The provider of the skill class. + */ + public ClassConfig(@NotNull final String name, + @NotNull final Class plugin) { + super(name, true, EcoSkillsPlugin.getInstance(), plugin, "classes/"); + } +} diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/angerartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/angerartifact.yml deleted file mode 100644 index f68c0f30..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/angerartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Anger Artifact EcoEnchant -# - -name: "Anger Artifact" -description: Creates angry villager particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/ashartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/ashartifact.yml deleted file mode 100644 index d3251e3c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/ashartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Ash Artifact EcoEnchant -# - -name: "Ash Artifact" -description: Creates basalt deltas particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/barrierartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/barrierartifact.yml deleted file mode 100644 index da4458d8..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/barrierartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Barrier Artifact EcoEnchant -# - -name: "Barrier Artifact" -description: Creates barrier particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/cloudsartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/cloudsartifact.yml deleted file mode 100644 index 332d2ed9..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/cloudsartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Clouds Artifact EcoEnchant -# - -name: "Clouds Artifact" -description: Creates cloud particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/crimsonartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/crimsonartifact.yml deleted file mode 100644 index cac281d0..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/crimsonartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Crimson Artifact EcoEnchant -# - -name: "Crimson Artifact" -description: Creates crimson forest particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/damageartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/damageartifact.yml deleted file mode 100644 index c5d40bcc..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/damageartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Damage Artifact EcoEnchant -# - -name: "Damage Artifact" -description: Creates damage particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/dragonartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/dragonartifact.yml deleted file mode 100644 index e31eb21d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/dragonartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Dragon Artifact EcoEnchant -# - -name: "Dragon Artifact" -description: Creates dragon breath particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/dustartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/dustartifact.yml deleted file mode 100644 index b2360be4..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/dustartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Dust Artifact EcoEnchant -# - -name: "Dust Artifact" -description: Creates dust particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/emeraldartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/emeraldartifact.yml deleted file mode 100644 index 1697c0da..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/emeraldartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Emerald Artifact EcoEnchant -# - -name: "Emerald Artifact" -description: Creates emerald particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/enchantmentartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/enchantmentartifact.yml deleted file mode 100644 index 471ccc38..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/enchantmentartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Enchantment Artifact EcoEnchant -# - -name: "Enchantment Artifact" -description: Creates enchantment particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/endartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/endartifact.yml deleted file mode 100644 index c90841cb..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/endartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# End Artifact EcoEnchant -# - -name: "End Artifact" -description: Creates end rod particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/fireartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/fireartifact.yml deleted file mode 100644 index d3abef5e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/fireartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Fire Artifact EcoEnchant -# - -name: "Fire Artifact" -description: Creates fire particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/heartartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/heartartifact.yml deleted file mode 100644 index 90c7c890..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/heartartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Heart Artifact EcoEnchant -# - -name: "Heart Artifact" -description: Creates heart particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/honeyartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/honeyartifact.yml deleted file mode 100644 index 553ae409..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/honeyartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Honey Artifact EcoEnchant -# - -name: "Honey Artifact" -description: Creates dripping honey particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false| - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/inkartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/inkartifact.yml deleted file mode 100644 index db710d00..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/inkartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Ink Artifact EcoEnchant -# - -name: "Ink Artifact" -description: Creates ink particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/lavaartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/lavaartifact.yml deleted file mode 100644 index fcc191ab..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/lavaartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Lava Artifact EcoEnchant -# - -name: "Lava Artifact" -description: Creates dripping lava particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/limeartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/limeartifact.yml deleted file mode 100644 index f89bba07..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/limeartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Lime Artifact EcoEnchant -# - -name: "Lime Artifact" -description: Creates lime particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/magicartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/magicartifact.yml deleted file mode 100644 index a485d8ad..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/magicartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Magic Artifact EcoEnchant -# - -name: "Magic Artifact" -description: Creates magic particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/magmaartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/magmaartifact.yml deleted file mode 100644 index 271f3f10..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/magmaartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Magma Artifact EcoEnchant -# - -name: "Magma Artifact" -description: Creates lava pop particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/musicartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/musicartifact.yml deleted file mode 100644 index 0a40c4a3..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/musicartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Music Artifact EcoEnchant -# - -name: "Music Artifact" -description: Creates note particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/nautilusartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/nautilusartifact.yml deleted file mode 100644 index fff37780..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/nautilusartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Nautilus Artifact EcoEnchant -# - -name: "Nautilus Artifact" -description: Creates nautilus particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/netherartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/netherartifact.yml deleted file mode 100644 index 1fd83497..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/netherartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Nether Artifact EcoEnchant -# - -name: "Nether Artifact" -description: Creates nether portal particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/redstoneartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/redstoneartifact.yml deleted file mode 100644 index b291f23d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/redstoneartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Redstone Artifact EcoEnchant -# - -name: "Redstone Artifact" -description: Creates redstone particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/smokeartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/smokeartifact.yml deleted file mode 100644 index 72311870..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/smokeartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Smoke Artifact EcoEnchant -# - -name: "Smoke Artifact" -description: Creates smoke particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/snowartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/snowartifact.yml deleted file mode 100644 index 80ea3749..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/snowartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Snow Artifact EcoEnchant -# - -name: "Snow Artifact" -description: Creates snow particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/soulartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/soulartifact.yml deleted file mode 100644 index 59c0249a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/soulartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Soul Artifact EcoEnchant -# - -name: "Soul Artifact" -description: Creates soul particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/soulfireartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/soulfireartifact.yml deleted file mode 100644 index 686548ef..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/soulfireartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Soul Fire Artifact EcoEnchant -# - -name: "Soul Fire Artifact" -description: Creates soul flame particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/sparkleartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/sparkleartifact.yml deleted file mode 100644 index 714331cc..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/sparkleartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Sparkle Artifact EcoEnchant -# - -name: "Sparkle Artifact" -description: Creates firework particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/sweepartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/sweepartifact.yml deleted file mode 100644 index 83bb4377..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/sweepartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Sweep Artifact EcoEnchant -# - -name: "Sweep Artifact" -description: Creates sweep attack particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/tearartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/tearartifact.yml deleted file mode 100644 index f3e768eb..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/tearartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Tear Artifact EcoEnchant -# - -name: "Tear Artifact" -description: Creates crying obsidian particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/totemartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/totemartifact.yml deleted file mode 100644 index 5c345b5b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/totemartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Totem Artifact EcoEnchant -# - -name: "Totem Artifact" -description: Creates totem particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/villagerartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/villagerartifact.yml deleted file mode 100644 index 1acbbaee..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/villagerartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Villager Artifact EcoEnchant -# - -name: "Villager Artifact" -description: Creates happy villager particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/warpedartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/warpedartifact.yml deleted file mode 100644 index 5e0ccc02..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/warpedartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Warped Artifact EcoEnchant -# - -name: "Warped Artifact" -description: Creates warped forest particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/waterartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/waterartifact.yml deleted file mode 100644 index 5189ac95..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/waterartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Water Artifact EcoEnchant -# - -name: "Water Artifact" -description: Creates dripping water particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/witchartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/witchartifact.yml deleted file mode 100644 index 281075d2..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/witchartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Witch Artifact EcoEnchant -# - -name: "Witch Artifact" -description: Creates witch particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/zapartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/zapartifact.yml deleted file mode 100644 index 0d615399..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/zapartifact.yml +++ /dev/null @@ -1,47 +0,0 @@ -# -# Zap Artifact EcoEnchant -# - -name: "Zap Artifact" -description: Creates electric particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/breaklessnesscurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/breaklessnesscurse.yml deleted file mode 100644 index 6c4d1e25..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/breaklessnesscurse.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Curse of Breaklessness EcoEnchant -# - -name: "Curse of Breaklessness" -description: Chance to prevent block breaking. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - pickaxe - - axe - - hoe - - shovel - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - chance-per-level: 15 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/callingcurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/callingcurse.yml deleted file mode 100644 index 7fe81ebe..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/callingcurse.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Curse of Calling EcoEnchant -# - -name: "Curse of Calling" -description: Angers all nearby mobs. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: false - disabled-in-worlds: [ ] - conflicts: - - mending - -config: - repeat-ticks: 20 # How often (in ticks) to call entities - distance: 20 # Entity Range \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/decaycurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/decaycurse.yml deleted file mode 100644 index 5104268f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/decaycurse.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Curse of Decay EcoEnchant -# - -name: "Curse of Decay" -description: Automatically damages items when not held. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - all - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - mending - - repairing - -config: - repeat-ticks: 100 # How often (in ticks) to repair items - multiplier: 1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/fragilitycurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/fragilitycurse.yml deleted file mode 100644 index e0620d42..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/fragilitycurse.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Curse of Fragility EcoEnchant -# - -name: "Curse of Fragility" -description: Decreases item durability. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - all - grindstoneable: false - disabled-in-worlds: [ ] - conflicts: - - unbreaking - -config: - minimum-extra-durability: 2 #minimum extra durability lost on each usage - maximum-extra-durability: 8 #maximum extra durability lost on each usage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/harmlessnesscurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/harmlessnesscurse.yml deleted file mode 100644 index a36ba689..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/harmlessnesscurse.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Curse of Harmlessness EcoEnchant -# - -name: "Curse of Harmlessness" -description: Chance for attacks to do nothing. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - sword - - axe - grindstoneable: false - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - chance-per-level: 15 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/hungercurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/hungercurse.yml deleted file mode 100644 index 29367678..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/hungercurse.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Curse of Hunger EcoEnchant -# - -name: "Curse of Hunger" -description: Increases hunger loss. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - helmet - grindstoneable: false - disabled-in-worlds: [ ] - conflicts: - - sating - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/inaccuracycurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/inaccuracycurse.yml deleted file mode 100644 index 83970eef..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/inaccuracycurse.yml +++ /dev/null @@ -1,23 +0,0 @@ -# -# Curse of Inaccuracy EcoEnchant -# - -name: "Curse of Inaccuracy" -description: Arrows fire incorrectly. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - spread: 0.2 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/misfortunecurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/misfortunecurse.yml deleted file mode 100644 index bb318b5b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/misfortunecurse.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Curse of Misfortune EcoEnchant -# - -name: "Curse of Misfortune" -description: Chance for blocks to not drop items. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - pickaxe - - axe - - hoe - - shovel - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - fortune - -config: - chance-per-level: 15 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/permanencecurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/permanencecurse.yml deleted file mode 100644 index 7037820c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/permanencecurse.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Curse of Permanence EcoEnchant -# - -name: "Curse of Permanence" -description: Prevents item from being modified in an anvil. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - all - grindstoneable: false - disabled-in-worlds: [ ] - conflicts: - - mending - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/abattoir.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/abattoir.yml deleted file mode 100644 index 27731089..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/abattoir.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Abattoir EcoEnchant -# - -name: "Abattoir" -description: Increases damage against passive mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - trident - grindstoneable: true - conflicts: - - serrated - - bladed - - phantasm - - pacify - - arachnid - - impaling - maximum-level: 5 - disabled-in-worlds: [ ] - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/abrasion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/abrasion.yml deleted file mode 100644 index 0c365c9b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/abrasion.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Abrasion EcoEnchant -# - -name: "Abrasion" -description: Damages your opponents armor. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - allow-not-fully-charged: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/aerial.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/aerial.yml deleted file mode 100644 index 8f41807a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/aerial.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Aerial EcoEnchant -# - -name: "Aerial" -description: Increases arrow damage when shot while in air. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - multiplier: 0.06 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/aquatic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/aquatic.yml deleted file mode 100644 index 3a150662..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/aquatic.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Aquatic EcoEnchant -# - -name: "Aquatic" -description: Trident deals additional damage when shot from water. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 8 - -config: - multiplier: 0.05 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/arachnid.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/arachnid.yml deleted file mode 100644 index 53abe9b5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/arachnid.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Arachnid EcoEnchant -# - -name: "Arachnid" -description: Increases damage against spiders. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - serrated - - bladed - - phantasm - - pacify - - abattoir - - impaling - maximum-level: 5 - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/arborist.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/arborist.yml deleted file mode 100644 index abfb1806..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/arborist.yml +++ /dev/null @@ -1,35 +0,0 @@ -# -# Arborist EcoEnchant -# - -name: "Arborist" -description: Get more sticks, apples, and saplings from leaves. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - axe - - shears - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - silk_touch - maximum-level: 4 - -config: - items: - - stick - - apple - - acacia_sapling - - birch_sapling - - dark_oak_sapling - - jungle_sapling - - oak_sapling - - spruce_sapling - chance-per-level: 3 # Chance to drop item. \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/arcanic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/arcanic.yml deleted file mode 100644 index 1d017ffa..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/arcanic.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Arcanic EcoEnchant -# - -name: "Arcanic" -description: Chance to ignore potion damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 2 #Chance of ignoring potion damage = Total points (16 points * 3 chance = 48% chance) \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/atmospheric.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/atmospheric.yml deleted file mode 100644 index 9d510829..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/atmospheric.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Atmospheric EcoEnchant -# - -name: "Atmospheric" -description: Increases trident damage when you are in air. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - multiplier: 0.06 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/aversion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/aversion.yml deleted file mode 100644 index 8e27083d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/aversion.yml +++ /dev/null @@ -1,23 +0,0 @@ -# -# Aversion EcoEnchant -# - -name: "Aversion" -description: Prevents angering endermen by looking at them. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: -# No config is available for this enchantment. diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/backstab.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/backstab.yml deleted file mode 100644 index 582fad9c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/backstab.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Backstab EcoEnchant -# - -name: "Backstab" -description: Increases damage when behind opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - multiplier: 0.1 # 1 + (Level * Multiplier) is multiplied with the damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/beheading.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/beheading.yml deleted file mode 100644 index e23250fb..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/beheading.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Beheading EcoEnchant -# - -name: "Beheading" -description: Chance of getting player or mob head. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 10 #chance of dropping skull per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/blastmining.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/blastmining.yml deleted file mode 100644 index 088efcad..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/blastmining.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Blast Mining EcoEnchant -# - -name: "Blast Mining" -description: Mines blocks in a 3x3 area. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - drill - - vein - maximum-level: 1 - -config: - chance-per-level: 100 - disable-on-sneak: true - enable-sound: true # Play explosion sound - hardness-check: true # Only break blocks with hardness less than or equal to first block - blacklisted-blocks: - - bedrock \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/bleed.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/bleed.yml deleted file mode 100644 index e0172999..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/bleed.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Bleed EcoEnchant -# - -name: "Bleed" -description: Causes your opponent to bleed, damaging them repeatedly. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 7 - -config: - chance-per-level: 1.5 #chance of bleeding per level - allow-not-fully-charged: false #dont require sword attack to be at full charge - bleed-damage: 1 - amount-per-level: 1 # Bleed number per level diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/blind.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/blind.yml deleted file mode 100644 index 9bdf47ea..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/blind.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Blind EcoEnchant -# - -name: "Blind" -description: Chance of blinding your opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 1 #as percentage - duration-per-level: 15 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/blockbreather.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/blockbreather.yml deleted file mode 100644 index 8b2b023f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/blockbreather.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Block Breather EcoEnchant -# - -name: "Block Breather" -description: Chance to ignore suffocation damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 15 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/bosshunter.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/bosshunter.yml deleted file mode 100644 index 59c7fa31..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/bosshunter.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Boss Hunter EcoEnchant -# - -name: "Boss Hunter" -description: Increases damage against bosses. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 8 - -config: - multiplier: 0.1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/buckshot.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/buckshot.yml deleted file mode 100644 index 0047b9e3..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/buckshot.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Buckshot EcoEnchant -# - -name: "Buckshot" -description: Shoots multiple arrows spread out. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - succession - - pentashot - - tripleshot - maximum-level: 2 - -config: - amount-per-level: 3 # Arrows to shoot per level - spread-per-level: 0.2 # Spread randomness per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/butchering.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/butchering.yml deleted file mode 100644 index 65a5e780..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/butchering.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Butchering EcoEnchant -# - -name: "Butchering" -description: Increases damage against passive mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - sharpness - - bane_of_arthropods - - smite - - defusion - - razor - - ender_slayer - maximum-level: 5 - -config: - bonus-per-level: 2.5 # Damage to creepers = base damage + (level * bonus), eg Defusion 5 will do 12.5 more damage to creepers \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/cerebral.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/cerebral.yml deleted file mode 100644 index 283646d3..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/cerebral.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Cerebral EcoEnchant -# - -name: "Cerebral" -description: Increases damage on headshots. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 8 - -config: - multiplier: 0.03 # Damage = level * multiplier + 1. Headshot with Cerebral 5 = 5 * 0.05 + 1 = 1.25x damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/chopless.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/chopless.yml deleted file mode 100644 index 39201c2c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/chopless.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Chopless EcoEnchant -# - -name: "Chopless" -description: Reduces damage dealt by axes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - percent-less-per-level: 0.8 # Points * Percent less / 100 * damage = damage taken \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/cleave.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/cleave.yml deleted file mode 100644 index a32ab524..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/cleave.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Cleave EcoEnchant -# - -name: "Cleave" -description: Damage all entities around attacked entity. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - carve - maximum-level: 8 - -config: - damage-percentage-per-level: 2.5 - radius-per-level: 0.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/collateral.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/collateral.yml deleted file mode 100644 index 15a6639e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/collateral.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Collateral EcoEnchant -# - -name: "Collateral" -description: Arrows can go through entities. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 4 - -config: -# No config is available for this enchantment diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/conclude.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/conclude.yml deleted file mode 100644 index 0c5a2908..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/conclude.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Conclude EcoEnchant -# - -name: "Conclude" -description: Chance to instantly kill entities on low health. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 5 - -config: - minimum-health-per-level: 1 # Multiplied by level, eg: if 1, then Conclude 5 kills any mobs below 2.5 hearts - chance-per-level: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/corrosive.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/corrosive.yml deleted file mode 100644 index b1dedb0c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/corrosive.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Corrosive EcoEnchant -# - -name: "Corrosive" -description: Damages your opponents armor. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/cranial.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/cranial.yml deleted file mode 100644 index a5c346a1..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/cranial.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Cranial EcoEnchant -# - -name: "Cranial" -description: Increases damage on headshots. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 8 - -config: - multiplier: 0.03 # Damage = level * multiplier + 1. Headshot with Cranial 5 = 5 * 0.05 + 1 = 1.25x damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/criticals.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/criticals.yml deleted file mode 100644 index 02285036..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/criticals.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Criticals EcoEnchant -# - -name: "Criticals" -description: Increases critical damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - multiplier: 0.1 # 1 + (Level * Multiplier) is multiplied with the damage - use-additive: false # Multiply base damage rather than vanilla critical damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/cubism.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/cubism.yml deleted file mode 100644 index 44b8b6a7..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/cubism.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Cubism EcoEnchant -# - -name: "Cubism" -description: Increases damage dealt against slimes and magma cubes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 7 - -config: - multiplier: 0.035 # Damage = level * multiplier + 1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/defender.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/defender.yml deleted file mode 100644 index 301d549e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/defender.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Defender EcoEnchant -# - -name: "Defender" -description: Prevents damaging your own pets. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: -# No config available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/deflection.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/deflection.yml deleted file mode 100644 index 3e8b0be7..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/deflection.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Deflection EcoEnchant -# - -name: "Deflection" -description: Rebounds some incoming damage back to your attacker. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - targets: - - shield - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - percent-deflected-per-level: 5 # Percent of damage to deal to attacker per level (can go above 100) \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/defusion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/defusion.yml deleted file mode 100644 index 84b83730..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/defusion.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Defusion EcoEnchant -# - -name: "Defusion" -description: Increases damage against creepers. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - sharpness - - bane_of_arthropods - - smite - - butchering - - razor - - ender_slayer - - introversion - maximum-level: 5 - -config: - bonus-per-level: 2.5 # Damage to creepers = base damage + (level * bonus), eg Defusion 5 will do 12.5 more damage to creepers \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/dexterous.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/dexterous.yml deleted file mode 100644 index 866c951c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/dexterous.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Dexterous EcoEnchant -# - -name: "Dexterous" -description: Increases attack speed. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - add-speed-per-level: 0.2 #Bonus to attack speed, default 4.0 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/disable.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/disable.yml deleted file mode 100644 index 46ddaee6..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/disable.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Disable EcoEnchant -# - -name: "Disable" -description: Chance of giving your opponent extreme mining fatigue. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - allow-not-fully-charged: false - chance-per-level: 2 #as percentage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/disappear.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/disappear.yml deleted file mode 100644 index a4132b2f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/disappear.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Disappear EcoEnchant -# - -name: "Disappear" -description: Go invisble if damaged on low health. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - ticks-per-level: 2 - threshold: 5 # If health is below threshold after being damaged, go invisble diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/diurnal.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/diurnal.yml deleted file mode 100644 index a0e1bf37..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/diurnal.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Diurnal EcoEnchant -# - -name: "Diurnal" -description: Increases damage dealt at daytime. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - nocturnal - maximum-level: 6 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/diverse.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/diverse.yml deleted file mode 100644 index 90daec21..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/diverse.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Diverse EcoEnchant -# - -name: "Diverse" -description: Increases damage dealt against players holding swords. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - multiplier: 0.05 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/drill.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/drill.yml deleted file mode 100644 index ac97562d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/drill.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Drill EcoEnchant -# - -name: "Drill" -description: Mines blocks behind other blocks. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - pickaxe - - axe - - shovel - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - lumberjack - - blast_mining - - vein - maximum-level: 5 - -config: - blocks-per-level: 1 - disable-on-sneak: true - hardness-check: true # Only break blocks with hardness less than or equal to first block - blacklisted-blocks: - - bedrock \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/dullness.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/dullness.yml deleted file mode 100644 index f2161e5a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/dullness.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Dullness EcoEnchant -# - -name: "Dullness" -description: Chance of giving your opponent weakness. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - allow-not-fully-charged: false #require sword attack to be at full charge - chance-per-level: 2 - duration-per-level: 10 # 20 ticks is one second \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/dweller.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/dweller.yml deleted file mode 100644 index 9919b3ed..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/dweller.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Dweller EcoEnchant -# - -name: "Dweller" -description: Increases damage against illagers. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - multiplier: 0.2 # 1 + (Level * Multiplier) is multiplied with the damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/economical.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/economical.yml deleted file mode 100644 index 37639633..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/economical.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Economical EcoEnchant -# - -name: "Economical" -description: Chance to not consume fireworks while boosting. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - elytra - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 4 - -config: - chance-per-level: 20 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/electroshock.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/electroshock.yml deleted file mode 100644 index d8db781a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/electroshock.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Electroshock EcoEnchant -# - -name: "Electroshock" -description: Chance to strike lightning on your attacker. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - shield - grindstoneable: true - - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 5 - damage: 4 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/enderism.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/enderism.yml deleted file mode 100644 index 4ff452cb..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/enderism.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Enderism EcoEnchant -# - -name: "Enderism" -description: Increases damage dealt in the end. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - netheric - maximum-level: 6 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/enderslayer.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/enderslayer.yml deleted file mode 100644 index 250b15b7..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/enderslayer.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Ender Slayer EcoEnchant -# - -name: "Ender Slayer" -description: Increases damage against end mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - sharpness - - bane_of_arthropods - - smite - - defusion - - razor - - butchering - - introversion - maximum-level: 5 - -config: - bonus-per-level: 2.5 # Damage to creepers = base damage + (level * bonus), eg Defusion 5 will do 12.5 more damage to creepers \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/endinfusion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/endinfusion.yml deleted file mode 100644 index bb1ef03f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/endinfusion.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# End Infusion EcoEnchant -# - -name: "End Infusion" -description: Increases damage dealt in the end. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - nether_infusion - maximum-level: 6 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/evasion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/evasion.yml deleted file mode 100644 index 7c63fba8..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/evasion.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Evasion EcoEnchant -# - -name: "Evasion" -description: Chance to ignore incoming damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - # Each level of evasion on each piece of armor counts as a point, so if a player is wearing 4 pieces of armor all with Evasion 3, then that would be 12 points - chance-per-level: 0.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/extinguishing.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/extinguishing.yml deleted file mode 100644 index 2593d280..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/extinguishing.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Extinguishing EcoEnchant -# - -name: "Extinguishing" -description: Chance to remove fire when taking fire damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 4 #Chance of being extinguished = Total points (12 points * 4 chance = 48% chance) \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/extract.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/extract.yml deleted file mode 100644 index c66464dc..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/extract.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Extract EcoEnchant -# - -name: "Extract" -description: Heals a portion of damage dealt. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - health-per-level: 1 # Level * Health = Amount of health to heal diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/famine.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/famine.yml deleted file mode 100644 index 3a182d9e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/famine.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Famine EcoEnchant -# - -name: "Famine" -description: Chance of giving your opponent hunger. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 8 - -config: - allow-not-fully-charged: false - chance-per-level: 1.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/farmhand.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/farmhand.yml deleted file mode 100644 index 2f33f1ce..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/farmhand.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Farmhand EcoEnchant -# - -name: "Farmhand" -description: Till blocks around initial block. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - hoe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - initial-radius: 1 - per-level-radius: 1 - use-cube: true #If set to false, then it will use a square, and so will not go up/down edges - per-block-damage: true #If set to false, then it will only take 1 durability \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/fetching.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/fetching.yml deleted file mode 100644 index 1dd24189..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/fetching.yml +++ /dev/null @@ -1,23 +0,0 @@ -# -# Fetching EcoEnchant -# - -name: "Fetching" -description: Drops and xp from wolf kills go directly into your inventory. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - not-on-players: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/finality.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/finality.yml deleted file mode 100644 index 5963d31a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/finality.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Finality EcoEnchant -# - -name: "Finality" -description: Chance to instantly kill entities on low health. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 5 - -config: - minimum-health-per-level: 1 # Multiplied by level, eg: if 1, then Finality 5 kills any mobs below 2.5 hearts - chance-per-level: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/finishing.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/finishing.yml deleted file mode 100644 index 822ec502..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/finishing.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Finishing EcoEnchant -# - -name: "Finishing" -description: Chance to instantly kill entities on low health. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 5 - -config: - minimum-health-per-level: 1 # Multiplied by level, eg: if 1, then Finishing 5 kills any mobs below 2.5 hearts - chance-per-level: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/fireaffinity.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/fireaffinity.yml deleted file mode 100644 index b809bcc8..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/fireaffinity.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Fire Affinity EcoEnchant -# - -name: "Fire Affinity" -description: Increases damage dealt when on fire. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - water_affinity - maximum-level: 7 - -config: - multiplier: 0.05 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/firststrike.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/firststrike.yml deleted file mode 100644 index 363709a3..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/firststrike.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# First Strike EcoEnchant -# - -name: "First Strike" -description: Increases damage dealt when entity is on max health. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 5 - -config: - multiplier: 0.15 # 1 + (Level * Multiplier) is multiplied with the damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/flinch.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/flinch.yml deleted file mode 100644 index d85a5f3f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/flinch.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Flinch EcoEnchant -# - -name: "Flinch" -description: Chance to blind your attacker. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - shield - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 2.5 - ticks-per-level: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/forcefield.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/forcefield.yml deleted file mode 100644 index fc6b7e91..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/forcefield.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Forcefield EcoEnchant -# - -name: "Forcefield" -description: Damages all nearby monsters. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - initial-distance: 1.5 # Initial range - bonus-per-level: 0.3 # Bonus range per level (Level 1 also includes bonus) - damage-per-level: 0.5 - repeat-ticks: 20 # Damage nearby mobs every few ticks. Lower values lead to more damage and may cause lag \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/freerunner.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/freerunner.yml deleted file mode 100644 index d5c6d3ba..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/freerunner.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Freerunner EcoEnchant -# - -name: "Freerunner" -description: Chance to ignore fall damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/frozen.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/frozen.yml deleted file mode 100644 index 2f68a5b6..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/frozen.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Frozen EcoEnchant -# - -name: "Frozen" -description: Chance to give your attacker slowness. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 0.6 - points-per-level: 6 # Points of frozen required to increment slowness level by 1 diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/fury.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/fury.yml deleted file mode 100644 index 25e2ba66..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/fury.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Fury EcoEnchant -# - -name: "Fury" -description: Chance of angering nearby monsters towards your opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 7 - -config: - allow-not-fully-charged: false #require sword attack to be at full charge - chance-per-level: 2 - distance-per-level: 3 # Distance for mobs to check \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/goliath.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/goliath.yml deleted file mode 100644 index 6383cdc0..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/goliath.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Goliath EcoEnchant -# - -name: "Goliath" -description: Increases damage against entities with more health than you. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 8 - -config: - multiplier: 0.01 # If enemy has 200 health, and you have 20 w/ goliath 8 then your damage is multiplied by: ((200/10)*8*0.01) + 1 = 2.6 - multiplier-cap: 2.5 # Never deal more than x times more damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/graceful.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/graceful.yml deleted file mode 100644 index 1073de8d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/graceful.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Graceful EcoEnchant -# - -name: "Graceful" -description: Chance of getting slow falling just above hitting the ground. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 4 #chance of slow falling per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/grapple.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/grapple.yml deleted file mode 100644 index 24f5d02d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/grapple.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Grapple EcoEnchant -# - -name: "Grapple" -description: Pulls entities towards you. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - knockback - - tornado - - annihilate - maximum-level: 2 - -config: - velocity-multiplier: 0.75 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/greenthumb.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/greenthumb.yml deleted file mode 100644 index 2724bd4e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/greenthumb.yml +++ /dev/null @@ -1,23 +0,0 @@ -# -# Green Thumb EcoEnchant -# - -name: "Green Thumb" -description: Left clicking dirt turns it to grass. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - hoe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - damage: true # Damage hoe on use \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/grit.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/grit.yml deleted file mode 100644 index 76cbedb3..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/grit.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Grit EcoEnchant -# - -name: "Grit" -description: Damages your opponents weapon. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - damage-per-level: 0.3 # Damage * points (0.3 * 12 points = 3.6) Rounded up. diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/hellish.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/hellish.yml deleted file mode 100644 index e9ee63d7..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/hellish.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Hellish EcoEnchant -# - -name: "Hellish" -description: Increases damage dealt in the nether. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - void_affinity - maximum-level: 6 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/hook.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/hook.yml deleted file mode 100644 index 34b4af18..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/hook.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Hook EcoEnchant -# - -name: "Hook" -description: Pulls entities towards you. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - punch - maximum-level: 2 - -config: - velocity-multiplier: 0.75 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/horde.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/horde.yml deleted file mode 100644 index f314e356..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/horde.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Horde EcoEnchant -# - -name: "Horde" -description: Increases damage dealt the more mobs are nearby. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 4 - -config: - multiplier-per-level: 0.005 # Multiplier per mob per level (ie 10 mobs at level 4 will be 1.2x more powerful) - distance-per-level: 2.5 diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/iceshot.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/iceshot.yml deleted file mode 100644 index d9ad852b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/iceshot.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Ice Shot EcoEnchant -# - -name: "Ice Shot" -description: Chance of freezing your opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 3 #chance of slowness per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/identify.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/identify.yml deleted file mode 100644 index f534a6d8..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/identify.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Identify EcoEnchant -# - -name: "Identify" -description: Chance to give your attacker glowing. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - shield - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - chance-per-level: 10 - ticks-per-level: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/ignite.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/ignite.yml deleted file mode 100644 index c436bdef..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/ignite.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Ignite EcoEnchant -# - -name: "Ignite" -description: Chance to light hit block on fire. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 8 - -config: - chance-per-level: 12.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/illusionaspect.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/illusionaspect.yml deleted file mode 100644 index 9fd40969..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/illusionaspect.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Illusion Aspect EcoEnchant -# - -name: "Illusion Aspect" -description: Chance to blind and nauseate opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - chance-per-level: 3 #chance of illusioning opponent per level - allow-not-fully-charged: false #dont require sword attack to be at full charge \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/impact.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/impact.yml deleted file mode 100644 index 9dfbfab8..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/impact.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Impact EcoEnchant -# - -name: "Impact" -description: Small chance to deal extreme damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - damage-multiplier: 3 - chance-per-level: 0.5 # Chance to deal more (as percentage) \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/incandescence.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/incandescence.yml deleted file mode 100644 index faeac893..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/incandescence.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Incandescence EcoEnchant -# - -name: "Incandescence" -description: Light your attacker on fire. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - initial-ticks: 20 - ticks-per-point: 2 # Ticks victim will be alight for multiplied by each enchantment point, eg: All armor with incandescence 3 = 4*3 = 12 points. diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/infernaltouch.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/infernaltouch.yml deleted file mode 100644 index 180b023f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/infernaltouch.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Infernal Touch EcoEnchant -# - -name: "Infernal Touch" -description: Automatically smelt mined blocks. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - silk_touch - - stone_switcher - -config: - drop-xp: true # If experience should be given \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/inferno.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/inferno.yml deleted file mode 100644 index 4954e079..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/inferno.yml +++ /dev/null @@ -1,23 +0,0 @@ -# -# Infernal EcoEnchant -# - -name: "Inferno" -description: Flaming tridents. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: -# No config available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/infuriate.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/infuriate.yml deleted file mode 100644 index 82cab5f8..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/infuriate.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Infuriate EcoEnchant -# - -name: "Infuriate" -description: Chance to cause nearby mobs to attack your opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - shield - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 7 - -config: - chance-per-level: 2 - distance-per-level: 2 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/insecticide.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/insecticide.yml deleted file mode 100644 index 508fa4a5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/insecticide.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Insecticide EcoEnchant -# - -name: "Insecticide" -description: Increases damage against spiders. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - power - - force - - revenant - - slaughter - - settle - maximum-level: 5 - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/instantaneous.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/instantaneous.yml deleted file mode 100644 index a93d2af7..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/instantaneous.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Instantaneous EcoEnchant -# - -name: "Instantaneous" -description: Chance of instantly breaking blocks. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - pickaxe - - axe - - shovel - - hoe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 7 - -config: - chance-per-level: 3 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/introversion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/introversion.yml deleted file mode 100644 index d278438c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/introversion.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Introversion EcoEnchant -# - -name: "Introversion" -description: Increases damage against players. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - sharpness - - bane_of_arthropods - - smite - - defusion - - razor - - ender_slayer - - butchering - maximum-level: 5 - -config: - bonus-per-level: 2.5 # Damage to players = base damage + (level * bonus), eg Introversion 5 will do 12.5 more damage to players \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/invigoration.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/invigoration.yml deleted file mode 100644 index a3c0fef5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/invigoration.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Invigoration EcoEnchant -# - -name: "Invigoration" -description: Increases outgoing damage and reduces incoming damage when low on health. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - # Each level of invigoration on each piece of armor counts as a point, so if a player is wearing 4 pieces of armor all with Invigoration 3, then that would be 12 points - reduction-multiplier: 5 # In percent, so default is take 5% less damage per point - damage-multiplier: 2.5 # In percent, so default is deal 5% more damage per point - below-health: 5 # Activates below specified health \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/kinetic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/kinetic.yml deleted file mode 100644 index 781f42ec..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/kinetic.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Kinetic EcoEnchant -# - -name: "Kinetic" -description: Reduces damage taken when flying into a wall. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - elytra - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - reduction-per-level: 15 #Percent less damage taken per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/launch.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/launch.yml deleted file mode 100644 index db2cc3ef..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/launch.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Launch EcoEnchant -# - -name: "Launch" -description: Fireworks give a short burst of extreme speed. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - elytra - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 8 - -config: - multiplier: 0.3 # Velocity multiplier per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/leeching.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/leeching.yml deleted file mode 100644 index e18a25c9..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/leeching.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Leeching EcoEnchant -# - -name: "Leeching" -description: Heals a portion of damage dealt. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - life_steal - maximum-level: 3 - -config: - health-per-level: 1 # Level * Health = Amount of health to heal - allow-not-fully-charged: false diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/lesion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/lesion.yml deleted file mode 100644 index 269eeabd..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/lesion.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Lesion EcoEnchant -# - -name: "Lesion" -description: Causes your opponent to bleed, damaging them repeatedly. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 7 - -config: - chance-per-level: 3 #chance of bleeding per level - bleed-damage: 1 - amount-per-level: 1 # Bleed number per level diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/levitate.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/levitate.yml deleted file mode 100644 index 44c48b6e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/levitate.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Levitate EcoEnchant -# - -name: "Levitate" -description: Chance of applying levitation to your opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - chance-per-level: 3 #chance of levitation per level - duration-per-level: 30 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/liquidshot.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/liquidshot.yml deleted file mode 100644 index 424a1d3e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/liquidshot.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Liquid Shot EcoEnchant -# - -name: "Liquid Shot" -description: Increases damage against fiery mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 5 - -config: - multiplier: 0.05 # Damage = level * multiplier + 1. Damage on blaze/magma cube with Liquid Shot 5 = 5 * 0.05 + 1 = 1.25x damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/luckycatch.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/luckycatch.yml deleted file mode 100644 index 042dd946..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/luckycatch.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Lucky Catch EcoEnchant -# - -name: "Lucky Catch" -description: Chance to double fishing drops. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - rod - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 15 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/lumberjack.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/lumberjack.yml deleted file mode 100644 index 6b8e2157..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/lumberjack.yml +++ /dev/null @@ -1,41 +0,0 @@ -# -# Lumberjack EcoEnchant -# - -name: "Lumberjack" -description: Instantly cut down entire trees. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - axe - grindstoneable: true - disabled-in-worlds: [ ] - maximum-level: 6 - conflicts: - - drill - -config: - disable-on-sneak: true - blocks-per-level: 32 - whitelisted-blocks: - - oak_wood - - dark_oak_wood - - acacia_wood - - jungle_wood - - birch_wood - - crimson_stem - - spruce_wood - - warped_stem - - oak_log - - dark_oak_log - - acacia_log - - jungle_log - - birch_log - - spruce_log \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/magmawalker.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/magmawalker.yml deleted file mode 100644 index f2bdc598..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/magmawalker.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Magma Walker EcoEnchant -# - -name: "Magma Walker" -description: Turns lava beneath the player into obsidian. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - remove-after-ticks: 40 - initial-radius: 2 - per-level-radius: 1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/magnetic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/magnetic.yml deleted file mode 100644 index c20c0638..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/magnetic.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Magnetic EcoEnchant -# - -name: "Magnetic" -description: Items and XP go towards you. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 4 - -config: - initial-distance: 2.5 # Initial item pickup range - bonus-per-level: 0.6 # Bonus range per level (Level 1 also includes bonus) - repeat-ticks: 3 # Check magnetic every few ticks. Lower values give smoother animations and feels better to the end user, however may cause lag on lower-end hardware. \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/marking.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/marking.yml deleted file mode 100644 index f9ebb3b9..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/marking.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Marking EcoEnchant -# - -name: "Marking" -description: Increases subsequent damage dealt to opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 4 - -config: - ticks-per-level: 15 # Ticks to weaken player for per level - multiplier-while-weak: 1.25 # Times more damage to deal while weakened diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/marksman.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/marksman.yml deleted file mode 100644 index 19da870a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/marksman.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Marksman EcoEnchant -# - -name: "Marksman" -description: Removes arrow drop. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - remove-arrow-after-ticks: 120 #to prevent server lag, as arrows shot into the sky will not land. there are 20 ticks in a second. diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/necrotic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/necrotic.yml deleted file mode 100644 index 81370321..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/necrotic.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Necrotic EcoEnchant -# - -name: "Necrotic" -description: Wither skeletons have a higher chance to drop skulls. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - looting - maximum-level: 4 - -config: - chance-per-level: 5 #Chance of dropping a wither skull per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/netheric.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/netheric.yml deleted file mode 100644 index 8938537a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/netheric.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Netheric EcoEnchant -# - -name: "Netheric" -description: Increases damage dealt in the nether. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - enderism - maximum-level: 6 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/netherinfusion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/netherinfusion.yml deleted file mode 100644 index 666bd0a6..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/netherinfusion.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Nether Infusion EcoEnchant -# - -name: "Nether Infusion" -description: Increases damage dealt in the nether. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - end_infusion - maximum-level: 6 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/nocturnal.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/nocturnal.yml deleted file mode 100644 index 2ed50518..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/nocturnal.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Nocturnal EcoEnchant -# - -name: "Nocturnal" -description: Increases damage dealt at night. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - diurnal - maximum-level: 6 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/optics.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/optics.yml deleted file mode 100644 index 5681be55..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/optics.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Optics EcoEnchant -# - -name: "Optics" -description: Increases damage when further from target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 5 - -config: - block-multiplier: 0.002 # Damage multiplier is distance * level * multiplier + 1 eg: 50 blocks with optics 5 and multiplier 0.002 = 50*5*0.002+1 = 1.5x damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/oxygenate.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/oxygenate.yml deleted file mode 100644 index 9384b040..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/oxygenate.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Oxygenate EcoEnchant -# - -name: "Oxygenate" -description: Gain oxygen when breaking blocks underwater. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - pickaxe - - axe - - shovel - - hoe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 8 - -config: - oxygen-per-level: 8 # Oxygen ticks to give per level diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/pacify.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/pacify.yml deleted file mode 100644 index 290702f4..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/pacify.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Pacify EcoEnchant -# - -name: "Pacify" -description: Increases damage against creepers. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - serrated - - bladed - - phantasm - - arachnid - - abattoir - - impaling - maximum-level: 5 - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/paladin.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/paladin.yml deleted file mode 100644 index 78ff703f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/paladin.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Paladin EcoEnchant -# - -name: "Paladin" -description: Increases damage dealt when riding a horse. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - multiplier: 0.2 # 1 + (Level * Multiplier) is multiplied with the damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/paralyze.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/paralyze.yml deleted file mode 100644 index 283493fe..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/paralyze.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Paralyze EcoEnchant -# - -name: "Paralyze" -description: Chance to give your attacker mining fatigue. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - shield - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 1.5 - ticks-per-level: 5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/parasitic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/parasitic.yml deleted file mode 100644 index bb2fc8ff..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/parasitic.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Parasitic EcoEnchant -# - -name: "Parasitic" -description: Heals a portion of damage dealt. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - health-per-level: 1 # Level * Health = Amount of health to heal diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/parry.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/parry.yml deleted file mode 100644 index 0a437834..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/parry.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Parry EcoEnchant -# - -name: "Parry" -description: Reduces incoming damage when holding item. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 4 - -config: - multiplier: 0.05 # 1 - (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/phantasm.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/phantasm.yml deleted file mode 100644 index 8f44722f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/phantasm.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Phantasm EcoEnchant -# - -name: "Phantasm" -description: Increases damage against undead mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - serrated - - bladed - - arachnid - - pacify - - abattoir - - impaling - maximum-level: 5 - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/plasmic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/plasmic.yml deleted file mode 100644 index 86f6c51f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/plasmic.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Plasmic EcoEnchant -# - -name: "Plasmic" -description: Increases damage dealt against opponents with diamond or netherite armor. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - voltage - maximum-level: 5 - -config: - multiplier: 0.015 # bonus damage multiplier = multiplier * level * pieces diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/protector.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/protector.yml deleted file mode 100644 index c2937c8f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/protector.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Protector EcoEnchant -# - -name: "Protector" -description: Prevents damaging your own pets. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: -# No config available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/proximity.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/proximity.yml deleted file mode 100644 index 8e7cc0aa..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/proximity.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Proximity EcoEnchant -# - -name: "Proximity" -description: Increases damage when closer to opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 5 - -config: - when-closer-than-blocks: 1.5 - multiplier: 0.05 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/puncture.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/puncture.yml deleted file mode 100644 index 442b4229..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/puncture.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Puncture EcoEnchant -# - -name: "Puncture" -description: Trident deals additional damage to shelled mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - multiplier: 0.12 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/quadrilateralism.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/quadrilateralism.yml deleted file mode 100644 index eca4f2d6..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/quadrilateralism.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Quadrilateralism EcoEnchant -# - -name: "Quadrilateralism" -description: Increases damage dealt against slimes and magma cubes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 7 - -config: - multiplier: 0.035 # Damage = level * multiplier + 1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/radiance.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/radiance.yml deleted file mode 100644 index e609f533..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/radiance.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Radiance EcoEnchant -# - -name: "Radiance" -description: Causes entities to glow near where arrow lands. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 4 - -config: - radius-multiplier: 3 # Radius Multiplier * level = Radius of which to damage entities - duration-per-level: 10 # Duration (in ticks) to make entity glow for \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/rage.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/rage.yml deleted file mode 100644 index 906720fa..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/rage.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Rage EcoEnchant -# - -name: "Rage" -description: Chance of angering nearby monsters towards your opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 5 - -config: - chance-per-level: 3 - distance-per-level: 4 # Distance for mobs to check \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/rapid.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/rapid.yml deleted file mode 100644 index 28510c29..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/rapid.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Rapid EcoEnchant -# - -name: "Rapid" -description: Increases bow pull speed. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - percent-faster-per-level: 16 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/reaper.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/reaper.yml deleted file mode 100644 index 9689ea62..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/reaper.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Reaper EcoEnchant -# - -name: "Reaper" -description: Chance to prevent your opponents soulbound from working. -enabled: true - -obtaining: - table: true - villager: false - loot: false - rarity: legendary - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 2 diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/rebounding.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/rebounding.yml deleted file mode 100644 index ad99e3a8..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/rebounding.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Rebounding EcoEnchant -# - -name: "Rebounding" -description: Deal knockback to entities that attack you. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - velocity-multiplier: 1.07 diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/reel.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/reel.yml deleted file mode 100644 index 90569893..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/reel.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Reel EcoEnchant -# - -name: "Reel" -description: Pulls entities towards you. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - rod - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - velocity-multiplier: 0.75 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/reinforcement.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/reinforcement.yml deleted file mode 100644 index 9263626b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/reinforcement.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Reinforcement EcoEnchant -# - -name: "Reinforcement" -description: Reduces incoming damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - elytra - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 4 - -config: - reduction-per-level: 2 #Percent less damage taken per level (Protection is 4%) \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/rejuvenation.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/rejuvenation.yml deleted file mode 100644 index 82813e54..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/rejuvenation.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Rejuvenation EcoEnchant -# - -name: "Rejuvenation" -description: Increases natural regeneration speed. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - per-point-multiplier: 0.1 # 8 points * multiplier +1 = 1.8x natural regen \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/replenish.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/replenish.yml deleted file mode 100644 index 758d5ede..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/replenish.yml +++ /dev/null @@ -1,23 +0,0 @@ -# -# Replenish EcoEnchant -# - -name: "Replenish" -description: Automatically replants crops. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - hoe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/respirator.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/respirator.yml deleted file mode 100644 index 7124274c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/respirator.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Respirator EcoEnchant -# - -name: "Respirator" -description: Reduces dragon breath damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - percent-less-per-level: 15 # Points * Percent less / 100 * damage = damage taken \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/revenant.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/revenant.yml deleted file mode 100644 index 135247f4..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/revenant.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Revenant EcoEnchant -# - -name: "Revenant" -description: Increases damage against undead mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - power - - force - - insecticide - - slaughter - - settle - maximum-level: 5 - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/sating.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/sating.yml deleted file mode 100644 index 4991ef01..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/sating.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Sating EcoEnchant -# - -name: "Sating" -description: Reduces hunger loss. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 10 # Chance to "ignore" food loss (in percent) every time you lose food \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/serrated.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/serrated.yml deleted file mode 100644 index 3d7481fd..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/serrated.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Serrated EcoEnchant -# - -name: "Serrated" -description: Trident deals additional damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - bladed - - phantasm - - arachnid - - pacify - - abattoir - - impaling - maximum-level: 5 - -config: - multiplier: 0.25 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/settle.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/settle.yml deleted file mode 100644 index fea790f1..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/settle.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Settle EcoEnchant -# - -name: "Settle" -description: Increases damage against creepers. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - power - - force - - revenant - - slaughter - - insecticide - maximum-level: 5 - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/shockwave.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/shockwave.yml deleted file mode 100644 index 0009a2c9..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/shockwave.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Shockwave EcoEnchant -# - -name: "Shockwave" -description: Damages entities that arrows fly near. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - damage-per-level: 1 diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/shotassist.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/shotassist.yml deleted file mode 100644 index 335fe17c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/shotassist.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Shot Assist EcoEnchant -# - -name: "Shot Assist" -description: Deal more damage with arrows while wearing. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - multiplier: 0.015 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/sickening.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/sickening.yml deleted file mode 100644 index f7222d4d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/sickening.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Sickening EcoEnchant -# - -name: "Sickening" -description: Chance of nauseating your opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - chance-per-level: 3 #as percentage - duration-per-level: 30 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/slaughter.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/slaughter.yml deleted file mode 100644 index bd75ed54..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/slaughter.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Slaughter EcoEnchant -# - -name: "Slaughter" -description: Increases damage against passive mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - power - - force - - revenant - - insecticide - - settle - maximum-level: 5 - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/slicing.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/slicing.yml deleted file mode 100644 index f4b9f5b3..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/slicing.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Slicing EcoEnchant -# - -name: "Slicing" -description: Damages entities when flown through. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - elytra - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 8 - -config: - damage-per-level: 0.7 #Damage given to opponent per level - cooldown: 20 #Cooldown in ticks until player can attack another entity with slicing - damage-elytra: true \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/spearfishing.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/spearfishing.yml deleted file mode 100644 index 812aee46..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/spearfishing.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Spearfishing EcoEnchant -# - -name: "Spearfishing" -description: Chance of dropping fish when tridenting water. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 4 - drops: - - cod - - salmon - - pufferfish - - tropical_fish \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/spiked.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/spiked.yml deleted file mode 100644 index c015ae3d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/spiked.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Spiked EcoEnchant -# - -name: "Spiked" -description: Hooking onto an entity will damage it. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - targets: - - rod - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - harpoon - maximum-level: 3 - -config: - damage-per-level: 1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/splash.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/splash.yml deleted file mode 100644 index 5aa3a372..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/splash.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Splash EcoEnchant -# - -name: "Splash" -description: Damages entities near where trident lands but does not drop experience. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - wisdom - maximum-level: 4 - -config: - radius-multiplier: 2 # Radius Multiplier * level = Radius of which to damage entities - damage-per-level: 1 # Damage to give to nearby entities \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/stab.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/stab.yml deleted file mode 100644 index 4fec62f6..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/stab.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Stab EcoEnchant -# - -name: "Stab" -description: Increases melee trident damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 5 - -config: - damage-base: 0.5 # More damage to do as base - damage-per-level: 0.5 # More damage to do per level - # Default values are taken from sharpness diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/stalwart.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/stalwart.yml deleted file mode 100644 index 1fc7c68a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/stalwart.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Stalwart EcoEnchant -# - -name: "Stalwart" -description: Chance to get resistance for a short time when taking damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 2 - duration-per-level: 5 # Ticks to get resistance for \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/stamina.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/stamina.yml deleted file mode 100644 index e7adf594..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/stamina.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Stamina EcoEnchant -# - -name: "Stamina" -description: Decreases hunger loss while sprinting. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 4 - -config: - chance-per-level: 10 # Chance to "ignore" food loss (in percent) every time you lose food while sprinting \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/stoneswitcher.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/stoneswitcher.yml deleted file mode 100644 index 0f567330..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/stoneswitcher.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Stone Switcher EcoEnchant -# - -name: "Stone Switcher" -description: Breaking stone can drop as variants. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - transfuse - - silk_touch - maximum-level: 6 - -config: - blocks: - - andesite - - granite - - diorite - chance-per-level: 10 # Chance for drop to be switched diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/strayaspect.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/strayaspect.yml deleted file mode 100644 index aed7db37..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/strayaspect.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Stray Aspect EcoEnchant -# - -name: "Stray Aspect" -description: Chance of slowing your opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - allow-not-fully-charged: false - chance-per-level: 1 #chance of slowness per level - ticks-per-level: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/succession.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/succession.yml deleted file mode 100644 index c57cd0e1..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/succession.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Succession EcoEnchant -# - -name: "Succession" -description: Shoots multiple arrows in a burst. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - tripleshot - - pentashot - - buckshot - -config: - extra-arrows-per-level: 1 - per-arrow-damage: true #If set to false, then it will only take 1 durability \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/supercritical.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/supercritical.yml deleted file mode 100644 index 144a5f04..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/supercritical.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Supercritical EcoEnchant -# - -name: "Supercritical" -description: Small chance to deal extreme damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - damage-multiplier: 3 - allow-not-fully-charged: false - chance-per-level: 0.5 # Chance to deal supercrit per hit \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/sycophant.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/sycophant.yml deleted file mode 100644 index 8daaa16a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/sycophant.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Sycophant EcoEnchant -# - -name: "Sycophant" -description: Heals a portion of damage blocked. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - shield - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - health-per-level: 1 # Level * Health = Amount of health to heal diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/tectonic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/tectonic.yml deleted file mode 100644 index 36fc8433..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/tectonic.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Tectonic EcoEnchant -# - -name: "Tectonic" -description: Damages nearby entities when taking fall damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - feather_falling - maximum-level: 2 - -config: - initial-radius: 3 - per-level-radius: 2 - initial-damage: 1 - per-level-damage: 1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/telekinesis.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/telekinesis.yml deleted file mode 100644 index 332c4cc7..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/telekinesis.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Telekinesis EcoEnchant -# - -name: "Telekinesis" -description: Drops and xp go directly into your inventory. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - targets: - - pickaxe - - axe - - shovel - - hoe - - sword - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - use-orb: true # Use experience orb above player to give xp. Use if you need mending interaction. - not-on-players: false # Disallow getting drops from players \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/thor.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/thor.yml deleted file mode 100644 index 00e03c21..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/thor.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Thor EcoEnchant -# - -name: "Thor" -description: Chance of striking lightning on your opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 2 - allow-not-fully-charged: false # dont require sword attack to be at full charge - lightning-damage: 2.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/thrive.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/thrive.yml deleted file mode 100644 index 81112a1d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/thrive.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Thrive EcoEnchant -# - -name: "Thrive" -description: Increases maximum health. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - prosperity - maximum-level: 2 - -config: - health-per-point: 1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/tornado.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/tornado.yml deleted file mode 100644 index 3dc695bd..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/tornado.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Tornado EcoEnchant -# - -name: "Tornado" -description: Knocks your opponent into the air. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - knockback - - grapple - - annihilate - maximum-level: 2 - -config: - velocity-per-level: 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/toxic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/toxic.yml deleted file mode 100644 index 94757c9d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/toxic.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Toxic EcoEnchant -# - -name: "Toxic" -description: Chance to apply poison to your opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - chance-per-level: 3 #chance of poisoning opponent per level - allow-not-fully-charged: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/transfuse.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/transfuse.yml deleted file mode 100644 index 8ada646b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/transfuse.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Transfuse EcoEnchant -# - -name: "Transfuse" -description: Breaking stone can drop as random ore. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - stone_switcher - - silk_touch - maximum-level: 7 - -config: - blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - chance-per-level: 0.03 # Chance for drop to be switched - works-on: - - stone diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/tripleshot.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/tripleshot.yml deleted file mode 100644 index 1b4a5e7c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/tripleshot.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Tripleshot EcoEnchant -# - -name: "Tripleshot" -description: Shoots 3 arrows. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - succession - - pentashot - - buckshot - -config: - angle: 11 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/vampireaspect.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/vampireaspect.yml deleted file mode 100644 index 6d9b3ba3..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/vampireaspect.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Vampire Aspect EcoEnchant -# - -name: "Vampire Aspect" -description: Chance to apply wither to your opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - chance-per-level: 3 #chance of withering opponent per level - allow-not-fully-charged: false #dont require sword attack to be at full charge \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/vein.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/vein.yml deleted file mode 100644 index 3323ba2b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/vein.yml +++ /dev/null @@ -1,39 +0,0 @@ -# -# Vein EcoEnchant -# - -name: "Vein" -description: Mine blocks in a vein. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - maximum-level: 5 - conflicts: - - drill - - blast_mining - -config: - disable-on-sneak: true - blocks-per-level: 8 - whitelisted-blocks: - - coal_ore - - iron_ore - - gold_ore - - ancient_debris - - lapis_ore - - diamond_ore - - redstone_ore - - nether_quartz_ore - - gilded_blackstone - - nether_gold_ore - - glowstone \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/venom.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/venom.yml deleted file mode 100644 index 4bfe4dcd..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/venom.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Venom EcoEnchant -# - -name: "Venom" -description: Chance of withering your opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 1 #chance of wither per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/voidaffinity.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/voidaffinity.yml deleted file mode 100644 index 7fa75229..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/voidaffinity.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Void Affinity EcoEnchant -# - -name: "Void Affinity" -description: Increases damage dealt in the end. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - netheric - maximum-level: 5 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/voltage.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/voltage.yml deleted file mode 100644 index b32ed621..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/voltage.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Voltage EcoEnchant -# - -name: "Voltage" -description: Increases damage dealt against opponents with iron, gold, or chain armor. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - plasmic - maximum-level: 5 - -config: - multiplier: 0.015 # bonus damage multiplier = multiplier * level * pieces diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/wateraffinity.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/wateraffinity.yml deleted file mode 100644 index 93a65fb5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/wateraffinity.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Water Affinity EcoEnchant -# - -name: "Water Affinity" -description: Increases damage dealt when in water. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - fire_affinity - maximum-level: 7 - -config: - multiplier: 0.02 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/wateraspect.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/wateraspect.yml deleted file mode 100644 index 228c7e2e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/wateraspect.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Water Aspect EcoEnchant -# - -name: "Water Aspect" -description: Increases damage dealt against fiery mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - fire_aspect - maximum-level: 2 - -config: - multiplier: 0.2 # Damage = level * multiplier + 1. Damage on blaze/magma cube with Water Aspect 2 = 2 * 0.2 + 1 = 1.4x damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/weakening.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/weakening.yml deleted file mode 100644 index a96b9220..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/weakening.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Weakening EcoEnchant -# - -name: "Weakening" -description: Increases subsequent damage dealt to opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 4 - -config: - ticks-per-level: 1.5 # Ticks to weaken player for per level - multiplier-while-weak: 1.25 # Times more damage to deal while weakened diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/wisdom.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/wisdom.yml deleted file mode 100644 index e2b8b49a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/wisdom.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Wisdom EcoEnchant -# - -name: "Wisdom" -description: Increases dropped experience. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - targets: - - sword - - axe - - pickaxe - - shovel - - hoe - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - splash - - intellect - maximum-level: 3 - -config: - bonus-per-point: 0.2 #Increase per level relative to base \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/woodswitcher.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/woodswitcher.yml deleted file mode 100644 index d6e5fc72..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/woodswitcher.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Wood Switcher EcoEnchant -# - -name: "Wood Switcher" -description: Breaking logs can drop as other logs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - silk_touch - maximum-level: 6 - -config: - blocks: - - oak_log - - birch_log - - spruce_log - - jungle_log - - acacia_log - - dark_oak_log - chance-per-level: 10 # Chance for drop to be switched diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/wound.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/wound.yml deleted file mode 100644 index 2c45c977..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/wound.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Wound EcoEnchant -# - -name: "Wound" -description: Causes your opponent to bleed, damaging them repeatedly. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 7 - -config: - chance-per-level: 3 #chance of bleeding per level - bleed-damage: 1 - amount-per-level: 1 # Bleed number per level diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/zeus.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/zeus.yml deleted file mode 100644 index 6f161795..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/zeus.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Zeus EcoEnchant -# - -name: "Zeus" -description: Chance to strike lightning on your opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 1 - lightning-damage: 2.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/aiming.yml b/eco-core/core-plugin/src/main/resources/enchants/special/aiming.yml deleted file mode 100644 index 6eac30c0..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/aiming.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Aiming EcoEnchant -# - -name: "Aiming" -description: Arrows hone in on your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 5 - -config: - distance-per-level: 4 # Distance to scan per aiming level - scale-on-force: true # Scale distance based on bow pull - require-full-force: true # Require full bow pull (works with rapid) If true, then scale-on-force is irrelevant. - check-ticks: 10 # Ticks between rotations - checks-per-level: 2 # Amount of times to rotate arrow per level (prevents "floating") \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/annihilate.yml b/eco-core/core-plugin/src/main/resources/enchants/special/annihilate.yml deleted file mode 100644 index 0f726b99..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/annihilate.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Annihilate EcoEnchant -# - -name: "Annihilate" -description: Extreme Knockback. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - knockback - - tornado - - grapple - maximum-level: 2 - -config: - velocity-multiplier: 2.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/bladed.yml b/eco-core/core-plugin/src/main/resources/enchants/special/bladed.yml deleted file mode 100644 index fcb3c75e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/bladed.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Bladed EcoEnchant -# - -name: "Bladed" -description: Trident deals extreme additional damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: veryspecial - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - impaling - - serrated - - phantasm - - arachnid - - pacify - - abattoir - maximum-level: 5 - -config: - base-multiplier: 1.25 # Percent more damage to do as base - multiplier: 0.25 # 1 + (Level * Multiplier) is multiplied with the damage - # To explain, Bladed V would be 2.5x more damage: 1.25 + (5*0.25) - # By default, Bladed I acts like Serrated VI diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/bolt.yml b/eco-core/core-plugin/src/main/resources/enchants/special/bolt.yml deleted file mode 100644 index aa10c171..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/bolt.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Bolt EcoEnchant -# - -name: "Bolt" -description: Chance of striking powerful lightning on your opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 4 - -config: - chance-per-level: 5 - allow-not-fully-charged: false # dont require sword attack to be at full charge - lightning-damage: 8 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/carve.yml b/eco-core/core-plugin/src/main/resources/enchants/special/carve.yml deleted file mode 100644 index 34b5e398..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/carve.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Carve EcoEnchant -# - -name: "Carve" -description: Heavily damage all entities around attacked entity. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - cleave - maximum-level: 8 - -config: - damage-percentage-per-level: 10 - radius-per-level: 0.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/confusion.yml b/eco-core/core-plugin/src/main/resources/enchants/special/confusion.yml deleted file mode 100644 index e3b4452a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/confusion.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Confusion EcoEnchant -# - -name: "Confusion" -description: Chance to shuffle your opponents hotbar. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 4 - -config: - chance-per-level: 2 #chance of shuffling opponents hotbar per level - allow-not-fully-charged: false #dont require sword attack to be at full charge \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/energizing.yml b/eco-core/core-plugin/src/main/resources/enchants/special/energizing.yml deleted file mode 100644 index 770d505a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/energizing.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Energizing EcoEnchant -# - -name: "Energizing" -description: Receive a short burst of haste after breaking a block. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - pickaxe - - axe - - shovel - - hoe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - ticks-per-level: 8 - initial-level: 2 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/force.yml b/eco-core/core-plugin/src/main/resources/enchants/special/force.yml deleted file mode 100644 index 60e83d98..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/force.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Force EcoEnchant -# - -name: "Force" -description: Massively increases arrow damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: veryspecial - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - power - - revenant - - insecticide - - slaughter - - settle - maximum-level: 8 - -config: - multiplier: 0.25 # Formula is (multiplier * (level + 6) + 1)*damage | Default functions as power 5 + level, eg force 2 = power 7 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/frenzy.yml b/eco-core/core-plugin/src/main/resources/enchants/special/frenzy.yml deleted file mode 100644 index f5909ba2..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/frenzy.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Frenzy EcoEnchant -# - -name: "Frenzy" -description: Gives strength after killing an entity. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - seconds-per-level: 1.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/harpoon.yml b/eco-core/core-plugin/src/main/resources/enchants/special/harpoon.yml deleted file mode 100644 index 65951316..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/harpoon.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Harpoon EcoEnchant -# - -name: "Harpoon" -description: Hooking onto an entity will heavily damage it. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - rod - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - spiked - maximum-level: 3 - -config: - damage-per-level: 2 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/indestructibility.yml b/eco-core/core-plugin/src/main/resources/enchants/special/indestructibility.yml deleted file mode 100644 index 982c4545..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/indestructibility.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Indestructibility EcoEnchant -# - -name: "Indestructibility" -description: Massively increases item durability. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - all - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - unbreaking - maximum-level: 3 - -config: - level-bonus: 4 # Indestructiblity 1 is the same as unbreaking +level, ie: indestructibility 3 with bonus 4 is the same as unbreaking 7 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/instability.yml b/eco-core/core-plugin/src/main/resources/enchants/special/instability.yml deleted file mode 100644 index ca53fac5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/instability.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Instability EcoEnchant -# - -name: "Instability" -description: Explosive arrows. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - fire: false - break-blocks: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/intellect.yml b/eco-core/core-plugin/src/main/resources/enchants/special/intellect.yml deleted file mode 100644 index 2d316fdc..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/intellect.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Intellect EcoEnchant -# - -name: "Intellect" -description: Massively increases dropped experience. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - bow - - crossbow - - trident - - pickaxe - - axe - - shovel - - hoe - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - splash - - wisdom - maximum-level: 3 - -config: - bonus-per-point: 1.2 #Increase per level relative to base \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/lifesteal.yml b/eco-core/core-plugin/src/main/resources/enchants/special/lifesteal.yml deleted file mode 100644 index cb757ad3..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/lifesteal.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Life Steal EcoEnchant -# - -name: "Life Steal" -description: Heals a large portion of damage dealt. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - leeching - maximum-level: 3 - -config: - health-per-level: 2 # Level * Health = Amount of health to heal - allow-not-fully-charged: false diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/pentashot.yml b/eco-core/core-plugin/src/main/resources/enchants/special/pentashot.yml deleted file mode 100644 index 3982b1e1..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/pentashot.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Pentashot EcoEnchant -# - -name: "Pentashot" -description: Shoots 5 arrows. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - succession - - tripleshot - - buckshot - maximum-level: 1 - -config: - side-arrows-per-level: 2 # If you want to have more levels - angle: 11 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/preservation.yml b/eco-core/core-plugin/src/main/resources/enchants/special/preservation.yml deleted file mode 100644 index f6f9e640..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/preservation.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Preservation EcoEnchant -# - -name: "Preservation" -description: Massively reduces incoming damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - protection - - fire_protection - - projectile_protection - - blast_protection - maximum-level: 4 - -config: - percent-less-per-level: 5 # Points * Percent less / 100 * damage = damage taken \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/prosperity.yml b/eco-core/core-plugin/src/main/resources/enchants/special/prosperity.yml deleted file mode 100644 index ff8080c2..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/prosperity.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Prosperity EcoEnchant -# - -name: "Prosperity" -description: Massively increases maximum health. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: veryspecial - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - thrive - maximum-level: 3 - -config: - health-per-point: 2 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/razor.yml b/eco-core/core-plugin/src/main/resources/enchants/special/razor.yml deleted file mode 100644 index 5106a7bc..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/razor.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Razor EcoEnchant -# - -name: "Razor" -description: Massively increases damage dealt. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: veryspecial - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - sharpness - - smite - - bane_of_arthropods - - defusion - - butchering - - ender_slayer - - introversion - maximum-level: 8 - -config: - multiplier: 0.5 # Vanilla sharpness is 0.5*level + 0.5 extra damage. Razor formula is multiplier*level + base extra damage. - base-damage: 10 # Vanilla Smite 5/BOA 5 extra damage is 12.5 - decrease-if-cooldown: true \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/repairing.yml b/eco-core/core-plugin/src/main/resources/enchants/special/repairing.yml deleted file mode 100644 index 338a6356..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/repairing.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Repairing EcoEnchant -# - -name: "Repairing" -description: Automatically repairs items when not held. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: veryspecial - -general-config: - targets: - - all - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - mending - - decay_curse - maximum-level: 3 - -config: - repeat-ticks: 100 # How often (in ticks) to repair items - multiplier: 1 # Amount to repair = multiplier * level. Does not accept decimals \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/soulbound.yml b/eco-core/core-plugin/src/main/resources/enchants/special/soulbound.yml deleted file mode 100644 index bf38f4c2..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/soulbound.yml +++ /dev/null @@ -1,23 +0,0 @@ -# -# Soulbound EcoEnchant -# - -name: "Soulbound" -description: Keep this item on death. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - all - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - -config: - remove-after: false # If soulbound should be 1-time use \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/spring.yml b/eco-core/core-plugin/src/main/resources/enchants/special/spring.yml deleted file mode 100644 index 9058f5d6..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/spring.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Spring EcoEnchant -# - -name: "Spring" -description: Increases jump height and distance. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/streamlining.yml b/eco-core/core-plugin/src/main/resources/enchants/special/streamlining.yml deleted file mode 100644 index 8041ee40..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/streamlining.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Streamlining EcoEnchant -# - -name: "Streamlining" -description: Increases movement speed. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 8 - -config: - speed-per-level: 0.02 # Base is 0.2 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/volatile.yml b/eco-core/core-plugin/src/main/resources/enchants/special/volatile.yml deleted file mode 100644 index c2aff0b5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/volatile.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Volatile EcoEnchant -# - -name: "Volatile" -description: Explosive sword attacks. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - fire: false - break-blocks: false - allow-not-fully-charged: false - chance-per-level: 5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/ascend.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/ascend.yml deleted file mode 100644 index 8f48c5b5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/ascend.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Ascend EcoEnchant -# - -name: "Ascend" -description: Levitates you into the air -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - activation-sound: ENTITY_FIREWORK_ROCKET_LARGE_BLAST - cooldown: 90 # In seconds - power: 25 # Level of levitation to give - ticks-per-level: 6 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/charge.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/charge.yml deleted file mode 100644 index 4d348186..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/charge.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Charge EcoEnchant -# - -name: "Charge" -description: Launches you in the direction you're looking. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - activation-sound: ENTITY_FIREWORK_ROCKET_LAUNCH - cooldown: 40 # In seconds - velocity-per-level: 1.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/dynamite.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/dynamite.yml deleted file mode 100644 index cfcdea22..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/dynamite.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Dynamite EcoEnchant -# - -name: "Dynamite" -description: Mines blocks in a large area. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: - activation-sound: ENTITY_DRAGON_FIREBALL_EXPLODE - cooldown: 60 # In seconds - hardness-check: true # Only break blocks with hardness less than or equal to first block - blacklisted-blocks: - - bedrock - base-bonus: 2 # Base extra blocks on all sides to break (1 = 3x3x3, 2 = 5x5x5, 3 = 7x7x7) - per-level-bonus: 1 # Extra blocks on all sides per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/missile.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/missile.yml deleted file mode 100644 index c1a2d630..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/missile.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Missile EcoEnchant -# - -name: "Missile" -description: Shoots a wither skull -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - activation-sound: ENTITY_WITHER_SHOOT - cooldown: 40 # In seconds - velocity: 3 - damage-per-level: 8 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/quake.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/quake.yml deleted file mode 100644 index 50182bb1..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/quake.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Quake EcoEnchant -# - -name: "Quake" -description: Damages all nearby entities -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - activation-sound: ENTITY_ENDER_DRAGON_GROWL - cooldown: 40 # In seconds - damage-per-level: 3 - radius-per-level: 2 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/vitalize.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/vitalize.yml deleted file mode 100644 index b779035f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/vitalize.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Vitalize EcoEnchant -# - -name: "Vitalize" -description: Puts you back on max health -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - sword - - axe - - pickaxe - - shovel - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 1 - -config: - activation-sound: ENTITY_PLAYER_LEVELUP - cooldown: 450 # In seconds \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/plugin.yml b/eco-core/core-plugin/src/main/resources/plugin.yml index f77ed52e..85408283 100644 --- a/eco-core/core-plugin/src/main/resources/plugin.yml +++ b/eco-core/core-plugin/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ -name: EcoEnchants +name: EcoSkills version: ${projectVersion} -main: com.willfp.ecoenchants.EcoEnchantsPlugin +main: com.willfp.ecoskills.EcoSkillsPlugin api-version: 1.16 authors: [ Auxilor ] website: willfp.com @@ -8,103 +8,20 @@ load: STARTUP depend: - eco - ProtocolLib -softdepend: - - WorldGuard - - GriefPrevention - - Towny - - FactionsUUID - - Lands - - Kingdoms - - NoCheatPlus - - AAC - - Matrix - - Spartan - - Essentials - - PlaceholderAPI - - mcMMO +softdepend: [] commands: - ecoreload: + esreload: description: Reloads config - permission: ecoenchants.reload - ecodebug: - description: Debug information - permission: ecoenchants.ecodebug - enchantinfo: - description: Show information about an enchantment - permission: ecoenchants.enchantinfo - randomenchant: - description: Adds a random enchantment to an item - permission: ecoenchants.randomenchant - giverandombook: - description: Gives a book containing a random enchantment - permission: ecoenchants.randombook + permission: ecoskills.reload permissions: - ecoenchants.*: - description: All ecoenchants permissions + ecoskills.*: + description: All ecoskills permissions default: op children: - ecoenchants.fromtable.*: true ecoenchants.reload: true - ecoenchants.updateannounce: true - ecoenchants.enchantinfo: true - ecoenchants.ecodebug: true - ecoenchants.randomenchant: true - ecoenchants.randomenchant.bypasshardcap: true - ecoenchants.randombook: true - ecoenchants.anvil.*: true - ecoenchants.anvil.*: - description: Allows all anvil permissions - default: op - children: - ecoenchants.anvil.bypasshardcap: true - ecoenchants.anvil.color: true - ecoenchants.fromtable.*: - description: Allows getting all enchantments from an enchanting table - default: true - ecoenchants.updateannounce: - description: Informs admins of a new update - default: op - ecoenchants.reload: + ecoskills.reload: description: Allows reloading the config - default: op - ecoenchants.ecodebug: - description: Allows the use of /ecodebug to print verbose debug information to console - default: op - ecoenchants.enchantinfo: - description: Allows the use of /enchantinfo to show enchant info - default: true - ecoenchants.randombook: - description: Allows the use of /giverandombook to give a book with a random enchantment - default: op - ecoenchants.randomenchant: - description: Allows the use of /randomenchant to apply a random enchantment to an item - default: op - ecoenchants.randomenchant.others: - description: Allows the use of /randomenchant to apply a random enchantment to an item for another player - default: op - ecoenchants.randomenchant.bypasshardcap: - description: Allows /randomenchant bypassing the anvil hard cap - default: op - ecoenchants.anvil.bypasshardcap: - description: Allows bypassing the anvil hard cap - default: op - ecoenchants.anvil.color: - description: Allows color from anvil renames - default: op - - # Perks - ecoenchants.cooldowntime.half: - description: Halves the cooldown time on spells - default: false - ecoenchants.cooldowntime.third: - description: Thirds the cooldown time on spells - default: false - ecoenchants.cooldowntime.quarter: - description: Quarters the cooldown time on spells - default: false - ecoenchants.cooldowntime.75: - description: Reduces the cooldown time on spells by 25% - default: false \ No newline at end of file + default: op \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/rarity.yml b/eco-core/core-plugin/src/main/resources/rarity.yml deleted file mode 100644 index a43a739f..00000000 --- a/eco-core/core-plugin/src/main/resources/rarity.yml +++ /dev/null @@ -1,68 +0,0 @@ -rarities: - # Table Probability is the chance of getting enchantment as a percentage from an enchanting table - # Minimum Level is the minimum xp level you have to be to get the enchantment - # You can add more rarities by following the pattern. - # Remember, enchantments are more likely to be high-level the closer they are to maximum-obtainable-level - # Villager probability is the chance of a villager having this trade as a percentage. Vanilla default for all enchantments is 2.7%, however you can choose this per-rarity. - # Loot probability is the chance of an item in a loot chest having this enchantment as a percentage - - # Custom Color is a custom name color for all enchantments of rarity to have - # This is disabled by default. - # Curses override this, and always display in their specified color. - - common: - table-probability: 30 - minimum-level: 1 - villager-probability: 10.5 - loot-probability: 12 - custom-color: - enabled: false - color: "&7" - uncommon: - table-probability: 20 - minimum-level: 5 - villager-probability: 9 - loot-probability: 16 - custom-color: - enabled: false - color: "&a" - rare: - table-probability: 20 - minimum-level: 15 - villager-probability: 7.5 - loot-probability: 18 - custom-color: - enabled: false - color: "&9" - epic: - table-probability: 10 - minimum-level: 16 - villager-probability: 6 - loot-probability: 20 - custom-color: - enabled: false - color: "&5" - legendary: - table-probability: 8 - minimum-level: 20 - villager-probability: 4.5 - loot-probability: 15 - custom-color: - enabled: false - color: "&6" - special: - table-probability: 2 - minimum-level: 30 - villager-probability: 3 - loot-probability: 5 - custom-color: - enabled: false - color: "&d" - veryspecial: - table-probability: 1 - minimum-level: 30 - villager-probability: 1.5 - loot-probability: 2 - custom-color: - enabled: false - color: "&4" \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/target.yml b/eco-core/core-plugin/src/main/resources/target.yml deleted file mode 100644 index e016b622..00000000 --- a/eco-core/core-plugin/src/main/resources/target.yml +++ /dev/null @@ -1,104 +0,0 @@ -targets: - axe: - - wooden_axe - - stone_axe - - iron_axe - - golden_axe - - diamond_axe - - netherite_axe - - book: - - book - - enchanted_book - - pickaxe: - - wooden_pickaxe - - stone_pickaxe - - iron_pickaxe - - golden_pickaxe - - diamond_pickaxe - - netherite_pickaxe - - hoe: - - wooden_hoe - - stone_hoe - - iron_hoe - - golden_hoe - - diamond_hoe - - netherite_hoe - - shovel: - - wooden_shovel - - stone_shovel - - iron_shovel - - golden_shovel - - diamond_shovel - - netherite_shovel - - sword: - - wooden_sword - - stone_sword - - iron_sword - - golden_sword - - diamond_sword - - netherite_sword - - helmet: - - turtle_helmet - - leather_helmet - - chainmail_helmet - - iron_helmet - - golden_helmet - - diamond_helmet - - netherite_helmet - - chestplate: - - leather_chestplate - - chainmail_chestplate - - iron_chestplate - - golden_chestplate - - diamond_chestplate - - netherite_chestplate - - leggings: - - leather_leggings - - chainmail_leggings - - iron_leggings - - golden_leggings - - diamond_leggings - - netherite_leggings - - boots: - - leather_boots - - chainmail_boots - - iron_boots - - golden_boots - - diamond_boots - - netherite_boots - - elytra: - - elytra - - bow: - - bow - - crossbow: - - crossbow - - shears: - - shears - - trident: - - trident - - shield: - - shield - - rod: - - fishing_rod - - flintandsteel: - - flint_and_steel - - carrot_stick: - - carrot_on_a_stick diff --git a/eco-core/core-proxy/build.gradle b/eco-core/core-proxy/build.gradle deleted file mode 100644 index 3f90b631..00000000 --- a/eco-core/core-proxy/build.gradle +++ /dev/null @@ -1,6 +0,0 @@ -group 'com.willfp' -version rootProject.version - -dependencies { - compileOnly 'org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT' -} \ No newline at end of file diff --git a/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/FastGetEnchantsProxy.java b/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/FastGetEnchantsProxy.java deleted file mode 100644 index 2963cb10..00000000 --- a/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/FastGetEnchantsProxy.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.willfp.ecoenchants.proxy.proxies; - -import com.willfp.eco.core.proxy.AbstractProxy; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.Map; - -public interface FastGetEnchantsProxy extends AbstractProxy { - /** - * Get all enchantments on an {@link ItemStack}. - * - * @param itemStack The item to query. - * @return A map of all enchantments, where the value represents the level present. - */ - Map getEnchantmentsOnItem(@NotNull ItemStack itemStack); - - /** - * Get the level of a specified enchantment on an item. - * - * @param itemStack The item to query. - * @param enchantment The enchantment to query. - * @return The level found, or 0 if not present. - */ - int getLevelOnItem(@NotNull ItemStack itemStack, - @NotNull Enchantment enchantment); -} diff --git a/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/OpenInventoryProxy.java b/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/OpenInventoryProxy.java deleted file mode 100644 index bfbe404a..00000000 --- a/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/OpenInventoryProxy.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.willfp.ecoenchants.proxy.proxies; - -import com.willfp.eco.core.proxy.AbstractProxy; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public interface OpenInventoryProxy extends AbstractProxy { - /** - * Get the NMS inventory container for a player's inventory view. - * - * @param player The player to query. - * @return The NMS inventory container. - */ - Object getOpenInventory(@NotNull Player player); -} diff --git a/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/RepairCostProxy.java b/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/RepairCostProxy.java deleted file mode 100644 index 98821b08..00000000 --- a/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/RepairCostProxy.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.willfp.ecoenchants.proxy.proxies; - -import com.willfp.eco.core.proxy.AbstractProxy; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public interface RepairCostProxy extends AbstractProxy { - /** - * Set the rework penalty of an item. - * - * @param itemStack The item to query. - * @param cost The rework penalty to set. - * @return The item, with the rework penalty applied. - */ - ItemStack setRepairCost(@NotNull ItemStack itemStack, - int cost); - - /** - * Get the rework penalty of an item. - * - * @param itemStack The item to query. - * @return The rework penalty found on the item. - */ - int getRepairCost(@NotNull ItemStack itemStack); -} diff --git a/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/util/ProxyFactory.java b/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/util/ProxyFactory.java deleted file mode 100644 index d8434e99..00000000 --- a/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/util/ProxyFactory.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.willfp.ecoenchants.proxy.util; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.core.proxy.AbstractProxy; -import com.willfp.eco.core.proxy.ProxyConstants; -import com.willfp.eco.core.proxy.UnsupportedVersionException; -import org.jetbrains.annotations.NotNull; - -import java.util.IdentityHashMap; -import java.util.Map; - -public class ProxyFactory extends PluginDependent { - /** - * Cached proxy implementations in order to not perform expensive reflective class-finding. - */ - private static final Map, AbstractProxy> CACHE = new IdentityHashMap<>(); - - /** - * The class of the proxy interface. - */ - private final Class proxyClass; - - /** - * Create a new Proxy Factory for a specific type. - * - * @param plugin The plugin to create proxies for. - * @param proxyClass The class of the proxy interface. - */ - public ProxyFactory(@NotNull final EcoPlugin plugin, - @NotNull final Class proxyClass) { - super(plugin); - this.proxyClass = proxyClass; - } - - /** - * Get the implementation of a proxy. - * - * @return The proxy implementation. - */ - public @NotNull T getProxy() { - try { - T cachedProxy = attemptCache(); - if (cachedProxy != null) { - return cachedProxy; - } - - String className = this.getPlugin().getProxyPackage() + "." + ProxyConstants.NMS_VERSION + "." + proxyClass.getSimpleName().replace("Proxy", ""); - final Class class2 = Class.forName(className); - Object instance = class2.getConstructor().newInstance(); - if (proxyClass.isAssignableFrom(class2) && proxyClass.isInstance(instance)) { - T proxy = proxyClass.cast(instance); - CACHE.put(proxyClass, proxy); - return proxy; - } - } catch (Exception e) { - // If not returned, then throw error - } - - throw new UnsupportedVersionException("You're running an unsupported server version: " + ProxyConstants.NMS_VERSION); - } - - private T attemptCache() { - Object proxy = CACHE.get(proxyClass); - if (proxy == null) { - return null; - } - - if (proxyClass.isInstance(proxy)) { - return proxyClass.cast(proxy); - } - - return null; - } -} diff --git a/eco-extensions/alchemy/build.gradle b/eco-extensions/alchemy/build.gradle deleted file mode 100644 index 68da73c8..00000000 --- a/eco-extensions/alchemy/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.0.0' -description = 'Alchemy Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/Alchemy.java b/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/Alchemy.java deleted file mode 100644 index 814587cc..00000000 --- a/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/Alchemy.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.willfp.ecoenchants.alchemy; - - -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.LivingEntity; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityPotionEffectEvent; -import org.bukkit.metadata.FixedMetadataValue; -import org.bukkit.potion.PotionEffect; -import org.jetbrains.annotations.NotNull; - -public class Alchemy extends EcoEnchant { - /** - * true Metadata key. - */ - private final FixedMetadataValue metaKeyTrue = this.getPlugin().getMetadataValueFactory().create(true); - - /** - * Instantiate Alchemy Enchantment. - */ - public Alchemy() { - super("alchemy", EnchantmentType.NORMAL); - } - - /** - * Enchantment functionality. - * - * @param event The event to listen for. - */ - @EventHandler - public void onPotionEffect(@NotNull final EntityPotionEffectEvent event) { - if (event.getNewEffect() == null) { - return; - } - if (!(event.getEntity() instanceof LivingEntity)) { - return; - } - - LivingEntity entity = (LivingEntity) event.getEntity(); - - if (entity.hasMetadata(event.getNewEffect().toString())) { - return; - } - - int level = EnchantChecks.getArmorPoints(entity, this); - if (level == 0) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - if (this.getDisabledWorlds().contains(entity.getWorld())) { - return; - } - - PotionEffect effect = event.getNewEffect(); - - PotionEffect newEffect = new PotionEffect( - effect.getType(), - effect.getDuration(), - ((effect.getAmplifier() + 1) * 2) - 1, - effect.isAmbient(), - effect.hasParticles(), - effect.hasIcon() - ); - - entity.setMetadata(newEffect.toString(), metaKeyTrue); - - entity.removePotionEffect(effect.getType()); - - this.getPlugin().getScheduler().run(() -> newEffect.apply(entity)); - - this.getPlugin().getScheduler().runLater(() -> entity.removeMetadata(newEffect.toString(), this.getPlugin()), 1); - } -} diff --git a/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/AlchemyMain.java b/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/AlchemyMain.java deleted file mode 100644 index 618131d1..00000000 --- a/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/AlchemyMain.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.willfp.ecoenchants.alchemy; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class AlchemyMain extends Extension { - /** - * Alchemy enchantment. - */ - public static final EcoEnchant ALCHEMY = new Alchemy(); - - public AlchemyMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/alchemy/src/main/resources/enchants/normal/alchemy.yml b/eco-extensions/alchemy/src/main/resources/enchants/normal/alchemy.yml deleted file mode 100644 index 9897e632..00000000 --- a/eco-extensions/alchemy/src/main/resources/enchants/normal/alchemy.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Alchemy EcoEnchant -# - -name: "Alchemy" -description: Chance to double the strength of potions -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 4 \ No newline at end of file diff --git a/eco-extensions/alchemy/src/main/resources/extension.yml b/eco-extensions/alchemy/src/main/resources/extension.yml deleted file mode 100644 index 1841ccf3..00000000 --- a/eco-extensions/alchemy/src/main/resources/extension.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: Alchemy -main: com.willfp.ecoenchants.alchemy.AlchemyMain -version: ${projectVersion} \ No newline at end of file diff --git a/eco-extensions/biomes/build.gradle b/eco-extensions/biomes/build.gradle deleted file mode 100644 index 92604536..00000000 --- a/eco-extensions/biomes/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.0.0' -description = 'Biomes Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/BiomesEnchantment.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/BiomesEnchantment.java deleted file mode 100644 index 66b239ee..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/BiomesEnchantment.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.willfp.ecoenchants.biomes; - -import com.willfp.eco.core.Prerequisite; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public abstract class BiomesEnchantment extends EcoEnchant { - private static final String MULTIPLIER_KEY = "multiplier"; - - protected BiomesEnchantment(@NotNull final String key, - @NotNull final EnchantmentType type, - @NotNull final Prerequisite... prerequisites) { - super(key, type, prerequisites); - } - - public abstract boolean isValid(@NotNull Biome biome); - - private boolean isInBiome(@NotNull final LivingEntity entity) { - Biome entityBiome = entity.getLocation().getBlock().getBiome(); - return isValid(entityBiome); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!isInBiome(attacker)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + MULTIPLIER_KEY); - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } - - @Override - public void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - if (!isInBiome(victim)) { - return; - } - - double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "reduction-per-level"); - double multiplier = 1 - ((reduction / 100) * level); - event.setDamage(event.getDamage() * multiplier); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!isInBiome(attacker)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + MULTIPLIER_KEY); - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!isInBiome(attacker)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + MULTIPLIER_KEY); - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/BiomesMain.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/BiomesMain.java deleted file mode 100644 index 2449800d..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/BiomesMain.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.willfp.ecoenchants.biomes; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.biomes.enchants.defensive.Elevation; -import com.willfp.ecoenchants.biomes.enchants.defensive.Glacial; -import com.willfp.ecoenchants.biomes.enchants.defensive.HeatTreated; -import com.willfp.ecoenchants.biomes.enchants.defensive.Oceanic; -import com.willfp.ecoenchants.biomes.enchants.defensive.Tropical; -import com.willfp.ecoenchants.biomes.enchants.offensive.Altitude; -import com.willfp.ecoenchants.biomes.enchants.offensive.Aquamarine; -import com.willfp.ecoenchants.biomes.enchants.offensive.Dehydration; -import com.willfp.ecoenchants.biomes.enchants.offensive.Icelord; -import com.willfp.ecoenchants.biomes.enchants.offensive.Rainforest; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class BiomesMain extends Extension { - public static final EcoEnchant ELEVATION = new Elevation(); - public static final EcoEnchant GLACIAL = new Glacial(); - public static final EcoEnchant HEAT_TREATED = new HeatTreated(); - public static final EcoEnchant OCEANIC = new Oceanic(); - public static final EcoEnchant TROPICAL = new Tropical(); - public static final EcoEnchant ALTITUDE = new Altitude(); - public static final EcoEnchant AQUAMARINE = new Aquamarine(); - public static final EcoEnchant DEHYDRATION = new Dehydration(); - public static final EcoEnchant ICELORD = new Icelord(); - public static final EcoEnchant RAINFOREST = new Rainforest(); - - public BiomesMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Elevation.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Elevation.java deleted file mode 100644 index 93a19546..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Elevation.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.defensive; - - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Elevation extends BiomesEnchantment { - public Elevation() { - super("elevation", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"mountain", "hill"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Glacial.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Glacial.java deleted file mode 100644 index e098c54a..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Glacial.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.defensive; - - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Glacial extends BiomesEnchantment { - public Glacial() { - super("glacial", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"snowy", "ice", "frozen"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/HeatTreated.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/HeatTreated.java deleted file mode 100644 index d5124e9b..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/HeatTreated.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.defensive; - - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class HeatTreated extends BiomesEnchantment { - public HeatTreated() { - super("heat_treated", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"desert", "badlands", "savanna"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Oceanic.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Oceanic.java deleted file mode 100644 index 5e7dd109..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Oceanic.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.defensive; - - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Oceanic extends BiomesEnchantment { - public Oceanic() { - super("oceanic", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"ocean"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Tropical.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Tropical.java deleted file mode 100644 index 09772f6c..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Tropical.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.defensive; - - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Tropical extends BiomesEnchantment { - public Tropical() { - super("tropical", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"jungle"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Altitude.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Altitude.java deleted file mode 100644 index 6f7e5de1..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Altitude.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.offensive; - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Altitude extends BiomesEnchantment { - /** - * Instantiate enchantment. - */ - public Altitude() { - super("altitude", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"mountain", "hill"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Aquamarine.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Aquamarine.java deleted file mode 100644 index c70ac50f..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Aquamarine.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.offensive; - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Aquamarine extends BiomesEnchantment { - /** - * Instantiate enchantment. - */ - public Aquamarine() { - super("aquamarine", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"ocean"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Dehydration.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Dehydration.java deleted file mode 100644 index 3a788e38..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Dehydration.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.offensive; - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Dehydration extends BiomesEnchantment { - public Dehydration() { - super("dehydration", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"desert", "badlands", "savanna"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Icelord.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Icelord.java deleted file mode 100644 index ae29de91..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Icelord.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.offensive; - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Icelord extends BiomesEnchantment { - public Icelord() { - super("icelord", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"snowy", "ice", "frozen"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Rainforest.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Rainforest.java deleted file mode 100644 index 12439d1c..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Rainforest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.offensive; - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Rainforest extends BiomesEnchantment { - public Rainforest() { - super("rainforest", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"jungle"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/altitude.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/altitude.yml deleted file mode 100644 index ea38af7c..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/altitude.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Altitude EcoEnchant -# - -name: "Altitude" -description: Deal more damage in hilly biomes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - bow - - crossbow - - sword - - axe - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - aquamarine - - dehydration - - icelord - - rainforest - maximum-level: 6 - -config: - multiplier: 0.03 \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/aquamarine.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/aquamarine.yml deleted file mode 100644 index 1617e71f..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/aquamarine.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Aquamarine EcoEnchant -# - -name: "Aquamarine" -description: Deal more damage in oceans. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - bow - - crossbow - - sword - - axe - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - altitude - - dehydration - - icelord - - rainforest - maximum-level: 6 - -config: - multiplier: 0.03 \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/dehydration.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/dehydration.yml deleted file mode 100644 index 1d9ccbbd..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/dehydration.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Dehydration EcoEnchant -# - -name: "Dehydration" -description: Deal more damage in hot biomes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - bow - - crossbow - - sword - - axe - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - altitude - - aquamarine - - icelord - - rainforest - maximum-level: 6 - -config: - multiplier: 0.03 \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/elevation.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/elevation.yml deleted file mode 100644 index 6ec6c030..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/elevation.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Elevation EcoEnchant -# - -name: "Elevation" -description: Take less damage in hilly biomes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - glacial - - heat_treated - - oceanic - - tropical - maximum-level: 3 - -config: - reduction-per-level: 2 # As percentage \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/glacial.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/glacial.yml deleted file mode 100644 index b036d84f..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/glacial.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Glacial EcoEnchant -# - -name: "Glacial" -description: Take less damage in cold biomes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - elevation - - heat_treated - - oceanic - - tropical - maximum-level: 3 - -config: - reduction-per-level: 2 # As percentage \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/heattreated.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/heattreated.yml deleted file mode 100644 index 8b0cc4c2..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/heattreated.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Heat Treated EcoEnchant -# - -name: "Heat Treated" -description: Take less damage in hot biomes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - elevation - - glacial - - oceanic - - tropical - maximum-level: 3 - -config: - reduction-per-level: 2 # As percentage \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/icelord.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/icelord.yml deleted file mode 100644 index 669ab4c3..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/icelord.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Icelord EcoEnchant -# - -name: "Icelord" -description: Deal more damage in cold biomes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - bow - - crossbow - - sword - - axe - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - altitide - - aquamarine - - dehydration - - rainforest - maximum-level: 6 - -config: - multiplier: 0.03 \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/oceanic.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/oceanic.yml deleted file mode 100644 index ffba2b9f..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/oceanic.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Oceanic EcoEnchant -# - -name: "Oceanic" -description: Take less damage in oceans. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - elevation - - glacial - - heat_treated - - tropical - maximum-level: 3 - -config: - reduction-per-level: 2 # As percentage \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/rainforest.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/rainforest.yml deleted file mode 100644 index 8e299bbb..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/rainforest.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Rainforest EcoEnchant -# - -name: "Rainforest" -description: Deal more damage in jungles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - bow - - crossbow - - sword - - axe - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - altitude - - aquamarine - - dehydration - - icelord - maximum-level: 6 - -config: - multiplier: 0.03 \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/tropical.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/tropical.yml deleted file mode 100644 index 71431756..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/tropical.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Tropical EcoEnchant -# - -name: "Tropical" -description: Take less damage in jungles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - elevation - - glacial - - heat_treated - - oceanic - maximum-level: 3 - -config: - reduction-per-level: 2 # As percentage \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/extension.yml b/eco-extensions/biomes/src/main/resources/extension.yml deleted file mode 100644 index 2bc26774..00000000 --- a/eco-extensions/biomes/src/main/resources/extension.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: Biomes -main: com.willfp.ecoenchants.biomes.BiomesMain -version: ${projectVersion} \ No newline at end of file diff --git a/eco-extensions/build.gradle b/eco-extensions/build.gradle deleted file mode 100644 index 8437aeaf..00000000 --- a/eco-extensions/build.gradle +++ /dev/null @@ -1,16 +0,0 @@ -group 'com.willfp' -description = 'Extension Parent' - -subprojects { - dependencies { - compileOnly project(":eco-core:core-plugin") - compileOnly project(":eco-core:core-proxy") - compileOnly 'org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT' - } - - tasks.withType(Jar) { - destinationDirectory = file("$rootDir/bin/") - } - - tasks.jar.enabled = false -} \ No newline at end of file diff --git a/eco-extensions/effects/build.gradle b/eco-extensions/effects/build.gradle deleted file mode 100644 index b5891acc..00000000 --- a/eco-extensions/effects/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.0.0' -description = 'Effects Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/EffectsEnchantment.java b/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/EffectsEnchantment.java deleted file mode 100644 index 4e55d6d0..00000000 --- a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/EffectsEnchantment.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.willfp.ecoenchants.effects; - -import com.willfp.eco.core.Prerequisite; -import com.willfp.eco.core.events.ArmorEquipEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -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.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public abstract class EffectsEnchantment extends EcoEnchant { - protected EffectsEnchantment(@NotNull final String key, - @NotNull final EnchantmentType type, - @NotNull final Prerequisite... prerequisites) { - super(key, type, prerequisites); - } - - public abstract PotionEffectType getPotionEffect(); - - @EventHandler - public void onEquip(@NotNull final ArmorEquipEvent event) { - final Player player = event.getPlayer(); - - this.getPlugin().getScheduler().runLater(() -> { - if (player.hasPotionEffect(this.getPotionEffect()) && player.getPotionEffect(this.getPotionEffect()).getDuration() >= 1639) { - player.removePotionEffect(this.getPotionEffect()); - } - - int level = EnchantChecks.getArmorPoints(player, this); - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - if (level > 0) { - player.addPotionEffect(new PotionEffect(this.getPotionEffect(), 0x6fffffff, level - 1, false, false, true)); - } - }, 1); - } -} diff --git a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/EffectsMain.java b/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/EffectsMain.java deleted file mode 100644 index 9c8a5a52..00000000 --- a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/EffectsMain.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.effects; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.effects.enchants.JumpBoost; -import com.willfp.ecoenchants.effects.enchants.NightVision; -import com.willfp.ecoenchants.effects.enchants.Regeneration; -import com.willfp.ecoenchants.effects.enchants.Speed; -import com.willfp.ecoenchants.effects.enchants.WaterBreathing; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class EffectsMain extends Extension { - public static final EcoEnchant JUMP_BOOST = new JumpBoost(); - public static final EcoEnchant NIGHT_VISION = new NightVision(); - public static final EcoEnchant REGENERATION = new Regeneration(); - public static final EcoEnchant SPEED = new Speed(); - public static final EcoEnchant WATER_BREATHING = new WaterBreathing(); - - public EffectsMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/JumpBoost.java b/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/JumpBoost.java deleted file mode 100644 index 03091f03..00000000 --- a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/JumpBoost.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.willfp.ecoenchants.effects.enchants; - -import com.willfp.ecoenchants.effects.EffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class JumpBoost extends EffectsEnchantment { - public JumpBoost() { - super("jump_boost", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType getPotionEffect() { - return PotionEffectType.JUMP; - } -} diff --git a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/NightVision.java b/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/NightVision.java deleted file mode 100644 index 5a554089..00000000 --- a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/NightVision.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.willfp.ecoenchants.effects.enchants; - -import com.willfp.ecoenchants.effects.EffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class NightVision extends EffectsEnchantment { - public NightVision() { - super("night_vision", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType getPotionEffect() { - return PotionEffectType.NIGHT_VISION; - } -} diff --git a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/Regeneration.java b/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/Regeneration.java deleted file mode 100644 index f3e218e0..00000000 --- a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/Regeneration.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.willfp.ecoenchants.effects.enchants; - -import com.willfp.ecoenchants.effects.EffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class Regeneration extends EffectsEnchantment { - public Regeneration() { - super("regeneration", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType getPotionEffect() { - return PotionEffectType.REGENERATION; - } -} diff --git a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/Speed.java b/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/Speed.java deleted file mode 100644 index 53e2a3ea..00000000 --- a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/Speed.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.willfp.ecoenchants.effects.enchants; - -import com.willfp.ecoenchants.effects.EffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class Speed extends EffectsEnchantment { - public Speed() { - super("speed", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType getPotionEffect() { - return PotionEffectType.SPEED; - } -} diff --git a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/WaterBreathing.java b/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/WaterBreathing.java deleted file mode 100644 index 02637995..00000000 --- a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/WaterBreathing.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.willfp.ecoenchants.effects.enchants; - -import com.willfp.ecoenchants.effects.EffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class WaterBreathing extends EffectsEnchantment { - public WaterBreathing() { - super("water_breathing", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType getPotionEffect() { - return PotionEffectType.WATER_BREATHING; - } -} diff --git a/eco-extensions/effects/src/main/resources/enchants/normal/jumpboost.yml b/eco-extensions/effects/src/main/resources/enchants/normal/jumpboost.yml deleted file mode 100644 index abc42f1c..00000000 --- a/eco-extensions/effects/src/main/resources/enchants/normal/jumpboost.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Jump Boost EcoEnchant -# - -name: "Jump Boost" -description: Gives you permanent jump boost. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - spring - maximum-level: 3 - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-extensions/effects/src/main/resources/enchants/normal/nightvision.yml b/eco-extensions/effects/src/main/resources/enchants/normal/nightvision.yml deleted file mode 100644 index 4fe5cdb5..00000000 --- a/eco-extensions/effects/src/main/resources/enchants/normal/nightvision.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Night Vision EcoEnchant -# - -name: "Night Vision" -description: Gives you permanent night vision. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 1 - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-extensions/effects/src/main/resources/enchants/normal/regeneration.yml b/eco-extensions/effects/src/main/resources/enchants/normal/regeneration.yml deleted file mode 100644 index a676e695..00000000 --- a/eco-extensions/effects/src/main/resources/enchants/normal/regeneration.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Regeneration EcoEnchant -# - -name: "Regeneration" -description: Gives you permanent regeneration. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 2 - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-extensions/effects/src/main/resources/enchants/normal/speed.yml b/eco-extensions/effects/src/main/resources/enchants/normal/speed.yml deleted file mode 100644 index 714042ff..00000000 --- a/eco-extensions/effects/src/main/resources/enchants/normal/speed.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Speed EcoEnchant -# - -name: "Speed" -description: Gives you permanent speed. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - streamlining - maximum-level: 3 - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-extensions/effects/src/main/resources/enchants/normal/waterbreathing.yml b/eco-extensions/effects/src/main/resources/enchants/normal/waterbreathing.yml deleted file mode 100644 index 122233e9..00000000 --- a/eco-extensions/effects/src/main/resources/enchants/normal/waterbreathing.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Water Breathing EcoEnchant -# - -name: "Water Breathing" -description: Gives you permanent water breathing. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 1 - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-extensions/effects/src/main/resources/extension.yml b/eco-extensions/effects/src/main/resources/extension.yml deleted file mode 100644 index ad894c60..00000000 --- a/eco-extensions/effects/src/main/resources/extension.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: Effects -main: com.willfp.ecoenchants.effects.EffectsMain -version: ${projectVersion} \ No newline at end of file diff --git a/eco-extensions/endershot/build.gradle b/eco-extensions/endershot/build.gradle deleted file mode 100644 index c052b8eb..00000000 --- a/eco-extensions/endershot/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.0.0' -description = 'Endershot Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/endershot/src/main/java/com/willfp/ecoenchants/endershot/Endershot.java b/eco-extensions/endershot/src/main/java/com/willfp/ecoenchants/endershot/Endershot.java deleted file mode 100644 index 54dedc51..00000000 --- a/eco-extensions/endershot/src/main/java/com/willfp/ecoenchants/endershot/Endershot.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.willfp.ecoenchants.endershot; - -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 org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.SoundCategory; -import org.bukkit.entity.EnderPearl; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public class Endershot extends EcoEnchant { - public Endershot() { - super("endershot", EnchantmentType.NORMAL); - } - - @EventHandler(priority = EventPriority.LOW) - public void onBowShoot(@NotNull final EntityShootBowEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - if (event.getProjectile().getType() != EntityType.ARROW) { - return; - } - if (!(event.getEntity() instanceof Player)) { - return; - } - - Player player = (Player) event.getEntity(); - - if (!player.isSneaking()) { - return; - } - - event.setCancelled(true); - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!player.getInventory().contains(Material.ENDER_PEARL, 1) && !player.getGameMode().equals(GameMode.CREATIVE)) { - return; - } - - boolean hasInfinity = EnchantChecks.mainhand(player, ARROW_INFINITE) && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "work-with-infinity"); - if (!hasInfinity) { - ItemStack pearl = new ItemStack(Material.ENDER_PEARL, 1); - player.getInventory().remove(pearl); - } - - EnderPearl pearl = player.launchProjectile(EnderPearl.class); - pearl.setShooter(player); - pearl.setVelocity(event.getProjectile().getVelocity()); - player.playSound(player.getLocation(), Sound.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1f, 1f); - } -} diff --git a/eco-extensions/endershot/src/main/java/com/willfp/ecoenchants/endershot/EndershotMain.java b/eco-extensions/endershot/src/main/java/com/willfp/ecoenchants/endershot/EndershotMain.java deleted file mode 100644 index 94e578a8..00000000 --- a/eco-extensions/endershot/src/main/java/com/willfp/ecoenchants/endershot/EndershotMain.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.endershot; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class EndershotMain extends Extension { - public static final EcoEnchant ENDERSHOT = new Endershot(); - - public EndershotMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/endershot/src/main/resources/enchants/normal/endershot.yml b/eco-extensions/endershot/src/main/resources/enchants/normal/endershot.yml deleted file mode 100644 index bf9c02ff..00000000 --- a/eco-extensions/endershot/src/main/resources/enchants/normal/endershot.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Endershot EcoEnchant -# - -name: "Endershot" -description: Shoot ender pearls out of your bow while crouching -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 1 - -config: - work-with-infinity: true # Don't consume ender pearls when enchanted with infinity \ No newline at end of file diff --git a/eco-extensions/endershot/src/main/resources/extension.yml b/eco-extensions/endershot/src/main/resources/extension.yml deleted file mode 100644 index 97574753..00000000 --- a/eco-extensions/endershot/src/main/resources/extension.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: Endershot -main: com.willfp.ecoenchants.endershot.EndershotMain -version: ${projectVersion} diff --git a/eco-extensions/firewand/build.gradle b/eco-extensions/firewand/build.gradle deleted file mode 100644 index 177e290f..00000000 --- a/eco-extensions/firewand/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.0.0' -description = 'Firewand Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/firewand/src/main/java/com/willfp/ecoenchants/firewand/Firewand.java b/eco-extensions/firewand/src/main/java/com/willfp/ecoenchants/firewand/Firewand.java deleted file mode 100644 index 3243550a..00000000 --- a/eco-extensions/firewand/src/main/java/com/willfp/ecoenchants/firewand/Firewand.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.willfp.ecoenchants.firewand; - - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import org.bukkit.entity.Player; -import org.bukkit.entity.SmallFireball; -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 Firewand extends Spell { - public Firewand() { - super("firewand"); - } - - @Override - public boolean onUse(@NotNull final Player player, - final int level, - @NotNull final PlayerInteractEvent event) { - SmallFireball fireball = player.launchProjectile(SmallFireball.class, player.getEyeLocation().getDirection().multiply(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity"))); - fireball.setIsIncendiary(this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "fire")); - fireball.setMetadata("eco-damage", this.getPlugin().getMetadataValueFactory().create(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * level)); - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "no-explode")) { - fireball.setMetadata("nobreak", this.getPlugin().getMetadataValueFactory().create(true)); - } - fireball.setShooter(player); - - return true; - } - - @EventHandler(priority = EventPriority.LOW) - public void onFireballDamage(@NotNull final EntityDamageByEntityEvent event) { - if (!(event.getDamager() instanceof SmallFireball)) { - return; - } - if (event.getDamager().getMetadata("eco-damage").isEmpty()) { - return; - } - - double multiplier = event.getDamager().getMetadata("eco-damage").get(0).asDouble(); - - event.setDamage(multiplier); - } - - @EventHandler - public void onFireballExplode(@NotNull final EntityExplodeEvent event) { - if (!(event.getEntity() instanceof SmallFireball)) { - return; - } - if (event.getEntity().getMetadata("nobreak").isEmpty()) { - return; - } - - event.setCancelled(true); - } -} diff --git a/eco-extensions/firewand/src/main/java/com/willfp/ecoenchants/firewand/FirewandMain.java b/eco-extensions/firewand/src/main/java/com/willfp/ecoenchants/firewand/FirewandMain.java deleted file mode 100644 index 25792316..00000000 --- a/eco-extensions/firewand/src/main/java/com/willfp/ecoenchants/firewand/FirewandMain.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.firewand; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class FirewandMain extends Extension { - public static final EcoEnchant FIREWAND = new Firewand(); - - public FirewandMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/firewand/src/main/resources/enchants/spell/firewand.yml b/eco-extensions/firewand/src/main/resources/enchants/spell/firewand.yml deleted file mode 100644 index 028b1a5c..00000000 --- a/eco-extensions/firewand/src/main/resources/enchants/spell/firewand.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Firewand EcoEnchant -# - -name: "Firewand" -description: Shoots a fireball -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - rod - - carrot_stick - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - activation-sound: ENTITY_GHAST_SHOOT - cooldown: 60 # In seconds - velocity: 3 - fire: true - damage-per-level: 8 - no-explode: false # Don't explode \ No newline at end of file diff --git a/eco-extensions/firewand/src/main/resources/extension.yml b/eco-extensions/firewand/src/main/resources/extension.yml deleted file mode 100644 index 55f69765..00000000 --- a/eco-extensions/firewand/src/main/resources/extension.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: Firewand -main: com.willfp.ecoenchants.firewand.FirewandMain -version: ${projectVersion} \ No newline at end of file diff --git a/eco-extensions/mmo/build.gradle b/eco-extensions/mmo/build.gradle deleted file mode 100644 index a09a8ddd..00000000 --- a/eco-extensions/mmo/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -group 'com.willfp' -version '5.0.0' -description = 'MMO Extension' - -repositories { - maven { - url 'https://mvn.lumine.io/repository/maven-public/' - } -} - -dependencies { - compileOnly 'net.Indyuce:MMOCore:1.7.0' - compileOnly 'net.Indyuce:MMOItems:6.5.4' - compileOnly 'net.Indyuce:MMOLib:1.7.3' -} - -configurations.all { - exclude group: 'com.mojang', module: 'authlib' - exclude group: 'org.kitteh.pastegg' -} - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/MMOMain.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/MMOMain.java deleted file mode 100644 index f8720be1..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/MMOMain.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.willfp.ecoenchants.mmo; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.mmo.enchants.abilities.Discounted; -import com.willfp.ecoenchants.mmo.enchants.abilities.Recover; -import com.willfp.ecoenchants.mmo.enchants.mana.Augment; -import com.willfp.ecoenchants.mmo.enchants.mana.Drain; -import com.willfp.ecoenchants.mmo.enchants.mana.Elixir; -import com.willfp.ecoenchants.mmo.enchants.mana.Siphon; -import com.willfp.ecoenchants.mmo.enchants.mana.Spirituality; -import com.willfp.ecoenchants.mmo.enchants.misc.Strengthening; -import com.willfp.ecoenchants.mmo.enchants.stamina.Athletic; -import com.willfp.ecoenchants.mmo.enchants.stamina.Endurance; -import com.willfp.ecoenchants.mmo.enchants.stamina.Fortitude; -import com.willfp.ecoenchants.mmo.enchants.stamina.Motivate; -import org.bukkit.Bukkit; -import org.jetbrains.annotations.NotNull; - -public class MMOMain extends Extension { - public static final EcoEnchant ELIXIR = new Elixir(); - public static final EcoEnchant SIPHON = new Siphon(); - public static final EcoEnchant DRAIN = new Drain(); - public static final EcoEnchant SPIRITUALITY = new Spirituality(); - public static final EcoEnchant AUGMENT = new Augment(); - public static final EcoEnchant DISCOUNTED = new Discounted(); - public static final EcoEnchant RECOVER = new Recover(); - public static final EcoEnchant ENDURANCE = new Endurance(); - public static final EcoEnchant FORTITUDE = new Fortitude(); - public static final EcoEnchant MOTIVATE = new Motivate(); - public static final EcoEnchant ATHLETIC = new Athletic(); - public static final EcoEnchant STRENGTHENING = new Strengthening(); - - public MMOMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - protected void onEnable() { - if (!MMOPrerequisites.HAS_MMOCORE.isMet()) { - Bukkit.getLogger().severe("MMO Extension requires MMOCore to be installed!"); - Bukkit.getLogger().severe("Disabling..."); - this.disable(); - } - } - - @Override - protected void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/MMOPrerequisites.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/MMOPrerequisites.java deleted file mode 100644 index 934a88c8..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/MMOPrerequisites.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.willfp.ecoenchants.mmo; - -import com.willfp.eco.core.Prerequisite; -import org.bukkit.Bukkit; -import org.bukkit.plugin.Plugin; - -import java.util.Arrays; -import java.util.Set; -import java.util.stream.Collectors; - -public class MMOPrerequisites { - private static final Set enabledPlugins = Arrays.stream(Bukkit.getPluginManager().getPlugins()).map(Plugin::getName).collect(Collectors.toSet()); - - public static final Prerequisite HAS_MMOCORE = new Prerequisite( - () -> enabledPlugins.contains("MMOCore"), - "Has mmocore installed" - ); - public static final Prerequisite HAS_MMOITEMS = new Prerequisite( - () -> enabledPlugins.contains("MMOItems"), - "Has mmoitems installed" - ); - - public static Prerequisite[] append(Prerequisite[] array, Prerequisite newElement) { - Prerequisite[] copy = new Prerequisite[array.length + 1]; - System.arraycopy(array, 0, copy, 0, array.length); - copy[array.length] = newElement; - return copy; - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/abilities/Discounted.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/abilities/Discounted.java deleted file mode 100644 index adeedab3..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/abilities/Discounted.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.abilities; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.mmo.MMOPrerequisites; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import net.Indyuce.mmoitems.api.event.AbilityUseEvent; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - -public class Discounted extends MMOEnchantment { - public Discounted() { - super("discounted", EnchantmentType.NORMAL, MMOPrerequisites.HAS_MMOITEMS); - } - - @EventHandler - public void onAbility(AbilityUseEvent event) { - Player player = event.getPlayer(); - - if (!EnchantChecks.mainhand(player, this)) - return; - - int level = EnchantChecks.getMainhandLevel(player, this); - - double cost = event.getAbility().getModifier("mana"); - if (cost == 0.0D) return; - - double multiplier = 1 - (this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * level); - cost *= multiplier; - - event.getAbility().setModifier("mana", cost); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/abilities/Recover.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/abilities/Recover.java deleted file mode 100644 index 40488adf..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/abilities/Recover.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.abilities; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.mmo.MMOPrerequisites; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import net.Indyuce.mmoitems.api.event.AbilityUseEvent; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - -public class Recover extends MMOEnchantment { - public Recover() { - super("recover", EnchantmentType.NORMAL, MMOPrerequisites.HAS_MMOITEMS); - } - - @EventHandler - public void onAbility(AbilityUseEvent event) { - Player player = event.getPlayer(); - - if (!EnchantChecks.mainhand(player, this)) - return; - - int level = EnchantChecks.getMainhandLevel(player, this); - - double cooldown = event.getAbility().getModifier("cooldown"); - - if (cooldown == 0.0D) return; - - double multiplier = 1 - (this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * level); - cooldown *= multiplier; - - event.getAbility().setModifier("cooldown", cooldown); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Augment.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Augment.java deleted file mode 100644 index 58b45105..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Augment.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.mana; - -import com.willfp.eco.core.events.ArmorEquipEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import net.mmogroup.mmolib.MMOLib; -import net.mmogroup.mmolib.api.player.MMOPlayerData; -import net.mmogroup.mmolib.api.stat.SharedStat; -import net.mmogroup.mmolib.api.stat.modifier.StatModifier; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public class Augment extends MMOEnchantment { - private static final String KEY = "ecoenchants_bonus_mana"; - - public Augment() { - super("augment", EnchantmentType.NORMAL); - } - - @Override - public void onArmorEquip(@NotNull Player player, int level, @NotNull ArmorEquipEvent event) { - MMOPlayerData data = MMOPlayerData.get(player); - - data.getStatMap().getInstance(SharedStat.MAX_MANA).remove(KEY); - - if (level == 0) { - MMOLib.plugin.getStats().runUpdates(data.getStatMap()); - return; - } - - int mana = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "mana-per-level") * level; - - data.getStatMap().getInstance(SharedStat.MAX_MANA).addModifier(KEY, new StatModifier(mana)); - - MMOLib.plugin.getStats().runUpdates(data.getStatMap()); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Drain.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Drain.java deleted file mode 100644 index 8a1405ea..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Drain.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.mana; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.mmo.integrations.mmo.MMOManager; -import com.willfp.ecoenchants.mmo.structure.MMOSpell; -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerInteractEvent; - -public class Drain extends MMOSpell { - public Drain() { - super("drain"); - } - - @Override - public boolean onUse(Player player, int level, PlayerInteractEvent event) { - double radius = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-per-level") * level; - double amount = 1 - ((this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percentage-per-level") / 100) * level); - - player.getNearbyEntities(radius, radius, radius).forEach(entity -> { - if (!(entity instanceof Player)) - return; - - Player victim = (Player) entity; - MMOManager.setMana(victim, MMOManager.getMana(player) * amount); - }); - - return true; - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Elixir.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Elixir.java deleted file mode 100644 index ff2a1c15..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Elixir.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.mana; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import com.willfp.ecoenchants.mmo.integrations.mmo.MMOManager; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Elixir extends MMOEnchantment { - public Elixir() { - super("elixir", EnchantmentType.NORMAL); - } - - @Override - public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) { - if (!(attacker instanceof Player && victim instanceof Player)) - return; - Player pAttacker = (Player) attacker; - Player pVictim = (Player) victim; - - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - double victimMana = MMOManager.getMana(pVictim); - - double quantity = (this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percentage-per-level") / 100) * level; - - double toSteal = victimMana * quantity; - - MMOManager.setMana(pVictim, victimMana - toSteal); - MMOManager.giveMana(pAttacker, toSteal); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Siphon.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Siphon.java deleted file mode 100644 index 2805ebfd..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Siphon.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.mana; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.mmo.integrations.mmo.MMOManager; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -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 Siphon extends MMOEnchantment { - public Siphon() { - super("siphon", EnchantmentType.NORMAL); - } - - @Override - public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) { - if (!(attacker instanceof Player && victim instanceof Player)) - return; - Player pAttacker = (Player) attacker; - Player pVictim = (Player) victim; - - double victimMana = MMOManager.getMana(pVictim); - - double quantity = (this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percentage-per-level") / 100) * level; - - double toSteal = victimMana * quantity; - - MMOManager.setMana(pVictim, victimMana - toSteal); - MMOManager.giveMana(pAttacker, toSteal); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Spirituality.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Spirituality.java deleted file mode 100644 index 34a99cec..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Spirituality.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.mana; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import net.Indyuce.mmocore.api.event.PlayerRegenResourceEvent; -import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - -public class Spirituality extends MMOEnchantment { - public Spirituality() { - super("spirituality", EnchantmentType.NORMAL); - } - - @EventHandler - public void onRegainMana(PlayerRegenResourceEvent event) { - if (!event.getResource().equals(PlayerResource.MANA)) - return; - - Player player = event.getPlayer(); - - int levels = EnchantChecks.getArmorPoints(player, this); - if (levels == 0) return; - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * levels; - event.setAmount(event.getAmount() * (multiplier + 1)); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/misc/Strengthening.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/misc/Strengthening.java deleted file mode 100644 index 0e46365e..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/misc/Strengthening.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.misc; - -import com.willfp.eco.core.events.ArmorEquipEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import net.mmogroup.mmolib.MMOLib; -import net.mmogroup.mmolib.api.player.MMOPlayerData; -import net.mmogroup.mmolib.api.stat.SharedStat; -import net.mmogroup.mmolib.api.stat.modifier.StatModifier; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public class Strengthening extends MMOEnchantment { - private static final String KEY = "ecoenchants_bonus_strength"; - - public Strengthening() { - super("strengthening", EnchantmentType.NORMAL); - } - - @Override - public void onArmorEquip(@NotNull Player player, int level, @NotNull ArmorEquipEvent event) { - MMOPlayerData data = MMOPlayerData.get(player); - - data.getStatMap().getInstance(SharedStat.ATTACK_DAMAGE).remove(KEY); - - if (level == 0) { - MMOLib.plugin.getStats().runUpdates(data.getStatMap()); - return; - } - - double multiplier = (this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "multiplier") * level) * data.getStatMap().getInstance(SharedStat.ATTACK_DAMAGE).getBase(); - - data.getStatMap().getInstance(SharedStat.ATTACK_DAMAGE).addModifier(KEY, new StatModifier(multiplier)); - - MMOLib.plugin.getStats().runUpdates(data.getStatMap()); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Athletic.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Athletic.java deleted file mode 100644 index e45e1279..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Athletic.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.stamina; - -import com.willfp.eco.core.events.ArmorEquipEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import net.mmogroup.mmolib.MMOLib; -import net.mmogroup.mmolib.api.player.MMOPlayerData; -import net.mmogroup.mmolib.api.stat.SharedStat; -import net.mmogroup.mmolib.api.stat.modifier.StatModifier; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public class Athletic extends MMOEnchantment { - private static final String KEY = "ecoenchants_bonus_stamina"; - - public Athletic() { - super("athletic", EnchantmentType.NORMAL); - } - - @Override - public void onArmorEquip(@NotNull Player player, int level, @NotNull ArmorEquipEvent event) { - MMOPlayerData data = MMOPlayerData.get(player); - - data.getStatMap().getInstance(SharedStat.MAX_STAMINA).remove(KEY); - - if (level == 0) { - MMOLib.plugin.getStats().runUpdates(data.getStatMap()); - return; - } - - int stamina = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "stamina-per-level") * level; - - data.getStatMap().getInstance(SharedStat.MAX_STAMINA).addModifier(KEY, new StatModifier(stamina)); - - MMOLib.plugin.getStats().runUpdates(data.getStatMap()); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Endurance.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Endurance.java deleted file mode 100644 index bb2dfd06..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Endurance.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.stamina; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import net.Indyuce.mmocore.api.event.PlayerRegenResourceEvent; -import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - -public class Endurance extends MMOEnchantment { - public Endurance() { - super("endurance", EnchantmentType.NORMAL); - } - - @EventHandler - public void onRegainMana(PlayerRegenResourceEvent event) { - if (!event.getResource().equals(PlayerResource.STAMINA)) - return; - - Player player = event.getPlayer(); - - int levels = EnchantChecks.getArmorPoints(player, this); - if (levels == 0) return; - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * levels; - event.setAmount(event.getAmount() * (multiplier + 1)); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Fortitude.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Fortitude.java deleted file mode 100644 index bee3bab9..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Fortitude.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.stamina; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.mmo.integrations.mmo.MMOManager; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -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 Fortitude extends MMOEnchantment { - public Fortitude() { - super("fortitude", EnchantmentType.NORMAL); - } - - @Override - public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) { - if (!(attacker instanceof Player && victim instanceof Player)) - return; - Player pAttacker = (Player) attacker; - Player pVictim = (Player) victim; - - double victimStamina = MMOManager.getStamina(pVictim); - - double quantity = (this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percentage-per-level") / 100) * level; - - double toSteal = victimStamina * quantity; - - MMOManager.setStamina(pVictim, victimStamina - toSteal); - MMOManager.giveStamina(pAttacker, toSteal); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Motivate.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Motivate.java deleted file mode 100644 index 5cad4241..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Motivate.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.stamina; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import com.willfp.ecoenchants.mmo.integrations.mmo.MMOManager; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Motivate extends MMOEnchantment { - public Motivate() { - super("motivate", EnchantmentType.NORMAL); - } - - @Override - public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) { - if (!(attacker instanceof Player && victim instanceof Player)) - return; - Player pAttacker = (Player) attacker; - Player pVictim = (Player) victim; - - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - double victimStamina = MMOManager.getStamina(pVictim); - - double quantity = (this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percentage-per-level") / 100) * level; - - double toSteal = victimStamina * quantity; - - MMOManager.setStamina(pVictim, victimStamina - toSteal); - MMOManager.giveStamina(pAttacker, toSteal); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/MMOIntegration.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/MMOIntegration.java deleted file mode 100644 index 16d3cdd0..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/MMOIntegration.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.willfp.ecoenchants.mmo.integrations.mmo; - - -import com.willfp.eco.core.integrations.Integration; -import org.bukkit.entity.Player; - -public interface MMOIntegration extends Integration { - double getMana(Player player); - - void setMana(Player player, double amount); - - double getMaxMana(Player player); - - void giveMana(Player player, double amount); - - double getStamina(Player player); - - void setStamina(Player player, double amount); - - double getMaxStamina(Player player); - - void giveStamina(Player player, double amount); -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/MMOManager.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/MMOManager.java deleted file mode 100644 index ea778cb6..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/MMOManager.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.willfp.ecoenchants.mmo.integrations.mmo; - -import org.bukkit.entity.Player; - -import java.util.HashSet; -import java.util.Set; - -public class MMOManager { - private static final Set integrations = new HashSet<>(); - - public static void register(MMOIntegration integration) { - integrations.add(integration); - } - - private static MMOIntegration getIntegration() { - return integrations.stream().findFirst().get(); - } - - public static double getMana(Player player) { - MMOIntegration integration = getIntegration(); - return integration.getMana(player); - } - - public static double getMaxMana(Player player) { - MMOIntegration integration = getIntegration(); - return integration.getMaxMana(player); - } - - public static void setMana(Player player, double amount) { - MMOIntegration integration = getIntegration(); - integration.setMana(player, amount); - } - - public static void giveMana(Player player, double amount) { - MMOIntegration integration = getIntegration(); - integration.giveMana(player, amount); - } - - public static double getStamina(Player player) { - MMOIntegration integration = getIntegration(); - return integration.getStamina(player); - } - - public static double getMaxStamina(Player player) { - MMOIntegration integration = getIntegration(); - return integration.getMaxStamina(player); - } - - public static void setStamina(Player player, double amount) { - MMOIntegration integration = getIntegration(); - integration.setStamina(player, amount); - } - - public static void giveStamina(Player player, double amount) { - MMOIntegration integration = getIntegration(); - integration.giveStamina(player, amount); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/plugins/MMOCore.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/plugins/MMOCore.java deleted file mode 100644 index a8222e3f..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/plugins/MMOCore.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.willfp.ecoenchants.mmo.integrations.mmo.plugins; - -import com.willfp.ecoenchants.mmo.integrations.mmo.MMOIntegration; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.stats.StatType; -import org.bukkit.entity.Player; - -public class MMOCore implements MMOIntegration { - @Override - public double getMana(Player player) { - return PlayerData.get(player).getMana(); - } - - @Override - public void setMana(Player player, double amount) { - PlayerData.get(player).setMana(amount); - } - - @Override - public void giveMana(Player player, double amount) { - PlayerData.get(player).giveMana(amount); - } - - @Override - public double getMaxMana(Player player) { - return PlayerData.get(player).getStats().getStat(StatType.MAX_MANA); - } - - @Override - public double getStamina(Player player) { - return PlayerData.get(player).getStamina(); - } - - @Override - public void setStamina(Player player, double amount) { - PlayerData.get(player).setStamina(amount); - } - - @Override - public void giveStamina(Player player, double amount) { - PlayerData.get(player).giveStamina(amount); - } - - @Override - public double getMaxStamina(Player player) { - return PlayerData.get(player).getStats().getStat(StatType.MAX_STAMINA); - } - - @Override - public String getPluginName() { - return "MMOCore"; - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOEnchant.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOEnchant.java deleted file mode 100644 index a84195f6..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOEnchant.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.willfp.ecoenchants.mmo.structure; - -import java.util.HashSet; -import java.util.Set; - -public interface MMOEnchant { - Set REGISTRY = new HashSet<>(); -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOEnchantment.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOEnchantment.java deleted file mode 100644 index c4540d98..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOEnchantment.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.willfp.ecoenchants.mmo.structure; - -import com.willfp.eco.core.Prerequisite; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.mmo.MMOPrerequisites; - -public abstract class MMOEnchantment extends EcoEnchant implements MMOEnchant { - protected MMOEnchantment(String key, EnchantmentType type, Prerequisite... prerequisites) { - super(key, type, MMOPrerequisites.append(prerequisites, MMOPrerequisites.HAS_MMOCORE)); - - MMOEnchant.REGISTRY.add(this); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOSpell.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOSpell.java deleted file mode 100644 index d1323d4a..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOSpell.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.willfp.ecoenchants.mmo.structure; - -import com.willfp.eco.core.Prerequisite; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import com.willfp.ecoenchants.mmo.MMOPrerequisites; - -public abstract class MMOSpell extends Spell implements MMOEnchant { - protected MMOSpell(String key, Prerequisite... prerequisites) { - super(key, MMOPrerequisites.append(prerequisites, MMOPrerequisites.HAS_MMOCORE)); - - MMOEnchant.REGISTRY.add(this); - } -} diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/athletic.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/athletic.yml deleted file mode 100644 index 7dff2c01..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/athletic.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Athletic EcoEnchant -# - -name: "Athletic" -description: Increases your max stamina. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - conflicts: [ ] - maximum-level: 4 - -config: - stamina-per-level: 10 # Bonus max stamina to give per level \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/augment.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/augment.yml deleted file mode 100644 index 5bdf6edd..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/augment.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Augment EcoEnchant -# - -name: "Augment" -description: Increases your max mana. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - conflicts: [ ] - maximum-level: 4 - -config: - mana-per-level: 10 # Bonus max mana to give per level \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/discounted.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/discounted.yml deleted file mode 100644 index da15a9f5..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/discounted.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Discounted EcoEnchant -# - -name: "Discounted" -description: Reduces mana cost for abilities. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - - sword - - axe - grindstoneable: true - conflicts: [ ] - maximum-level: 5 - -config: - multiplier: 0.1 # Mana cost = initial cost * (1 - multiplier * level), thus 10 cost with discounted 5 means final cost is 5 \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/elixir.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/elixir.yml deleted file mode 100644 index 7bc72c1e..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/elixir.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Elixir EcoEnchant -# - -name: "Elixir" -description: Steals a portion of your victim's mana. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - - axe - grindstoneable: true - conflicts: [ ] - maximum-level: 3 - -config: - allow-not-fully-charged: false - percentage-per-level: 5 # Percentage of your opponents mana to steal per level \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/endurance.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/endurance.yml deleted file mode 100644 index 204efa0b..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/endurance.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Endurance EcoEnchant -# - -name: "Endurance" -description: Increases the rate that you regain stamina. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - conflicts: [ ] - maximum-level: 4 - -config: - multiplier: 0.1 # How many times faster to regain per level - # The formula is default amount * (1 + (multiplier * level)) - # ie, If you were going to regen 10 stamina with a multiplier of 0.1 and 8 levels, then you would regenerate: - # 10 * (1 + (0.1 * 8)) = 10 * 1.8 = 18 \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/fortitude.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/fortitude.yml deleted file mode 100644 index 4b7ea86f..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/fortitude.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Fortitude EcoEnchant -# - -name: "Fortitude" -description: Steals a portion of your victim's stamina. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - conflicts: [ ] - maximum-level: 3 - -config: - percentage-per-level: 5 # Percentage of your opponents stamina to steal per level \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/motivate.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/motivate.yml deleted file mode 100644 index c92aeb69..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/motivate.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Motivate EcoEnchant -# - -name: "Motivate" -description: Steals a portion of your victim's stamina. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - sword - - axe - grindstoneable: true - conflicts: [ ] - maximum-level: 3 - -config: - allow-not-fully-charged: false - percentage-per-level: 5 # Percentage of your opponents stamina to steal per level \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/recover.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/recover.yml deleted file mode 100644 index e75468c5..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/recover.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Recover EcoEnchant -# - -name: "Recover" -description: Reduces cooldown for abilities. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - - sword - - axe - grindstoneable: true - conflicts: [ ] - maximum-level: 5 - -config: - multiplier: 0.1 # Cooldown = initial cooldown * (1 - multiplier * level), thus 8 cooldown with recover 5 means final cooldown is 4 \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/siphon.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/siphon.yml deleted file mode 100644 index 1fb9b607..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/siphon.yml +++ /dev/null @@ -1,24 +0,0 @@ -# -# Siphon EcoEnchant -# - -name: "Siphon" -description: Steals a portion of your victim's mana. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - conflicts: [ ] - maximum-level: 3 - -config: - percentage-per-level: 5 # Percentage of your opponents mana to steal per level \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/spirituality.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/spirituality.yml deleted file mode 100644 index 97f85194..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/spirituality.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Spirituality EcoEnchant -# - -name: "Spirituality" -description: Increases the rate that you regain mana. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - conflicts: [ ] - maximum-level: 4 - -config: - multiplier: 0.1 # How many times faster to regain per level - # The formula is default amount * (1 + (multiplier * level)) - # ie, If you were going to regen 10 mana with a multiplier of 0.1 and 8 levels, then you would regenerate: - # 10 * (1 + (0.1 * 8)) = 10 * 1.8 = 18 \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/strengthening.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/strengthening.yml deleted file mode 100644 index ad725c66..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/strengthening.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Strengthening EcoEnchant -# - -name: "Strengthening" -description: Increases your attack damage while wearing. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - conflicts: [ ] - maximum-level: 4 - -config: - multiplier: 0.02 # Multiplier * Levels * Base Attack Damage is added to your total attack damage while wearing \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/spell/drain.yml b/eco-extensions/mmo/src/main/resources/enchants/spell/drain.yml deleted file mode 100644 index d00eec7e..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/spell/drain.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Drain EcoEnchant -# - -name: "Drain" -description: Reduces all nearby players' mana. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - sword - grindstoneable: true - conflicts: [ ] - maximum-level: 3 - -config: - activation-sound: ENTITY_ENDERMAN_TELEPORT - cooldown: 240 # In seconds - radius-per-level: 10 # Radius to check nearby players' mana - percentage-per-level: 10 # Percentage of nearby players' mana to reduce diff --git a/eco-extensions/mmo/src/main/resources/extension.yml b/eco-extensions/mmo/src/main/resources/extension.yml deleted file mode 100644 index 758320be..00000000 --- a/eco-extensions/mmo/src/main/resources/extension.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: MMO -main: com.willfp.ecoenchants.mmo.MMOMain -version: ${projectVersion} \ No newline at end of file diff --git a/eco-extensions/precision/build.gradle b/eco-extensions/precision/build.gradle deleted file mode 100644 index deee6d87..00000000 --- a/eco-extensions/precision/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.0.0' -description = 'Precision Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/precision/src/main/java/com/willfp/ecoenchants/precision/Precision.java b/eco-extensions/precision/src/main/java/com/willfp/ecoenchants/precision/Precision.java deleted file mode 100644 index 72ae23b0..00000000 --- a/eco-extensions/precision/src/main/java/com/willfp/ecoenchants/precision/Precision.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.willfp.ecoenchants.precision; - - -import com.willfp.eco.util.TridentUtils; -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.Enderman; -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.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -@SuppressWarnings("unchecked") -public class Precision extends EcoEnchant { - public Precision() { - super( - "precision", EnchantmentType.SPECIAL - ); - } - - @EventHandler - public void aimingLaunch(@NotNull final ProjectileLaunchEvent event) { - if (!(event.getEntity().getShooter() instanceof Player)) { - return; - } - - if (!(event.getEntity() instanceof Trident)) { - return; - } - - if (event.isCancelled()) { - return; - } - - Player player = (Player) event.getEntity().getShooter(); - Trident trident = (Trident) event.getEntity(); - - ItemStack itemStack = TridentUtils.getItemStack(trident); - if (!EnchantChecks.item(itemStack, this)) { - return; - } - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance-per-level"); - - final double finalDistance = level * multiplier; - Runnable runnable = this.getPlugin().getRunnableFactory().create(bukkitRunnable -> { - List nearbyEntities = (List) (List) Arrays.asList(trident.getNearbyEntities(finalDistance, finalDistance, finalDistance).stream() - .filter(entity -> entity instanceof LivingEntity) - .filter(entity -> !entity.equals(player)) - .filter(entity -> !(entity instanceof Enderman)) - .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(trident.getLocation()); - if (currentDistance >= dist) { - continue; - } - - dist = currentDistance; - entity = livingEntity; - } - if (entity != null) { - Vector vector = entity.getEyeLocation().toVector().clone().subtract(trident.getLocation().toVector()).normalize(); - trident.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 (trident.isDead() || trident.isInBlock() || trident.isOnGround()) { - bukkitRunnable.cancel(); - } - this.getPlugin().getScheduler().run(runnable); - }).runTaskTimer(3, period); - } -} diff --git a/eco-extensions/precision/src/main/java/com/willfp/ecoenchants/precision/PrecisionMain.java b/eco-extensions/precision/src/main/java/com/willfp/ecoenchants/precision/PrecisionMain.java deleted file mode 100644 index 3b5f59c6..00000000 --- a/eco-extensions/precision/src/main/java/com/willfp/ecoenchants/precision/PrecisionMain.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.precision; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class PrecisionMain extends Extension { - public static final EcoEnchant PRECISION = new Precision(); - - public PrecisionMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/precision/src/main/resources/enchants/special/precision.yml b/eco-extensions/precision/src/main/resources/enchants/special/precision.yml deleted file mode 100644 index 01e1e2a3..00000000 --- a/eco-extensions/precision/src/main/resources/enchants/special/precision.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Precision EcoEnchant -# - -name: "Precision" -description: Tridents hone in on your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 5 - -config: - distance-per-level: 4 # Distance to scan per level - check-ticks: 10 # Ticks between rotations - checks-per-level: 2 # Amount of times to rotate arrow per level (prevents "floating") \ No newline at end of file diff --git a/eco-extensions/precision/src/main/resources/extension.yml b/eco-extensions/precision/src/main/resources/extension.yml deleted file mode 100644 index 8da268ac..00000000 --- a/eco-extensions/precision/src/main/resources/extension.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: Precision -main: com.willfp.ecoenchants.precision.PrecisionMain -version: ${projectVersion} \ No newline at end of file diff --git a/eco-extensions/rainbow/build.gradle b/eco-extensions/rainbow/build.gradle deleted file mode 100644 index 03328218..00000000 --- a/eco-extensions/rainbow/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '2.0.0' -description = 'Rainbow Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/Rainbow.java b/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/Rainbow.java deleted file mode 100644 index 3ca79c63..00000000 --- a/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/Rainbow.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.willfp.ecoenchants.rainbow; - -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 Rainbow extends EcoEnchant { - public Rainbow() { - super( - "rainbow", EnchantmentType.NORMAL - ); - } - - @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-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/RainbowMain.java b/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/RainbowMain.java deleted file mode 100644 index 6694f4a8..00000000 --- a/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/RainbowMain.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.rainbow; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class RainbowMain extends Extension { - public static final EcoEnchant RAINBOW = new Rainbow(); - - public RainbowMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/rainbow/src/main/resources/enchants/normal/rainbow.yml b/eco-extensions/rainbow/src/main/resources/enchants/normal/rainbow.yml deleted file mode 100644 index 2907f83e..00000000 --- a/eco-extensions/rainbow/src/main/resources/enchants/normal/rainbow.yml +++ /dev/null @@ -1,56 +0,0 @@ -# -# Rainbow EcoEnchant -# - -name: "Rainbow" -description: Chance to drop flowers and dyes from leaves. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - targets: - - axe - - shears - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - silk_touch - maximum-level: 4 - -config: - items: - - white_dye - - orange_dye - - magenta_dye - - light_blue_dye - - yellow_dye - - lime_dye - - pink_dye - - gray_dye - - light_gray_dye - - cyan_dye - - purple_dye - - blue_dye - - brown_dye - - green_dye - - red_dye - - black_dye - - dandelion - - poppy - - blue_orchid - - allium - - azure_bluet - - red_tulip - - orange_tulip - - white_tulip - - pink_tulip - - oxeye_daisy - - cornflower - - lily_of_the_valley - - wither_rose - chance-per-level: 3 # Chance to drop item. \ No newline at end of file diff --git a/eco-extensions/rainbow/src/main/resources/extension.yml b/eco-extensions/rainbow/src/main/resources/extension.yml deleted file mode 100644 index 83fa2fda..00000000 --- a/eco-extensions/rainbow/src/main/resources/extension.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: Rainbow -main: com.willfp.ecoenchants.rainbow.RainbowMain -version: ${projectVersion} \ No newline at end of file diff --git a/eco-extensions/sprint-artifacts/build.gradle b/eco-extensions/sprint-artifacts/build.gradle deleted file mode 100644 index 67e681d9..00000000 --- a/eco-extensions/sprint-artifacts/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.0.0' -description = 'Sprint Artifacts Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/sprint-artifacts/src/main/java/com/willfp/ecoenchants/sprintartifacts/SprintArtifactsListener.java b/eco-extensions/sprint-artifacts/src/main/java/com/willfp/ecoenchants/sprintartifacts/SprintArtifactsListener.java deleted file mode 100644 index f36e2ab7..00000000 --- a/eco-extensions/sprint-artifacts/src/main/java/com/willfp/ecoenchants/sprintartifacts/SprintArtifactsListener.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.willfp.ecoenchants.sprintartifacts; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.jetbrains.annotations.NotNull; - -import java.util.Objects; -import java.util.Optional; - -@SuppressWarnings("deprecation") -public class SprintArtifactsListener implements Listener { - @EventHandler - public void onPlayerMove(@NotNull final PlayerMoveEvent event) { - Player player = event.getPlayer(); - - if (!player.isSprinting()) { - return; - } - - if (!player.isOnGround()) { - return; - } - - ItemStack boots = player.getInventory().getBoots(); - if (boots == null) { - return; - } - ItemMeta bootsMeta = boots.getItemMeta(); - if (bootsMeta == null) { - return; - } - - Optional matching = bootsMeta.getEnchants().keySet().stream() - .map(EcoEnchants::getFromEnchantment) - .filter(Objects::nonNull) - .filter(enchantment -> enchantment.getType().equals(EnchantmentType.ARTIFACT)) - .findFirst(); - if (!matching.isPresent()) { - return; - } - Artifact artifact = (Artifact) matching.get(); - - if (!EnchantChecks.boots(player, artifact)) { - return; - } - - if (artifact.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - player.getWorld().spawnParticle(artifact.getParticle(), player.getLocation().add(0, 0.1, 0), 1, 0, 0, 0, 0, artifact.getDustOptions(), true); - } -} diff --git a/eco-extensions/sprint-artifacts/src/main/java/com/willfp/ecoenchants/sprintartifacts/SprintArtifactsMain.java b/eco-extensions/sprint-artifacts/src/main/java/com/willfp/ecoenchants/sprintartifacts/SprintArtifactsMain.java deleted file mode 100644 index 0e55fa46..00000000 --- a/eco-extensions/sprint-artifacts/src/main/java/com/willfp/ecoenchants/sprintartifacts/SprintArtifactsMain.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.willfp.ecoenchants.sprintartifacts; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import org.bukkit.Bukkit; -import org.jetbrains.annotations.NotNull; - -public class SprintArtifactsMain extends Extension { - public SprintArtifactsMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - Bukkit.getPluginManager().registerEvents(new SprintArtifactsListener(), this.getPlugin()); - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/sprint-artifacts/src/main/resources/extension.yml b/eco-extensions/sprint-artifacts/src/main/resources/extension.yml deleted file mode 100644 index 242d52c9..00000000 --- a/eco-extensions/sprint-artifacts/src/main/resources/extension.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: Sprint Artifacts -main: com.willfp.ecoenchants.sprintartifacts.SprintArtifactsMain -version: ${projectVersion} \ No newline at end of file diff --git a/eco-extensions/summoning/build.gradle b/eco-extensions/summoning/build.gradle deleted file mode 100644 index 25240a97..00000000 --- a/eco-extensions/summoning/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.0.0' -description = 'Summoning Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningEnchantment.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningEnchantment.java deleted file mode 100644 index 04c3d768..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningEnchantment.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.willfp.ecoenchants.summoning; - -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.EnchantmentUtils; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.attribute.Attribute; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Mob; -import org.bukkit.entity.Trident; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.event.entity.EntityTargetEvent; -import org.jetbrains.annotations.NotNull; - -public abstract class SummoningEnchantment extends EcoEnchant { - private final SummoningType summoningType; - - protected SummoningEnchantment(@NotNull final String key, - @NotNull final EnchantmentType type, - @NotNull final SummoningType summoningType, - @NotNull final Prerequisite... prerequisites) { - super(key, type, prerequisites); - - this.summoningType = summoningType; - } - - public abstract EntityType getEntity(); - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!summoningType.equals(SummoningType.MELEE)) { - return; - } - - doSpawn(attacker, victim, 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 (!summoningType.equals(SummoningType.RANGED)) { - return; - } - - doSpawn(attacker, victim, 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 (!summoningType.equals(SummoningType.TRIDENT)) { - return; - } - - doSpawn(attacker, victim, level); - } - - private void doSpawn(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level) { - if (summoningType.equals(SummoningType.MELEE)) { - if (EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - if (!victim.getMetadata("eco-target").isEmpty()) { - return; - } - - Location location = victim.getLocation().clone(); - World world = victim.getWorld(); - - int toSpawn = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "mobs-per-level") * level; - int ticksToLive = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-to-live-per-level") * level; - double health = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level") * level; - - for (int i = 0; i < toSpawn; i++) { - Location locToSpawn = location.clone().add(NumberUtils.randFloat(-3, 3), NumberUtils.randFloat(0, 3), NumberUtils.randFloat(-3, 3)); - Mob entity = (Mob) world.spawnEntity(locToSpawn, this.getEntity()); - - entity.setTarget(victim); - if (health > entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) { - health = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); - } - entity.setHealth(health); - entity.setMetadata("eco-target", this.getPlugin().getMetadataValueFactory().create(victim)); - this.getPlugin().getScheduler().runLater(entity::remove, ticksToLive); - } - } - - @EventHandler - public void onSwitchTarget(@NotNull final EntityTargetEvent event) { - if (event.getEntity().getMetadata("eco-target").isEmpty()) { - return; - } - - LivingEntity target = (LivingEntity) event.getEntity().getMetadata("eco-target").get(0).value(); - event.setTarget(target); - } - - @EventHandler(priority = EventPriority.LOW) - public void onDropItem(@NotNull final EntityDeathEvent event) { - if (event.getEntity().getMetadata("eco-target").isEmpty()) { - return; - } - - event.getDrops().clear(); - event.setDroppedExp(0); - } -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningMain.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningMain.java deleted file mode 100644 index 0c9be4a9..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningMain.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.summoning; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.summoning.enchants.Crawler; -import com.willfp.ecoenchants.summoning.enchants.Firestorm; -import com.willfp.ecoenchants.summoning.enchants.Ghoul; -import com.willfp.ecoenchants.summoning.enchants.Metallic; -import com.willfp.ecoenchants.summoning.enchants.Mortality; -import org.jetbrains.annotations.NotNull; - -public class SummoningMain extends Extension { - public static final EcoEnchant METALLIC = new Metallic(); - public static final EcoEnchant FIRESTORM = new Firestorm(); - public static final EcoEnchant MORTALITY = new Mortality(); - public static final EcoEnchant GHOUL = new Ghoul(); - public static final EcoEnchant CRAWLER = new Crawler(); - - public SummoningMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningType.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningType.java deleted file mode 100644 index 20f2ea2d..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningType.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.willfp.ecoenchants.summoning; - -public enum SummoningType { - MELEE, - RANGED, - TRIDENT -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Crawler.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Crawler.java deleted file mode 100644 index 89999425..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Crawler.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.summoning.enchants; - -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.summoning.SummoningEnchantment; -import com.willfp.ecoenchants.summoning.SummoningType; -import org.bukkit.entity.EntityType; - -public class Crawler extends SummoningEnchantment { - public Crawler() { - super("crawler", EnchantmentType.NORMAL, SummoningType.TRIDENT); - } - - @Override - public EntityType getEntity() { - return EntityType.CAVE_SPIDER; - } -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Firestorm.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Firestorm.java deleted file mode 100644 index 3849de91..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Firestorm.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.summoning.enchants; - -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.summoning.SummoningEnchantment; -import com.willfp.ecoenchants.summoning.SummoningType; -import org.bukkit.entity.EntityType; - -public class Firestorm extends SummoningEnchantment { - public Firestorm() { - super("firestorm", EnchantmentType.NORMAL, SummoningType.MELEE); - } - - @Override - public EntityType getEntity() { - return EntityType.BLAZE; - } -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Ghoul.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Ghoul.java deleted file mode 100644 index 00c1ce48..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Ghoul.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.summoning.enchants; - -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.summoning.SummoningEnchantment; -import com.willfp.ecoenchants.summoning.SummoningType; -import org.bukkit.entity.EntityType; - -public class Ghoul extends SummoningEnchantment { - public Ghoul() { - super("ghoul", EnchantmentType.NORMAL, SummoningType.RANGED); - } - - @Override - public EntityType getEntity() { - return EntityType.ZOMBIE; - } -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Metallic.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Metallic.java deleted file mode 100644 index a1941965..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Metallic.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.summoning.enchants; - -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.summoning.SummoningEnchantment; -import com.willfp.ecoenchants.summoning.SummoningType; -import org.bukkit.entity.EntityType; - -public class Metallic extends SummoningEnchantment { - public Metallic() { - super("metallic", EnchantmentType.SPECIAL, SummoningType.MELEE); - } - - @Override - public EntityType getEntity() { - return EntityType.IRON_GOLEM; - } -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Mortality.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Mortality.java deleted file mode 100644 index e366b660..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Mortality.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.summoning.enchants; - -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.summoning.SummoningEnchantment; -import com.willfp.ecoenchants.summoning.SummoningType; -import org.bukkit.entity.EntityType; - -public class Mortality extends SummoningEnchantment { - public Mortality() { - super("mortality", EnchantmentType.NORMAL, SummoningType.RANGED); - } - - @Override - public EntityType getEntity() { - return EntityType.WITHER_SKELETON; - } -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Sniper.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Sniper.java deleted file mode 100644 index 0f452cba..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Sniper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.summoning.enchants; - -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.summoning.SummoningEnchantment; -import com.willfp.ecoenchants.summoning.SummoningType; -import org.bukkit.entity.EntityType; - -public class Sniper extends SummoningEnchantment { - public Sniper() { - super("sniper", EnchantmentType.NORMAL, SummoningType.TRIDENT); - } - - @Override - public EntityType getEntity() { - return EntityType.SKELETON; - } -} diff --git a/eco-extensions/summoning/src/main/resources/enchants/normal/crawler.yml b/eco-extensions/summoning/src/main/resources/enchants/normal/crawler.yml deleted file mode 100644 index 101ff194..00000000 --- a/eco-extensions/summoning/src/main/resources/enchants/normal/crawler.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Crawler EcoEnchant -# - -name: "Crawler" -description: Spawns cave spiders to attack your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - sniper - maximum-level: 3 - -config: - mobs-per-level: 2 # Amount of mobs to spawn per level - ticks-to-live-per-level: 30 # Ticks for mob to live per level - health-per-level: 6 # Health for mobs to have per level - chance-per-level: 5 # Chance to spawn mobs per level \ No newline at end of file diff --git a/eco-extensions/summoning/src/main/resources/enchants/normal/firestorm.yml b/eco-extensions/summoning/src/main/resources/enchants/normal/firestorm.yml deleted file mode 100644 index e9a99db0..00000000 --- a/eco-extensions/summoning/src/main/resources/enchants/normal/firestorm.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Firestorm EcoEnchant -# - -name: "Firestorm" -description: Spawns blazes to attack your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - metallic - maximum-level: 3 - -config: - mobs-per-level: 2 # Amount of mobs to spawn per level - ticks-to-live-per-level: 50 # Ticks for mob to live per level - health-per-level: 4 # Health for mobs to have per level - chance-per-level: 5 # Chance to spawn mobs per level - allow-not-fully-charged: false # don't require sword attack to be at full charge \ No newline at end of file diff --git a/eco-extensions/summoning/src/main/resources/enchants/normal/ghoul.yml b/eco-extensions/summoning/src/main/resources/enchants/normal/ghoul.yml deleted file mode 100644 index 5d5e07e3..00000000 --- a/eco-extensions/summoning/src/main/resources/enchants/normal/ghoul.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Ghoul EcoEnchant -# - -name: "Ghoul" -description: Spawns zombies to attack your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - mortality - maximum-level: 4 - -config: - mobs-per-level: 1 # Amount of mobs to spawn per level - ticks-to-live-per-level: 30 # Ticks for mob to live per level - health-per-level: 4 # Health for mobs to have per level - chance-per-level: 5 # Chance to spawn mobs per level \ No newline at end of file diff --git a/eco-extensions/summoning/src/main/resources/enchants/normal/mortality.yml b/eco-extensions/summoning/src/main/resources/enchants/normal/mortality.yml deleted file mode 100644 index 3f677242..00000000 --- a/eco-extensions/summoning/src/main/resources/enchants/normal/mortality.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Mortality EcoEnchant -# - -name: "Mortality" -description: Spawns wither skeletons to attack your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - ghoul - maximum-level: 4 - -config: - mobs-per-level: 1 # Amount of mobs to spawn per level - ticks-to-live-per-level: 30 # Ticks for mob to live per level - health-per-level: 6 # Health for mobs to have per level - chance-per-level: 5 # Chance to spawn mobs per level \ No newline at end of file diff --git a/eco-extensions/summoning/src/main/resources/enchants/normal/sniper.yml b/eco-extensions/summoning/src/main/resources/enchants/normal/sniper.yml deleted file mode 100644 index 3705f26e..00000000 --- a/eco-extensions/summoning/src/main/resources/enchants/normal/sniper.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Sniper EcoEnchant -# - -name: "Sniper" -description: Spawns skeletons to attack your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - crawler - maximum-level: 3 - -config: - mobs-per-level: 2 # Amount of mobs to spawn per level - ticks-to-live-per-level: 40 # Ticks for mob to live per level - health-per-level: 4 # Health for mobs to have per level - chance-per-level: 5 # Chance to spawn mobs per level \ No newline at end of file diff --git a/eco-extensions/summoning/src/main/resources/enchants/special/metallic.yml b/eco-extensions/summoning/src/main/resources/enchants/special/metallic.yml deleted file mode 100644 index 6ebda7bb..00000000 --- a/eco-extensions/summoning/src/main/resources/enchants/special/metallic.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Metallic EcoEnchant -# - -name: "Metallic" -description: Spawns iron golems to attack your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: veryspecial - -general-config: - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: - - firestorm - maximum-level: 2 - -config: - mobs-per-level: 1 # Amount of mobs to spawn per level - ticks-to-live-per-level: 20 # Ticks for mob to live per level - health-per-level: 4 # Health for mobs to have per level - chance-per-level: 5 # Chance to spawn mobs per level - allow-not-fully-charged: false # don't require sword attack to be at full charge \ No newline at end of file diff --git a/eco-extensions/summoning/src/main/resources/extension.yml b/eco-extensions/summoning/src/main/resources/extension.yml deleted file mode 100644 index 7f5b52f0..00000000 --- a/eco-extensions/summoning/src/main/resources/extension.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: Summoning -main: com.willfp.ecoenchants.summoning.SummoningMain -version: ${projectVersion} \ No newline at end of file diff --git a/eco-extensions/xray/build.gradle b/eco-extensions/xray/build.gradle deleted file mode 100644 index 9557b876..00000000 --- a/eco-extensions/xray/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '3.0.0' -description = 'Xray Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/Xray.java b/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/Xray.java deleted file mode 100644 index 248c539b..00000000 --- a/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/Xray.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.willfp.ecoenchants.xray; - -import com.willfp.eco.util.TeamUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.entity.Shulker; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.metadata.MetadataValue; -import org.bukkit.scoreboard.Team; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.UUID; - -public class Xray extends Spell { - public Xray() { - super("xray"); - } - - @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; - } - - Location location; - - if (block == null) { - location = player.getLocation(); - } else { - location = block.getLocation(); - } - - Set toReveal = new HashSet<>(); - - int size = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "blocks-per-level") * level; - - int ticks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks"); - - List materials = new ArrayList<>(); - - for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks")) { - Material material = Material.getMaterial(materialName.toUpperCase()); - if (material != null) { - materials.add(material); - } - } - - for (int x = -size; x <= size; x++) { - for (int y = -size; y <= size; y++) { - for (int z = -size; z <= size; z++) { - Block block1 = location.getWorld().getBlockAt(location.clone().add(x, y, z)); - - if (!materials.contains(block1.getType())) { - continue; - } - - toReveal.add(block1); - } - } - } - - toReveal.forEach(block1 -> { - Shulker shulker = (Shulker) block1.getWorld().spawnEntity(block1.getLocation(), EntityType.SHULKER); - shulker.setInvulnerable(true); - shulker.setSilent(true); - shulker.setAI(false); - shulker.setGravity(false); - shulker.setGlowing(true); - shulker.setInvisible(true); - shulker.setMetadata("xray-shulker", this.getPlugin().getMetadataValueFactory().create(true)); - - block1.setMetadata("xray-uuid", this.getPlugin().getMetadataValueFactory().create(shulker.getUniqueId())); - - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "color-glow")) { - Team team = TeamUtils.getMaterialColorTeam(block1.getType()); - team.addEntry(shulker.getUniqueId().toString()); - } - - this.getPlugin().getScheduler().runLater(() -> { - shulker.remove(); - block1.removeMetadata("xray-uuid", this.getPlugin()); - }, ticks); - }); - - return true; - } - - @EventHandler - public void onBlockBreak(@NotNull final BlockBreakEvent event) { - Block block = event.getBlock(); - - if (!block.hasMetadata("xray-uuid")) { - return; - } - - for (MetadataValue meta : block.getMetadata("xray-uuid")) { - if (!(meta.value() instanceof UUID)) { - continue; - } - - UUID uuid = (UUID) meta.value(); - - assert uuid != null; - - Entity entity = Bukkit.getServer().getEntity(uuid); - - if (entity != null) { - entity.remove(); - } - } - - for (Entity shulkerEntity : block.getLocation().getWorld().getNearbyEntities(block.getLocation(), 2, 2, 2, entity -> entity.hasMetadata("xray-shulker"))) { - shulkerEntity.remove(); - } - } -} diff --git a/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/XrayMain.java b/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/XrayMain.java deleted file mode 100644 index 044e3864..00000000 --- a/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/XrayMain.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.xray; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class XrayMain extends Extension { - public static final EcoEnchant XRAY = new Xray(); - - public XrayMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/xray/src/main/resources/enchants/spell/xray.yml b/eco-extensions/xray/src/main/resources/enchants/spell/xray.yml deleted file mode 100644 index 2ebd87ae..00000000 --- a/eco-extensions/xray/src/main/resources/enchants/spell/xray.yml +++ /dev/null @@ -1,36 +0,0 @@ -# -# Xray EcoEnchant -# - -name: "Xray" -description: Glow nearby ores through walls. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - conflicts: [ ] - maximum-level: 3 - -config: - activation-sound: ENTITY_ENDERMAN_TELEPORT - cooldown: 40 # In seconds - blocks: - - coal_ore - - iron_ore - - gold_ore - - redstone_ore - - lapis_ore - - ancient_debris - - diamond_ore - blocks-per-level: 3 # Blocks on all sides to scan per level - ticks: 60 - color-glow: true # Color ore glow based on ore type. \ No newline at end of file diff --git a/eco-extensions/xray/src/main/resources/extension.yml b/eco-extensions/xray/src/main/resources/extension.yml deleted file mode 100644 index 9c0f6b20..00000000 --- a/eco-extensions/xray/src/main/resources/extension.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: Xray -main: com.willfp.ecoenchants.xray.XrayMain -version: ${projectVersion} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index f72d0cd4..40e1ab57 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version = 7.2.5 -plugin-name = EcoEnchants \ No newline at end of file +version = 1.0.0 +plugin-name = EcoSkills \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 47b40497..db25ec8e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,24 +1,5 @@ -rootProject.name = 'EcoEnchants' +rootProject.name = 'EcoSkills' // Core include ':eco-core' -include ':eco-core:core-nms' -include ':eco-core:core-nms:v1_16_R1' -include ':eco-core:core-nms:v1_16_R2' -include ':eco-core:core-nms:v1_16_R3' -include ':eco-core:core-proxy' -include ':eco-core:core-plugin' - -// Extensions -include ':eco-extensions' -include ':eco-extensions:alchemy' -include ':eco-extensions:biomes' -include ':eco-extensions:effects' -include ':eco-extensions:endershot' -include ':eco-extensions:firewand' -//include ':eco-extensions:mmo' -include ':eco-extensions:precision' -include ':eco-extensions:rainbow' -include ':eco-extensions:sprint-artifacts' -include ':eco-extensions:summoning' -include ':eco-extensions:xray' \ No newline at end of file +include ':eco-core:core-plugin' \ No newline at end of file