From 4fa47349c662c6ece4bfc394b794e544b854cac8 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Fri, 14 Oct 2022 00:33:39 +0200 Subject: [PATCH] Removes unnecessary options #8 Removes the DISABLE_COOL_DOWN option Removes the DISABLE_DELAY option Uses the old DISABLE_COOL_DOWN behavior if cool-down is set to 0 or below Uses the old DISABLE_DELAY behavior if max-delay is set to 0 or below --- .../blacksmith/config/NPCSetting.java | 10 ---------- .../blacksmith/config/NPCSettings.java | 18 +++--------------- src/main/resources/config.yml | 6 ------ 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/src/main/java/net/knarcraft/blacksmith/config/NPCSetting.java b/src/main/java/net/knarcraft/blacksmith/config/NPCSetting.java index 4916978..d28f827 100644 --- a/src/main/java/net/knarcraft/blacksmith/config/NPCSetting.java +++ b/src/main/java/net/knarcraft/blacksmith/config/NPCSetting.java @@ -12,16 +12,6 @@ public enum NPCSetting { */ DROP_ITEM("dropItem", SettingValueType.BOOLEAN, true, "dropItem"), - /** - * The setting for whether the cool-down period between reforging sessions should be disabled - */ - DISABLE_COOL_DOWN("disableCoolDown", SettingValueType.BOOLEAN, false, "disableCoolDown"), - - /** - * The setting for whether the delay it takes for an item to be repaired should be disabled - */ - DISABLE_DELAY("disableDelay", SettingValueType.BOOLEAN, false, "disableDelay"), - /** * The setting for the chance of a reforging to fail */ diff --git a/src/main/java/net/knarcraft/blacksmith/config/NPCSettings.java b/src/main/java/net/knarcraft/blacksmith/config/NPCSettings.java index 2ab3df4..7a38da3 100644 --- a/src/main/java/net/knarcraft/blacksmith/config/NPCSettings.java +++ b/src/main/java/net/knarcraft/blacksmith/config/NPCSettings.java @@ -248,7 +248,7 @@ public class NPCSettings { * @return

Whether to drop reforged items on the ground

*/ public boolean getDropItem() { - return asBoolean(NPCSetting.DROP_ITEM); + return ConfigHelper.asBoolean(getValue(NPCSetting.DROP_ITEM)); } /** @@ -257,7 +257,7 @@ public class NPCSettings { * @return

Whether to disable the reforge-cool-down

*/ public boolean getDisableCoolDown() { - return asBoolean(NPCSetting.DISABLE_COOL_DOWN); + return asInt(NPCSetting.REFORGE_COOL_DOWN) <= 0; } /** @@ -266,19 +266,7 @@ public class NPCSettings { * @return

Whether to disable the reforge delay

*/ public boolean getDisableDelay() { - return asBoolean(NPCSetting.DISABLE_DELAY); - } - - /** - * Gets the given value as a boolean - * - *

This will throw an exception if used for a non-boolean value

- * - * @param setting

The setting to get the value of

- * @return

The value of the given setting as a boolean

- */ - private boolean asBoolean(NPCSetting setting) { - return ConfigHelper.asBoolean(getValue(setting)); + return asInt(NPCSetting.MAX_REFORGE_DELAY) <= 0; } /** diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 6d8fdc2..97a2884 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -32,12 +32,6 @@ defaults: # up yet. reforgeAbleItems: [ ] - # Whether to disable the cool-down period between each reforge - disableCoolDown: false - - # Whether to disable the reforging delay, making re-forging complete instantly - disableDelay: false - # 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%