From 7884faa548e9d9cff38a1db0a13cd531b2c6e774 Mon Sep 17 00:00:00 2001 From: Yotam Gur Date: Wed, 17 Oct 2018 16:32:41 +0300 Subject: [PATCH 1/3] Allow configuring level XP cost multiplier Minimum is 2 as requested --- src/main/java/slimeknights/toolleveling/config/Config.java | 6 ++++++ .../java/slimeknights/toolleveling/config/ConfigFile.java | 1 + 2 files changed, 7 insertions(+) diff --git a/src/main/java/slimeknights/toolleveling/config/Config.java b/src/main/java/slimeknights/toolleveling/config/Config.java index d4cf393..55ad0a2 100644 --- a/src/main/java/slimeknights/toolleveling/config/Config.java +++ b/src/main/java/slimeknights/toolleveling/config/Config.java @@ -16,6 +16,11 @@ public void load(File file) { ConfigFile.init(); configFile = this.load(new ConfigFile(file), ConfigFile.class); + + if (INSTANCE.configFile.toolxp.levelMultiplier < 2) { + INSTANCE.configFile.toolxp.levelMultiplier = 2f; + INSTANCE.configFile.setNeedsSaving(); + } } public static int getBaseXpForTool(Item item) { @@ -24,6 +29,7 @@ public static int getBaseXpForTool(Item item) { } public static float getLevelMultiplier() { + return INSTANCE.configFile.toolxp.levelMultiplier; } diff --git a/src/main/java/slimeknights/toolleveling/config/ConfigFile.java b/src/main/java/slimeknights/toolleveling/config/ConfigFile.java index 7a41bd3..ecc3b74 100644 --- a/src/main/java/slimeknights/toolleveling/config/ConfigFile.java +++ b/src/main/java/slimeknights/toolleveling/config/ConfigFile.java @@ -85,6 +85,7 @@ static class ToolXP { @Setting(comment = "Base XP for each of the listed tools") public Map baseXpForTool = new HashMap<>(); + @Setting(comment = "How much the XP cost will multiply per level, minimum 2.") public float levelMultiplier = 2f; } } From 36bb160c672faf14963cd57e6ea5b092f446d89f Mon Sep 17 00:00:00 2001 From: Yotam Gur Date: Wed, 17 Oct 2018 16:35:49 +0300 Subject: [PATCH 2/3] Oops --- src/main/java/slimeknights/toolleveling/config/Config.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/slimeknights/toolleveling/config/Config.java b/src/main/java/slimeknights/toolleveling/config/Config.java index 55ad0a2..736e033 100644 --- a/src/main/java/slimeknights/toolleveling/config/Config.java +++ b/src/main/java/slimeknights/toolleveling/config/Config.java @@ -29,7 +29,6 @@ public static int getBaseXpForTool(Item item) { } public static float getLevelMultiplier() { - return INSTANCE.configFile.toolxp.levelMultiplier; } From 3fdeb7ad0c9d16ac5ffd09135db7436ebe66d6fb Mon Sep 17 00:00:00 2001 From: Yotam Gur Date: Wed, 17 Oct 2018 20:45:24 +0300 Subject: [PATCH 3/3] I am clearly not very attentive --- src/main/java/slimeknights/toolleveling/config/Config.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/slimeknights/toolleveling/config/Config.java b/src/main/java/slimeknights/toolleveling/config/Config.java index 736e033..b0f4bec 100644 --- a/src/main/java/slimeknights/toolleveling/config/Config.java +++ b/src/main/java/slimeknights/toolleveling/config/Config.java @@ -17,9 +17,9 @@ public void load(File file) { configFile = this.load(new ConfigFile(file), ConfigFile.class); - if (INSTANCE.configFile.toolxp.levelMultiplier < 2) { - INSTANCE.configFile.toolxp.levelMultiplier = 2f; - INSTANCE.configFile.setNeedsSaving(); + if (configFile.toolxp.levelMultiplier < 2) { + configFile.toolxp.levelMultiplier = 2f; + configFile.setNeedsSaving(); } }