mirror of
https://github.com/songoda/EpicEnchants.git
synced 2024-11-13 06:07:41 +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
|
||||
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());
|
||||
maxAllowedApply = Math.min(maxAllowedApply, maxAllowedOverride);
|
||||
// item is at max enchantments
|
||||
if (currentEnchantmentTotal >= maxAllowedApply) {
|
||||
instance.getLocale().getMessage("enchants.maxallowed").processPlaceholder("max_enchants", maxAllowedApply).sendPrefixedMessage(event.getWhoClicked());
|
||||
|
Loading…
Reference in New Issue
Block a user