Fix exp multiplier for grindstone, when use item with Intellect or Wisdom on mainhand

This commit is contained in:
Kapitowa 2022-05-06 11:58:38 +03:00
parent 585a012880
commit af8d946882
2 changed files with 10 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.inventory.InventoryType;
import org.jetbrains.annotations.NotNull;
public class Wisdom extends EcoEnchant {
@ -32,6 +33,10 @@ public class Wisdom extends EcoEnchant {
return;
}
if (player.getOpenInventory().getTopInventory().getType() == InventoryType.GRINDSTONE) {
return;
}
int level = EnchantChecks.getMainhandLevel(player, this);
event.getExpChangeEvent().setAmount((int) Math.ceil(event.getExpChangeEvent().getAmount() * (1 + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-point")))));

View File

@ -7,6 +7,7 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.inventory.InventoryType;
import org.jetbrains.annotations.NotNull;
public class Intellect extends EcoEnchant {
@ -38,6 +39,10 @@ public class Intellect extends EcoEnchant {
return;
}
if (player.getOpenInventory().getTopInventory().getType() == InventoryType.GRINDSTONE) {
return;
}
event.getExpChangeEvent().setAmount((int) Math.ceil(event.getExpChangeEvent().getAmount() * (1 + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-point")))));
}
}