Changes configuration values to lower camelcase

Also fixes some grammar mistakes related to the word reforge
This commit is contained in:
2022-10-03 12:39:15 +02:00
parent 9ffd788e29
commit 2489cac8db
10 changed files with 98 additions and 97 deletions

View File

@ -42,7 +42,7 @@ public class BlackSmithConfigCommand implements CommandExecutor {
//Changing reforge-able items' default isn't recommended
if (commandName.equalsIgnoreCase(NPCSetting.REFORGE_ABLE_ITEMS.getCommandName())) {
displayErrorMessage(sender, "Changing reforge-able items globally will make every new " +
"blacksmith unable to re-forge anything not in the list, unless it's changed for the " +
"blacksmith unable to reforge anything not in the list, unless it's changed for the " +
"individual NPC. If you really want to change this, change it manually.");
return false;
}

View File

@ -7,30 +7,31 @@ public enum GlobalSetting {
/**
* The base price for repairing, regardless of durability
*
* <p>This allows specifying a price for each item, by setting base-price.item_name.</p>
* <p>This allows specifying a price for each item, by setting basePrice.item_name.</p>
*/
BASE_PRICE("global.base-price.default", SettingValueType.POSITIVE_DOUBLE, 10.0, "basePrice"),
BASE_PRICE("global.basePrice.default", SettingValueType.POSITIVE_DOUBLE, 10.0, "basePrice"),
/**
* The base price for each durability point
*
* <p>If natural cost, this is the cost each missing durability point will add to the cost. If not natural cost,
* this is the cost each present durability point will add to the cost. This allows specifying a price per
* durability point value for each item, by setting price-per-durability-point.item_name</p>
* durability point value for each item, by setting pricePerDurabilityPoint.item_name</p>
*/
PRICE_PER_DURABILITY_POINT("global.price-per-durability-point.default", SettingValueType.POSITIVE_DOUBLE, 0.005, "pricePerDurabilityPoint"),
PRICE_PER_DURABILITY_POINT("global.pricePerDurabilityPoint.default", SettingValueType.POSITIVE_DOUBLE,
0.005, "pricePerDurabilityPoint"),
/**
* The price increase for each level of each present enchantment
*
* <p>This can be specified for each possible enchantment by setting enchantment-cost.enchantment_name</p>
*/
ENCHANTMENT_COST("global.enchantment-cost.default", SettingValueType.POSITIVE_DOUBLE, 5.0, "enchantmentCost"),
ENCHANTMENT_COST("global.enchantmentCost.default", SettingValueType.POSITIVE_DOUBLE, 5.0, "enchantmentCost"),
/**
* Whether the cost should increase for damage taken, as opposed to increase for durability present
*/
NATURAL_COST("global.natural-cost", SettingValueType.BOOLEAN, true, "useNaturalCost");
NATURAL_COST("global.useNaturalCost", SettingValueType.BOOLEAN, true, "useNaturalCost");
private final String path;
private final String parent;

View File

@ -7,43 +7,42 @@ import java.util.Arrays;
*/
public enum NPCSetting {
DROP_ITEM("defaults.drop-item", SettingValueType.BOOLEAN, true, "dropItem"),
DISABLE_COOL_DOWN("defaults.disable-cool-down", SettingValueType.BOOLEAN, false, "disableCoolDown"),
DISABLE_DELAY("defaults.disable-delay", SettingValueType.BOOLEAN, false, "disableDelay"),
FAIL_CHANCE("defaults.percent-chance-to-fail-reforge", SettingValueType.PERCENTAGE, 10, "failReforgeChance"),
EXTRA_ENCHANTMENT_CHANCE("defaults.percent-chance-for-extra-enchantment", SettingValueType.PERCENTAGE, 5,
DROP_ITEM("defaults.dropItem", SettingValueType.BOOLEAN, true, "dropItem"),
DISABLE_COOL_DOWN("defaults.disableCoolDown", SettingValueType.BOOLEAN, false, "disableCoolDown"),
DISABLE_DELAY("defaults.disableDelay", SettingValueType.BOOLEAN, false, "disableDelay"),
FAIL_CHANCE("defaults.failReforgeChance", SettingValueType.PERCENTAGE, 10, "failReforgeChance"),
EXTRA_ENCHANTMENT_CHANCE("defaults.extraEnchantmentChance", SettingValueType.PERCENTAGE, 5,
"extraEnchantmentChance"),
MAX_ENCHANTMENTS("defaults.maximum-enchantments", SettingValueType.POSITIVE_INTEGER, 3, "maxEnchantments"),
MAX_REFORGE_DELAY("defaults.delays-in-seconds.maximum", SettingValueType.POSITIVE_INTEGER, 30, "maxReforgeDelay"),
MIN_REFORGE_DELAY("defaults.delays-in-seconds.minimum", SettingValueType.POSITIVE_INTEGER, 5, "minReforgeDelay"),
REFORGE_COOL_DOWN("defaults.delays-in-seconds.reforge-cool-down", SettingValueType.POSITIVE_INTEGER, 60, "reforgeCoolDown"),
REFORGE_ABLE_ITEMS("defaults.reforge-able-items", SettingValueType.STRING_LIST, new String[]{}, "reforgeAbleItems"),
MAX_ENCHANTMENTS("defaults.maxEnchantments", SettingValueType.POSITIVE_INTEGER, 3, "maxEnchantments"),
MAX_REFORGE_DELAY("defaults.delaysInSeconds.maximum", SettingValueType.POSITIVE_INTEGER, 30, "maxReforgeDelay"),
MIN_REFORGE_DELAY("defaults.delaysInSeconds.minimum", SettingValueType.POSITIVE_INTEGER, 5, "minReforgeDelay"),
REFORGE_COOL_DOWN("defaults.delaysInSeconds.reforgeCoolDown", SettingValueType.POSITIVE_INTEGER, 60, "reforgeCoolDown"),
REFORGE_ABLE_ITEMS("defaults.reforgeAbleItems", SettingValueType.STRING_LIST, new String[]{}, "reforgeAbleItems"),
/*-----------
| Messages |
-----------*/
BUSY_WITH_PLAYER_MESSAGE("defaults.messages.busy-with-player", SettingValueType.STRING,
BUSY_WITH_PLAYER_MESSAGE("defaults.messages.busyPlayerMessage", SettingValueType.STRING,
"&cI'm busy at the moment. Come back later!", "busyPlayerMessage"),
//TODO: Add placeholder for remaining time?
BUSY_WITH_REFORGE_MESSAGE("defaults.messages.busy-with-reforge", SettingValueType.STRING,
BUSY_WITH_REFORGE_MESSAGE("defaults.messages.busyReforgeMessage", SettingValueType.STRING,
"&cI'm working on it. Be patient!", "busyReforgeMessage"),
//TODO: Add placeholder for remaining time?
COOL_DOWN_UNEXPIRED_MESSAGE("defaults.messages.cool-down-not-expired", SettingValueType.STRING,
COOL_DOWN_UNEXPIRED_MESSAGE("defaults.messages.coolDownUnexpiredMessage", SettingValueType.STRING,
"&cYou've already had your chance! Give me a break!", "coolDownUnexpiredMessage"),
COST_MESSAGE(
"defaults.messages.cost", SettingValueType.STRING,
COST_MESSAGE("defaults.messages.costMessage", SettingValueType.STRING,
"&eIt will cost &a<price> &eto reforge that &a<item>&e! Click again to reforge!", "costMessage"),
FAIL_MESSAGE("defaults.messages.fail-reforge", SettingValueType.STRING, "&cWhoops! Didn't mean to do that! Maybe next time?",
"failReforgeMessage"),
INSUFFICIENT_FUNDS_MESSAGE("defaults.messages.insufficient-funds", SettingValueType.STRING,
FAIL_MESSAGE("defaults.messages.failReforgeMessage", SettingValueType.STRING,
"&cWhoops! Didn't mean to do that! Maybe next time?", "failReforgeMessage"),
INSUFFICIENT_FUNDS_MESSAGE("defaults.messages.insufficientFundsMessage", SettingValueType.STRING,
"&cYou don't have enough money to reforge that item!", "insufficientFundsMessage"),
INVALID_ITEM_MESSAGE("defaults.messages.invalid-item", SettingValueType.STRING,
INVALID_ITEM_MESSAGE("defaults.messages.invalidItemMessage", SettingValueType.STRING,
"&cI'm sorry, but I don't know how to reforge that!", "invalidItemMessage"),
ITEM_UNEXPECTEDLY_CHANGED_MESSAGE("defaults.messages.item-changed-during-reforge", SettingValueType.STRING,
ITEM_UNEXPECTEDLY_CHANGED_MESSAGE("defaults.messages.itemChangedMessage", SettingValueType.STRING,
"&cThat's not the item you wanted to reforge before!", "itemChangedMessage"),
START_REFORGE_MESSAGE("defaults.messages.start-reforge", SettingValueType.STRING,
START_REFORGE_MESSAGE("defaults.messages.startReforgeMessage", SettingValueType.STRING,
"&eOk, let's see what I can do...", "startReforgeMessage"),
SUCCESS_MESSAGE("defaults.messages.successful-reforge", SettingValueType.STRING,
SUCCESS_MESSAGE("defaults.messages.successMessage", SettingValueType.STRING,
"There you go! All better!", "successMessage");
private final String path;

View File

@ -183,7 +183,7 @@ public class NPCSettings {
}
/**
* Gets the minimum delay used to wait for a re-forge to finish.
* Gets the minimum delay used to wait for a reforging to finish.
*
* @return <p>The minimum reforge delay</p>
*/
@ -192,7 +192,7 @@ public class NPCSettings {
}
/**
* Gets the maximum delay used to wait for a re-forge to finish
* Gets the maximum delay used to wait for a reforging to finish
*
* @return <p>The maximum reforge delay</p>
*/
@ -210,7 +210,7 @@ public class NPCSettings {
}
/**
* Gets the chance to fail a re-forge
* Gets the chance to fail a reforging
*
* @return <p>The fail chance</p>
*/
@ -255,7 +255,7 @@ public class NPCSettings {
}
/**
* Gets whether to disable the delay between starting reforging and the re-forge finishing
* Gets whether to disable the delay between starting reforging and the reforging finishing
*
* @return <p>Whether to disable the reforge delay</p>
*/

View File

@ -144,7 +144,7 @@ public enum SmithPreset {
}
/**
* Gets material names of all materials re-forge-able by this smith
* Gets material names of all materials reforge-able by this smith
*
* @return <p>All material names for this smith</p>
*/

View File

@ -44,7 +44,7 @@ public class EconomyManager {
* Gets whether the given player can pay for re-forging their held item
*
* @param player <p>The player holding an item</p>
* @return <p>Whether the player can pay for the re-forge</p>
* @return <p>Whether the player can pay for the reforge</p>
*/
public static boolean canPay(Player player) {
return economy.getBalance(player) - getHeldItemCost(player) >= 0;
@ -62,7 +62,7 @@ public class EconomyManager {
}
/**
* Withdraws the re-forge cost from the given player
* Withdraws the reforging cost from the given player
*
* <p>The cost is automatically calculated from the item in the player's main hand.</p>
*

View File

@ -53,9 +53,9 @@ public class BlacksmithTrait extends Trait {
}
/**
* Gets whether this blacksmith is already in a re-forge session
* Gets whether this blacksmith is already in a reforging session
*
* @return <p>Whether already in a re-forge session</p>
* @return <p>Whether already in a reforge session</p>
*/
public boolean hasSession() {
return this.session != null;

View File

@ -57,13 +57,13 @@ public class ReforgeSession implements Runnable {
}
/**
* Runs the actual re-forge which fixes the item and gives it back to the player
* Runs the actual reforge which fixes the item and gives it back to the player
*/
@Override
public void run() {
sendNPCMessage(this.npc, player, reforgeItem() ? config.getSuccessMessage() : config.getFailMessage());
//Stop the re-forged item from displaying in the blacksmith's hand
//Stop the reforged item from displaying in the blacksmith's hand
if (npc.getEntity() instanceof Player) {
((Player) npc.getEntity()).getInventory().setItemInMainHand(null);
} else {
@ -93,9 +93,9 @@ public class ReforgeSession implements Runnable {
}
/**
* Performs the actual re-forge where the item's damage is reduced
* Performs the actual reforge where the item's damage is reduced
*
* @return <p>Whether the re-forge was successful. False if the blacksmith failed to fully repair the item.</p>
* @return <p>Whether the reforge was successful. False if the blacksmith failed to fully repair the item.</p>
*/
private boolean reforgeItem() {
if (random.nextInt(100) < config.getFailChance()) {
@ -108,7 +108,7 @@ public class ReforgeSession implements Runnable {
}
/**
* The method to run when a blacksmith successfully re-forges an item
* The method to run when a blacksmith successfully reforges an item
*/
private void succeedReforge() {
// Remove any damage done to the item
@ -223,10 +223,10 @@ public class ReforgeSession implements Runnable {
}
/**
* Gets whether the given player is currently in a re-forge session
* Gets whether the given player is currently in a reforging session
*
* @param other <p>The player to check if is in session</p>
* @return <p>True if the given player is in a re-forge session</p>
* @return <p>True if the given player is in a reforge session</p>
*/
public boolean isInSession(Player other) {
return player.getName().equals(other.getName());
@ -237,12 +237,12 @@ public class ReforgeSession implements Runnable {
*/
public void beginReforge() {
if (!config.getDisableCoolDown()) {
//Finish the re-forge after a random delay between the max and min
//Finish the reforging after a random delay between the max and min
taskId = BlacksmithPlugin.getInstance().getServer().getScheduler().scheduleSyncDelayedTask(
BlacksmithPlugin.getInstance(), this, (new Random().nextInt(config.getMaxReforgeDelay()) +
config.getMinReforgeDelay()) * 20L);
} else {
//Finish the re-forge as soon as possible
//Finish the reforging as soon as possible
taskId = BlacksmithPlugin.getInstance().getServer().getScheduler().scheduleSyncDelayedTask(
BlacksmithPlugin.getInstance(), this, 0);
}

View File

@ -3,87 +3,89 @@
# The settings which apply to all Blacksmith NPCs
global:
# The minimum price of each cost
base-price:
basePrice:
# You can add, for example "diamond-sword: 15.3" to change the base cost for a specific item
default: 10.0
# The additional cost for each durability point missing (natural cost) or present (not natural cost)
price-per-durability-point:
pricePerDurabilityPoint:
# You can add, for example "diamond-sword: 0.09" to change the base cost for a specific item
default: 0.005
# The additional cost for each enchantment level present on an item
enchantment-cost:
enchantmentCost:
# You can add, for example "arrow-infinite: 0.09" to change the enchantment cost for a specific enchantment
default: 5
# Natural cost makes re-forging more expensive the more damaged the item is. Disabling this will enable the legacy
# blacksmith behavior instead
natural-cost: true
useNaturalCost: true
# The settings which are set to any new NPC. To change any of these settings for an existing NPC, you must change the
# Citizens NPC file
defaults:
# Whether the item will drop a re-forged item on the ground, instead of putting it into the user's inventory
drop-item: true
# Whether the item will drop a reforged item on the ground, instead of putting it into the user's inventory
dropItem: true
# The items a blacksmith is able to reforge. Setting this only allows the NPC to repair the listed items
reforge-able-items: [ ]
# The items a blacksmith is able to reforge. Setting this only allows NPCs to repair the listed items. This should be
# set for each individual NPC, and should not be set here, unless you want to restrict NPCs which have not been set
# up yet.
reforgeAbleItems: [ ]
# Whether to disable the cool-down period between each re-forge
disable-cool-down: false
# Whether to disable the cool-down period between each reforge
disableCoolDown: false
# Whether to disable the re-forge delay, making re-forging complete instantly
disable-delay: false
# Whether to disable the reforging delay, making re-forging complete instantly
disableDelay: false
# The chance to fail a re-forge, which only repairs the item a tiny bit or not at all (0-100)
percent-chance-to-fail-reforge: 10
# The chance to fail reforging an item, which only repairs the item a tiny bit or not at all (0-100)
failReforgeChance: 10 # Default = 10%
# The chance that an enchantment will be added to the re-forged item (0-100)
percent-chance-for-extra-enchantment: 5
# The chance that an enchantment will be added to the reforged item (0-100)
extraEnchantmentChance: 5 # Default = 5%
# The maximum number of enchantments the blacksmith will try to add
maximum-enchantments: 3
maxEnchantments: 3
# All settable delays
delays-in-seconds:
# The maximum time for a re-forge to finish
delaysInSeconds:
# The maximum time for a reforging to finish
maximum: 30
# The minimum time for a re-forge to finish
# The minimum time for a reforging to finish
minimum: 5
# The cool-down period between each re-forge
reforge-cool-down: 60
# The cool-down period between each reforge
reforgeCoolDown: 60
# All messages used by the NPC
messages:
# The message to display when another player is using the blacksmith
busy-with-player: "&cI'm busy at the moment. Come back later!"
busyPlayerMessage: "&cI'm busy at the moment. Come back later!"
# The message to display when the blacksmith is working on the re-forge
busy-with-reforge: "&cI'm working on it. Be patient!"
# The message to display when the blacksmith is working on the reforging
busyReforgeMessage: "&cI'm working on it. Be patient!"
# The message to display when the blacksmith is still on a cool-down from the previous re-forging
cool-down-not-expired: "&cYou've already had your chance! Give me a break!"
coolDownUnexpiredMessage: "&cYou've already had your chance! Give me a break!"
# The message to display when informing a player about the re-forge cost
cost: "&eIt will cost &a<price> &eto reforge that &a<item>&e! Click again to reforge!"
# The message to display when informing a player about the reforging cost
costMessage: "&eIt will cost &a<price> &eto reforge that &a<item>&e! Click again to reforge!"
# The message to display when the blacksmith fails to re-forge an item
fail-reforge: "&cWhoops! Didn't mean to do that! Maybe next time?"
# The message to display when the blacksmith fails to reforge an item
failReforgeMessage: "&cWhoops! Didn't mean to do that! Maybe next time?"
# The message to display when a player cannot pay for the re-forge
insufficient-funds: "&cYou don't have enough money to reforge that item!"
# The message to display when a player cannot pay for the reforging
insufficientFundsMessage: "&cYou don't have enough money to reforge that item!"
# The message to display when holding an item the blacksmith is unable to re-forge
invalid-item: "&cI'm sorry, but I don't know how to reforge that!"
# The message to display when holding an item the blacksmith is unable to reforge
invalidItemMessage: "&cI'm sorry, but I don't know how to reforge that!"
# The message to display when presenting a different item than the one just evaluated
item-changed-during-reforge: "&cThat's not the item you wanted to reforge before!"
itemChangedMessage: "&cThat's not the item you wanted to reforge before!"
# The message to display once the blacksmith starts re-forging
start-reforge: "&eOk, let's see what I can do..."
startReforgeMessage: "&eOk, let's see what I can do..."
# The message to display once the re-forge has successfully finished
successful-reforge: "There you go! All better!"
# The message to display once the reforging has successfully finished
successMessage: "There you go! All better!"