Removes disableMaterialLimitation
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

Removes the disableMaterialLimitation option
Replaces EnchantmentTarget.BREAKABLE.includes(item) with getMaxDurability(item) > 0 as it seems more generic
This commit is contained in:
2023-01-16 19:45:41 +01:00
parent e5cb3b4a30
commit 347b69b2a8
9 changed files with 26 additions and 64 deletions

View File

@ -49,15 +49,7 @@ public enum GlobalSetting {
* The cost for repairing a damaged anvil
*/
ANVIL_DAMAGED_COST("global.damagedAnvilReforgingCost", SettingValueType.POSITIVE_DOUBLE, 20.0,
"damagedAnvilReforgingCost"),
/**
* Whether to disable the normal limitation for which items are reforgeAble
*
* <p>If true, all items instanceof Damageable can be reforged</p>
*/
DISABLE_MATERIAL_LIMITATION("global.disableMaterialLimitation", SettingValueType.BOOLEAN, false,
"disableMaterialLimitation");
"damagedAnvilReforgingCost");
private final String path;
private final String parent;

View File

@ -295,15 +295,6 @@ public class GlobalSettings {
}
}
/**
* Whether to disable the "EnchantmentTarget.BREAKABLE" limitation
*
* @return <p>True if the material limitation is disabled</p>
*/
public boolean disableMaterialLimitation() {
return asBoolean(GlobalSetting.DISABLE_MATERIAL_LIMITATION);
}
/**
* Gets the given value as a boolean
*

View File

@ -460,8 +460,7 @@ public class NPCSettings {
}
Material material = InputParsingHelper.matchMaterial(item);
boolean limitationDisabled = BlacksmithPlugin.getInstance().getSettings().disableMaterialLimitation();
if (material != null && ItemHelper.isRepairable(new ItemStack(material, 1), limitationDisabled)) {
if (material != null && ItemHelper.isRepairable(new ItemStack(material, 1))) {
if (!blacklist) {
reforgeAbleItems.add(material);
} else {