From 9a956c6d9a0666ea6692ebc55674aa290337e661 Mon Sep 17 00:00:00 2001 From: NK Date: Wed, 8 Mar 2023 13:32:23 +0000 Subject: [PATCH] adding config to check maximum profit before buying items so it can prevent duped items --- src/main/java/me/night0721/lilase/config/AHConfig.java | 8 ++++++++ src/main/java/me/night0721/lilase/config/ConfigUtils.java | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/me/night0721/lilase/config/AHConfig.java b/src/main/java/me/night0721/lilase/config/AHConfig.java index 0a7d6d5..96bf596 100644 --- a/src/main/java/me/night0721/lilase/config/AHConfig.java +++ b/src/main/java/me/night0721/lilase/config/AHConfig.java @@ -21,6 +21,8 @@ public class AHConfig extends Config { addListener("ONLY_SNIPER", () -> ConfigUtils.writeBooleanConfig("main", "OnlySniper", AHConfig.ONLY_SNIPER)); addListener("CHECK_PERCENTAGE", () -> ConfigUtils.writeBooleanConfig("main", "checkProfitPercentageBeforeBuy", AHConfig.CHECK_PERCENTAGE)); addListener("MINIMUM_PROFIT_PERCENTAGE", () -> ConfigUtils.writeIntConfig("main", "MinimumProfitPercentage", Math.round(AHConfig.MINIMUM_PROFIT_PERCENTAGE))); + addListener("CHECK_MAXIMAL_PROFIT", () -> ConfigUtils.writeBooleanConfig("main", "checkMaxiumProfitPercentageBeforeBuy", AHConfig.CHECK_MAXIMUM_PROFIT)); + addListener("MAXIMUM_PROFIT_PERCENTAGE", () -> ConfigUtils.writeIntConfig("main", "MaximumProfitPercentage", AHConfig.MAXIMUM_PROFIT_PERCENTAGE)); addListener("GUI", () -> ConfigUtils.writeBooleanConfig("main", "GUI", AHConfig.GUI)); addListener("GUI_COLOR", () -> ConfigUtils.writeIntConfig("main", "GUI_COLOR", AHConfig.GUI_COLOR.getRGB())); addListener("ITEM_1_NAME", () -> ConfigUtils.writeStringConfig("item1", "Name", AHConfig.ITEM_1_NAME)); @@ -68,6 +70,12 @@ public class AHConfig extends Config { @Number(name = "Minimum Profit Percentage", min = 100, max = 5000, step = 50, category = "Flipper", description = "Profit percentage to check before buying the item, if the profit percentage is too low, it will not buy the item") public static int MINIMUM_PROFIT_PERCENTAGE = 400; + @Switch(name = "Check Maximum Profit Before Buying", category = "Flipper", description = "Check the maximal profit before buying the item, if the maximal profit is too high, it will not buy the item (Can prevent duped items)") + public static boolean CHECK_MAXIMUM_PROFIT = false; + + @Number(name = "Maximum Profit Percentage", min = 1000, max = 10000, step = 1000, category = "Flipper", description = "Maximum profit to check before buying the item, if the maximal profit is too high, it will not buy the item (Can prevent duped items)") + public static int MAXIMUM_PROFIT_PERCENTAGE = 1000; + @Checkbox(name = "GUI", category = "GUI", description = "Enable the GUI") public static boolean GUI = true; diff --git a/src/main/java/me/night0721/lilase/config/ConfigUtils.java b/src/main/java/me/night0721/lilase/config/ConfigUtils.java index 2d12ca9..c17f8ef 100644 --- a/src/main/java/me/night0721/lilase/config/ConfigUtils.java +++ b/src/main/java/me/night0721/lilase/config/ConfigUtils.java @@ -32,6 +32,10 @@ public class ConfigUtils { if (hasNoKey("main", "OnlySniper")) writeBooleanConfig("main", "OnlySniper", false); if (hasNoKey("main", "checkProfitPercentageBeforeBuy")) writeBooleanConfig("main", "checkProfitPercentageBeforeBuy", false); + if (hasNoKey("main", "checkMaxiumProfitPercentageBeforeBuy")) + writeBooleanConfig("main", "checkMaxiumProfitPercentageBeforeBuy", false); + if (hasNoKey("main", "MaximumProfitPercentage")) + writeIntConfig("main", "MaximumProfitPercentage", 1000); //1000% if (hasNoKey("main", "MinimumProfitPercentage")) writeIntConfig("main", "MinimumProfitPercentage", 400); //400% if (hasNoKey("main", "GUI")) writeBooleanConfig("main", "GUI", true); if (hasNoKey("main", "GUI_COLOR")) writeIntConfig("main", "GUI_COLOR", 0x003153);