mirror of
https://github.com/songoda/EpicEnchants.git
synced 2025-01-18 22:21:40 +01:00
Fixed max apply perm.
This commit is contained in:
parent
37c048090f
commit
32dadee339
@ -44,8 +44,9 @@ public class BookListener extends ItemListener {
|
|||||||
}
|
}
|
||||||
// get total amount of enchantments on item
|
// get total amount of enchantments on item
|
||||||
int currentEnchantmentTotal = instance.getEnchantUtils().getEnchants(toApply).size();
|
int currentEnchantmentTotal = instance.getEnchantUtils().getEnchants(toApply).size();
|
||||||
//int maxAllowedApply = instance.getEnchantUtils().getMaximumEnchantsCanApply((Player) event.getWhoClicked());
|
int maxAllowedOverride = instance.getEnchantUtils().getMaximumEnchantsCanApply((Player) event.getWhoClicked());
|
||||||
int maxAllowedApply = instance.getEnchantUtils().getMaximumEnchantsCanApplyItem(toApply, (Player) event.getWhoClicked());
|
int maxAllowedApply = instance.getEnchantUtils().getMaximumEnchantsCanApplyItem(toApply, (Player) event.getWhoClicked());
|
||||||
|
maxAllowedApply = Math.min(maxAllowedApply, maxAllowedOverride);
|
||||||
// item is at max enchantments
|
// item is at max enchantments
|
||||||
if (currentEnchantmentTotal >= maxAllowedApply) {
|
if (currentEnchantmentTotal >= maxAllowedApply) {
|
||||||
instance.getLocale().getMessage("enchants.maxallowed").processPlaceholder("max_enchants", maxAllowedApply).sendPrefixedMessage(event.getWhoClicked());
|
instance.getLocale().getMessage("enchants.maxallowed").processPlaceholder("max_enchants", maxAllowedApply).sendPrefixedMessage(event.getWhoClicked());
|
||||||
|
Loading…
Reference in New Issue
Block a user