From 8b2f4549b27454f04e91266bd03abd1ebef02df2 Mon Sep 17 00:00:00 2001 From: Archy-X <63976867+Archy-X@users.noreply.github.com> Date: Tue, 18 Jun 2024 22:08:59 -0700 Subject: [PATCH] Add jobs.income.batching.display_individual option --- .../dev/aurelium/auraskills/common/config/Option.java | 1 + .../aurelium/auraskills/common/level/LevelManager.java | 10 +++++++++- common/src/main/resources/config.yml | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/dev/aurelium/auraskills/common/config/Option.java b/common/src/main/java/dev/aurelium/auraskills/common/config/Option.java index 5532f2ab3..d917e9310 100644 --- a/common/src/main/java/dev/aurelium/auraskills/common/config/Option.java +++ b/common/src/main/java/dev/aurelium/auraskills/common/config/Option.java @@ -52,6 +52,7 @@ public enum Option { JOBS_INCOME_USE_FINAL_XP("jobs.income.use_final_xp", OptionType.BOOLEAN), JOBS_INCOME_BATCHING_ENABLED("jobs.income.batching.enabled", OptionType.BOOLEAN), JOBS_INCOME_BATCHING_INTERVAL_MS("jobs.income.batching.interval_ms", OptionType.INT), + JOBS_INCOME_BATCHING_DISPLAY_INDIVIDUAL("jobs.income.batching.display_individual", OptionType.BOOLEAN), ENABLE_ROMAN_NUMERALS("enable_roman_numerals", OptionType.BOOLEAN), // Damage hologram options DAMAGE_HOLOGRAMS_ENABLED("damage_holograms.enabled", OptionType.BOOLEAN), diff --git a/common/src/main/java/dev/aurelium/auraskills/common/level/LevelManager.java b/common/src/main/java/dev/aurelium/auraskills/common/level/LevelManager.java index e59e17a89..6503b11cd 100644 --- a/common/src/main/java/dev/aurelium/auraskills/common/level/LevelManager.java +++ b/common/src/main/java/dev/aurelium/auraskills/common/level/LevelManager.java @@ -85,16 +85,24 @@ private double addJobsIncome(User user, Skill skill, double amount, @Nullable Xp } double income = source.getIncome().getIncomeEarned(user.toApi(), source.getValues(), skill, amount); + double originalIncome = income; + boolean displayIndividual = false; if (plugin.configBoolean(Option.JOBS_INCOME_BATCHING_ENABLED)) { income = handleBatching(user, income); // Sets income to 0 if not enough time has passed, or gets batched income + displayIndividual = plugin.configBoolean(Option.JOBS_INCOME_BATCHING_DISPLAY_INDIVIDUAL); } if (income > 0 && plugin.getHookManager().isRegistered(EconomyHook.class)) { EconomyHook economy = plugin.getHookManager().getHook(EconomyHook.class); economy.deposit(user, income); } - return income; + if (displayIndividual) { + // If batched and display_individual is true, show the individual income to UI instead of batched + return originalIncome; + } else { + return income; + } } private double handleBatching(User user, double income) { diff --git a/common/src/main/resources/config.yml b/common/src/main/resources/config.yml index 803faa3d4..4e50375d6 100644 --- a/common/src/main/resources/config.yml +++ b/common/src/main/resources/config.yml @@ -105,6 +105,7 @@ jobs: batching: enabled: false interval_ms: 2000 + display_individual: false enable_roman_numerals: false damage_holograms: enabled: true