Adds increased scrapper cost when used excessively
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

This commit is contained in:
2024-12-21 19:48:39 +01:00
parent 7e17122bb2
commit 42ca42c571
12 changed files with 210 additions and 70 deletions

View File

@ -213,30 +213,21 @@ public class GlobalScrapperSettings implements Settings<ScrapperSetting> {
}
/**
* Gets the base cost of salvaging an enchanted book
* Gets the math formula for the increase in salvage cost
*
* @return <p>The enchanted book salvage base cost</p>
* @return <p>The salvage cost increase formula</p>
*/
public double getEnchantedBookSalvageCost() {
return asDouble(ScrapperSetting.ENCHANTED_BOOK_SALVAGE_BASE_COST);
public String getSalvageCostIncrease() {
return asString(ScrapperSetting.SALVAGE_COST_INCREASE);
}
/**
* Whether to multiply the cost of salvaging enchanted books based on the number of enchantments
* Gets the math formula for the increase in salvage cooldown
*
* @return <p>Whether to multiply the cost of salvaging enchanted books based on the number of enchantments</p>
* @return <p>The salvage cooldown increase formula</p>
*/
public boolean multiplyEnchantedBookSalvageCost() {
return asBoolean(ScrapperSetting.ENCHANTED_BOOK_SALVAGE_MULTIPLY);
}
/**
* Whether to require both a monetary and item-based cost when salvaging enchanted books
*
* @return <p>Whether to require both a monetary and item-based cost when salvaging enchanted books</p>
*/
public boolean requireMoneyAndItemForEnchantedBookSalvage() {
return asBoolean(ScrapperSetting.ENCHANTED_BOOK_SALVAGE_REQUIRE_BOTH);
public String getSalvageCooldownIncrease() {
return asString(ScrapperSetting.SALVAGE_COOLDOWN_INCREASE);
}
/**
@ -302,4 +293,15 @@ public class GlobalScrapperSettings implements Settings<ScrapperSetting> {
}
}
/**
* Gets the string 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 string</p>
*/
@NotNull
private String asString(@NotNull ScrapperSetting setting) {
return getValue(setting).toString();
}
}

View File

@ -292,28 +292,18 @@ public enum ScrapperSetting implements Setting {
"The cost of using the scrapper to remove netherite from an item", false, false),
/**
* The setting for the enchanted book salvage cost
* The mathematical formula for increasing salvage cost
*/
ENCHANTED_BOOK_SALVAGE_BASE_COST("enchantedBookSalvageBasePrice", SettingValueType.POSITIVE_DOUBLE, 10,
"The per-enchantment cost of splitting an enchanted book", false, false),
SALVAGE_COST_INCREASE("salvageCostIncrease", SettingValueType.STRING, "{cost}*{timesUsed}",
"The mathematical formula for salvage cost increase when continually used within the same hour. " +
"This is necessary for some servers where items can be easily farmed. Set to {cost} to disable behavior.", false, false),
/**
* The setting for the enchanted book item cost
* The mathematical formula for increasing salvage cooldown
*/
ENCHANTED_BOOK_SALVAGE_ITEM_COST("enchantedBookSalvageCost", SettingValueType.ADVANCED_COST, null,
"The cost to pay in order to salvage an enchanted book", false, false),
/**
* The setting for whether to multiply enchanted book cost
*/
ENCHANTED_BOOK_SALVAGE_MULTIPLY("enchantedBookSalvageMultiplyByEnchantmentNumber", SettingValueType.BOOLEAN,
true, "Whether to multiply the cost of salvaging an enchanted book by the number of enchantments on the book", false, false),
/**
* The setting for whether to require both monetary and item payment for salvaging enchanted books
*/
ENCHANTED_BOOK_SALVAGE_REQUIRE_BOTH("enchantedBookSalvageRequireMoneyAndItem", SettingValueType.BOOLEAN,
true, "Whether salvaging an enchanted book will cost both the configured money amount and the configured item", false, false),
SALVAGE_COOLDOWN_INCREASE("salvageCooldownIncrease", SettingValueType.STRING, "{cooldown}*{timesUsed}",
"The mathematical formula for salvage cooldown increase when continually used within the same hour. " +
"This is necessary for some servers where items can be easily farmed. Set to {cooldown} to disable behavior.", false, false),
/**
* Whether to display exact time in minutes and seconds when displaying a remaining cool-down