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 index 0ce7078a..b016f950 100644 --- 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 @@ -67,6 +67,11 @@ public class CommandRandomenchant extends AbstractCommand { } } } + 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; } 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 index d890b3bb..ccbf591a 100644 --- 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 @@ -111,7 +111,7 @@ public class InfernalTouch extends EcoEnchant { experience += out.getSecond(); if (fortune > 0 && FORTUNE_MATERIALS.contains(itemStack.getType())) { - itemStack.setAmount((int) Math.ceil(1 / ((double) fortune + 2) + ((double) fortune + 1) / 2)); + itemStack.setAmount((int) Math.round((Math.random() * ((double) fortune - 1)) + 1.1)); experience++; } } diff --git a/eco-core/core-plugin/src/main/resources/plugin.yml b/eco-core/core-plugin/src/main/resources/plugin.yml index 0594275c..eba43b72 100644 --- a/eco-core/core-plugin/src/main/resources/plugin.yml +++ b/eco-core/core-plugin/src/main/resources/plugin.yml @@ -48,6 +48,7 @@ permissions: ecoenchants.enchantinfo: true ecoenchants.ecodebug: true ecoenchants.randomenchant: true + ecoenchants.randomenchant.bypasshardcap: true ecoenchants.anvil.*: true ecoenchants.anvil.*: description: Allows all anvil permissions @@ -74,6 +75,9 @@ permissions: ecoenchants.randomenchant: description: Allows the use of /randomenchant to apply a random enchantment to an item 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 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 index 7dbeee6d..afbb9d0e 100644 --- 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 @@ -3,6 +3,18 @@ package com.willfp.ecoenchants.mmo; import com.willfp.eco.util.extensions.Extension; import com.willfp.eco.util.plugin.AbstractEcoPlugin; 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; 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 index 052a5ed4..eb6575fc 100644 --- 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 @@ -5,6 +5,7 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; import com.willfp.ecoenchants.mmo.integrations.mmo.MMOManager; import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; import com.willfp.ecoenchants.proxy.proxies.CooldownProxy; +import com.willfp.ecoenchants.util.ProxyUtils; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageByEntityEvent; 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 index 91e93328..20f634ab 100644 --- 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 @@ -3,6 +3,11 @@ package com.willfp.ecoenchants.mmo.enchants.misc; import com.willfp.eco.util.events.armorequip.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; public class Strengthening extends MMOEnchantment { 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 index 0efcdf78..c0895aff 100644 --- 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 @@ -5,6 +5,7 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; import com.willfp.ecoenchants.mmo.integrations.mmo.MMOManager; import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; import com.willfp.ecoenchants.proxy.proxies.CooldownProxy; +import com.willfp.ecoenchants.util.ProxyUtils; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageByEntityEvent; 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 index 148ce21c..9effe1c7 100644 --- 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 @@ -3,6 +3,7 @@ package com.willfp.ecoenchants.mmo.structure; import com.willfp.eco.util.optional.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) {