Implements enchantment salvage toggle #23
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

This commit is contained in:
2024-05-05 23:45:59 +02:00
parent d7bac6d08f
commit d405c0dcff
4 changed files with 70 additions and 17 deletions

View File

@ -188,7 +188,7 @@ public class ScrapperNPCSettings implements TraitSettings<ScrapperSetting> {
* @return <p>Whether to drop reforged items on the ground</p>
*/
public boolean getDropItem() {
return ConfigHelper.asBoolean(getValue(ScrapperSetting.DROP_ITEM));
return asBoolean(ScrapperSetting.DROP_ITEM);
}
@Override
@ -228,6 +228,16 @@ public class ScrapperNPCSettings implements TraitSettings<ScrapperSetting> {
return getValue(setting).toString();
}
/**
* Gets the boolean value of the given setting
*
* @param setting <p>The setting to get the value of</p>
* @return <p>The value of the given setting as a boolean</p>
*/
private boolean asBoolean(@NotNull ScrapperSetting setting) {
return ConfigHelper.asBoolean(getValue(setting));
}
/**
* Gets the value of a setting, using the default if not set
*
@ -275,7 +285,16 @@ public class ScrapperNPCSettings implements TraitSettings<ScrapperSetting> {
* @return <p>True if extended salvaging is enabled</p>
*/
public boolean extendedSalvageEnabled() {
return ConfigHelper.asBoolean(getValue(ScrapperSetting.EXTENDED_SALVAGE_ENABLED));
return asBoolean(ScrapperSetting.EXTENDED_SALVAGE_ENABLED);
}
/**
* Whether salvage of enchanted items is enabled
*
* @return <p>True of this scrapper can salvage enchanted items</p>
*/
public boolean salvageEnchanted() {
return asBoolean(ScrapperSetting.SALVAGE_ENCHANTED);
}
/**
@ -341,4 +360,15 @@ public class ScrapperNPCSettings implements TraitSettings<ScrapperSetting> {
return asString(ScrapperSetting.PARTIAL_SALVAGE_MESSAGE);
}
/**
* Gets the message to display when explaining that this scrapper is unable to salvage enchanted items
*
* @return <p>The cannot salvage enchanted message</p>
*/
@NotNull
public String getCannotSalvageEnchantedMessage() {
return asString(ScrapperSetting.CANNOT_SALVAGE_ENCHANTED_MESSAGE);
}
}