From c1d08d61fb75086b95d5d1785590dcc3decf77f2 Mon Sep 17 00:00:00 2001 From: Zrips Date: Thu, 16 Feb 2023 16:37:21 +0200 Subject: [PATCH] General permission over specific --- .../jobs/config/GeneralConfigManager.java | 15 +++++++++++---- .../com/gamingmesh/jobs/container/JobsPlayer.java | 6 +++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index cfa3afd7..0340dcec 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -95,7 +95,8 @@ public class GeneralConfigManager { SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useSilkTouchProtection, UseCustomNames, PreventSlimeSplit, PreventMagmaCubeSplit, PreventHopperFillUps, PreventBrewingStandFillUps, informOnPaymentDisable, BrowseUseNewLook, payExploringWhenGliding = false, resetExploringData = false, disablePaymentIfMaxLevelReached, disablePaymentIfRiding, - boostedItemsInOffHand = false, boostedItemsInMainHand, boostedArmorItems, boostedItemsSlotSpecific, multiplyBoostedExtraValues, addPermissionBoost /*, preventCropResizePayment*/, payItemDurabilityLoss, + boostedItemsInOffHand = false, boostedItemsInMainHand, boostedArmorItems, boostedItemsSlotSpecific, multiplyBoostedExtraValues, addPermissionBoost, highestPermissionBoost /*, preventCropResizePayment*/, + payItemDurabilityLoss, applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useMinimumOveralExp, useBreederFinder, CancelCowMilking, fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat, LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat, @@ -493,8 +494,14 @@ public class GeneralConfigManager { "When set to true and for example nearSpawner set to -0.98 aka 2% of original payment with other bonuses which should double payment will result in you getting 4% instead of corrent 102% payment", "If set to false all bonus are sumed to one"); multiplyBoostedExtraValues = c.get("multiply-boosted-extra-values", false); - - c.addComment("add-permission-boost", "When enabled we will add all permission bonuses and penalties instead of picking highest one", + + c.addComment("highest-permission-boost", + "Default (false) and we will prioritize specific permission over general, which means that jobs.boost.miner.money.0.5 will override and be used instead of jobs.boost.all.money.0.8", + "When enabled we will pick highest permission node from all accesible ones", + "Only applies while add-permission-boost set to false"); + highestPermissionBoost = c.get("highest-permission-boost", false); + + c.addComment("add-permission-boost", "When enabled we will add all permission bonuses and penalties instead of picking highest one", "This will add access to all permissions from jobs.boost.[jobName].[type].[amount] jobs.boost.all.[type].[amount] jobs.boost.[jobName].all.[amount] and jobs.boost.all.all.[amount] category"); addPermissionBoost = c.get("add-permission-boost", false); @@ -1051,7 +1058,7 @@ public class GeneralConfigManager { c.addComment("JobsGUI.SkipAmount", "Defines by how many slots we need to skip after group"); JobsGUISkipAmount = c.get("JobsGUI.SkipAmount", 2); - c.addComment("JobsGUI.InfoButton.Slot", "Slot for info button. Set it to 0 if you want to disable it","Locale can be customized in locale file under gui->infoLore section"); + c.addComment("JobsGUI.InfoButton.Slot", "Slot for info button. Set it to 0 if you want to disable it", "Locale can be customized in locale file under gui->infoLore section"); InfoButtonSlot = c.get("JobsGUI.InfoButton.Slot", 9); CMIItemStack item = CMILib.getInstance().getItemManager().getItem(c.get("JobsGUI.InfoButton.Material", diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java index 8ea2b36d..126fc30a 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java @@ -406,15 +406,15 @@ public class JobsPlayer { Double boost = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost." + jobName + "." + type.getName(), true, false); Double v1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost." + jobName + ".all", false, false); - if (v1 != 0d && (v1 > boost || v1 < boost)) + if (v1 != 0d && (v1 > boost || v1 < boost && !Jobs.getGCManager().highestPermissionBoost)) boost = v1; v1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost.all.all", false, false); - if (v1 != 0d && (v1 > boost || v1 < boost)) + if (v1 != 0d && (v1 > boost || v1 < boost && !Jobs.getGCManager().highestPermissionBoost)) boost = v1; v1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost.all." + type.getName(), false, false); - if (v1 != 0d && (v1 > boost || v1 < boost)) + if (v1 != 0d && (v1 > boost || v1 < boost && !Jobs.getGCManager().highestPermissionBoost)) boost = v1; return boost;