1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-29 04:18:07 +01:00

Option to add all bonuses

This commit is contained in:
Zrips 2023-02-16 16:32:28 +02:00
parent 237cabf82f
commit 4d11d4ef03
6 changed files with 30 additions and 13 deletions

View File

@ -997,8 +997,6 @@ public final class Jobs extends JavaPlugin {
if (jPlayer == null)
return;
CMIDebug.d("action");
List<JobProgression> progression = jPlayer.getJobProgression();
int numjobs = progression.size();

View File

@ -125,7 +125,6 @@ public class BlockProtectionManager {
locations = new ConcurrentHashMap<>();
tempCache.put(loc.getWorld(), locations);
}
CMIDebug.d("Cached");
locations.put(v, Bp);
}

View File

@ -95,7 +95,7 @@ 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/*, preventCropResizePayment*/, payItemDurabilityLoss,
boostedItemsInOffHand = false, boostedItemsInMainHand, boostedArmorItems, boostedItemsSlotSpecific, multiplyBoostedExtraValues, addPermissionBoost /*, preventCropResizePayment*/, payItemDurabilityLoss,
applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useMinimumOveralExp, useBreederFinder,
CancelCowMilking, fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat,
@ -493,6 +493,10 @@ 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",
"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);
// Better implementation?
/*c.addComment("prevent-crop-resize-payment", "Do you want to prevent crop resizing payment when placing more cactus?",

View File

@ -42,8 +42,7 @@ public class NameTranslatorManager {
public String translate(String materialName, ActionType action, int id, String meta, String name) {
// Translating name to user friendly
if (materialName.toLowerCase().contains("arrow"))
CMIDebug.d(materialName, meta, Util.getPotionByName(meta));
if (Jobs.getGCManager().UseCustomNames)
switch (action) {
case BREAK:

View File

@ -383,10 +383,29 @@ public class JobsPlayer {
}
private Double getPlayerBoostNew(String jobName, CurrencyType type) {
Double v1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost." + jobName + "." + type.getName(), true, false);
Double boost = v1;
v1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost." + jobName + ".all", false, false);
if (Jobs.getGCManager().addPermissionBoost) {
Double boost = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost." + jobName + "." + type.getName(), true, true);
Double v1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost." + jobName + ".all", false, true);
if (v1 != 0d)
boost += v1;
v1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost.all.all", false, true);
if (v1 != 0d)
boost += v1;
v1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost.all." + type.getName(), false, true);
if (v1 != 0d)
boost += v1;
return boost;
}
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))
boost = v1;

View File

@ -434,12 +434,9 @@ public final class JobsPaymentListener implements Listener {
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
return;
CMIDebug.d("BlockBreakEvent2");
// check if in creative
if (!payIfCreative(player))
return;
CMIDebug.d("BlockBreakEvent3");
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
return;
@ -1899,7 +1896,8 @@ public final class JobsPaymentListener implements Listener {
}
public static boolean payIfCreative(Player player) {
return player.getGameMode() != GameMode.CREATIVE || Jobs.getGCManager().payInCreative() || Jobs.getPermissionManager().hasPermission(Jobs.getPlayerManager().getJobsPlayer(player), "jobs.paycreative");
return player.getGameMode() != GameMode.CREATIVE || Jobs.getGCManager().payInCreative() || Jobs.getPermissionManager().hasPermission(Jobs.getPlayerManager().getJobsPlayer(player),
"jobs.paycreative");
}
// Prevent item durability loss