Added initial support for hard cap

This commit is contained in:
Auxilor
2020-10-10 13:31:57 +01:00
parent d3369103a3
commit b8e6e0a4ad
2 changed files with 9 additions and 0 deletions

View File

@@ -130,6 +130,11 @@ public class AnvilMerge {
if(left.getItemMeta() instanceof EnchantmentStorageMeta) canEnchantItem = true;
if(canEnchantItem && !doesConflict.get()) {
if(ConfigManager.getConfig().getBool("anvil.hard-cap.enabled")) {
if(outEnchants.size() > ConfigManager.getConfig().getInt("anvil.hard-cap.cap")) {
return;
}
}
outEnchants.put(enchantment, integer);
}
}));

View File

@@ -14,6 +14,10 @@ anvil:
enabled: true # Use exponent
exponent: 0.95 # Exponent. Beware that slight changes to this value may cause huge changes in cost.
hard-cap: # Completely limit the amount of enchantments that can be placed on an item
enabled: false # Enable a hard cap
cap: 10 # Most enchantments allowed on an item
lore:
use-numerals: true
use-numbers-above-threshold: 10 #After level 10, enchantments will display as Name Number, eg: Sharpness 25 instead of Sharpness XXV