Changes configuration values to lower camelcase
Also fixes some grammar mistakes related to the word reforge
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
*/
|
||||
|
@ -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>
|
||||
*/
|
||||
|
@ -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>
|
||||
*
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user