1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-01 15:03:36 +01:00

mcmmo skills and minimum payment

This commit is contained in:
Zrips 2015-12-21 19:31:18 +02:00
parent e24a527713
commit 73ed579dcb
3 changed files with 32 additions and 4 deletions

View File

@ -528,6 +528,7 @@ public class Jobs {
OfflinePlayer dude = jPlayer.getPlayer(); OfflinePlayer dude = jPlayer.getPlayer();
// Calculate income // Calculate income
Double amount = income + ((income * multiplier) - income) + ((income * prog.getJob().getMoneyBoost()) - income) + ((income * prog.getMoneyBoost()) Double amount = income + ((income * multiplier) - income) + ((income * prog.getJob().getMoneyBoost()) - income) + ((income * prog.getMoneyBoost())
- income) + itemMoneyBoost + armorMoneyBoost; - income) + itemMoneyBoost + armorMoneyBoost;
@ -536,6 +537,13 @@ public class Jobs {
amount += moneyBonus; amount += moneyBonus;
} }
if (ConfigManager.getJobsConfiguration().useMinimumOveralPayment && income > 0) {
double maxLimit = income * ConfigManager.getJobsConfiguration().MinimumOveralPaymentLimit;
if (amount < maxLimit) {
amount = maxLimit;
}
}
// Calculate exp // Calculate exp
double expAmount = exp + ((exp * multiplier) - exp) + ((exp * prog.getJob().getExpBoost()) - exp) + ((exp * prog.getExpBoost()) - exp) + itemExpBoost double expAmount = exp + ((exp * multiplier) - exp) + ((exp * prog.getJob().getExpBoost()) - exp) + ((exp * prog.getExpBoost()) - exp) + itemExpBoost
+ armorExpBoost; + armorExpBoost;
@ -545,6 +553,13 @@ public class Jobs {
expAmount += expBonus; expAmount += expBonus;
} }
if (ConfigManager.getJobsConfiguration().useMinimumOveralPayment && exp > 0) {
double maxLimit = exp * ConfigManager.getJobsConfiguration().MinimumOveralPaymentLimit;
if (exp < maxLimit) {
exp = maxLimit;
}
}
if (!isUnderMoneyLimit(dude, amount)) { if (!isUnderMoneyLimit(dude, amount)) {
amount = 0.0000000001; amount = 0.0000000001;
if (ConfigManager.getJobsConfiguration().EconomyExpStop) if (ConfigManager.getJobsConfiguration().EconomyExpStop)

View File

@ -78,10 +78,11 @@ public class JobsConfiguration {
public int EconomyLimitTimeLimit, EconomyExpTimeLimit; public int EconomyLimitTimeLimit, EconomyExpTimeLimit;
public int EconomyLimitAnnouncmentDelay, EconomyLimitAnnouncmentExpDelay, globalblocktimer, CowMilkingTimer, public int EconomyLimitAnnouncmentDelay, EconomyLimitAnnouncmentExpDelay, globalblocktimer, CowMilkingTimer,
CoreProtectInterval, BlockPlaceInterval, InfoUpdateInterval; CoreProtectInterval, BlockPlaceInterval, InfoUpdateInterval;
public Double payNearSpawnerMultiplier, VIPpayNearSpawnerMultiplier, TreeFellerMultiplier, gigaDrillMultiplier, PetPay, VipPetPay; public Double payNearSpawnerMultiplier, VIPpayNearSpawnerMultiplier, TreeFellerMultiplier, gigaDrillMultiplier, superBreakerMultiplier, PetPay, VipPetPay;
public String localeString; public String localeString;
public boolean useBlockProtection; public boolean useBlockProtection;
public boolean useBlockTimer; public boolean useBlockTimer;
public boolean useMinimumOveralPayment;
public boolean useBreederFinder, CancelCowMilking; public boolean useBreederFinder, CancelCowMilking;
public boolean fixAtMaxLevel, ToggleActionBar, TitleChangeChat, TitleChangeActionBar, LevelChangeChat, public boolean fixAtMaxLevel, ToggleActionBar, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAcountChat, LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAcountChat,
@ -90,6 +91,7 @@ public class JobsConfiguration {
public Integer levelLossPercentage, SoundLevelupVolume, SoundLevelupPitch, SoundTitleChangeVolume, public Integer levelLossPercentage, SoundLevelupVolume, SoundLevelupPitch, SoundTitleChangeVolume,
SoundTitleChangePitch, ToplistInScoreboardInterval; SoundTitleChangePitch, ToplistInScoreboardInterval;
public double BoostExp; public double BoostExp;
public double MinimumOveralPaymentLimit;
public double BoostMoney; public double BoostMoney;
public double DynamicPaymentMaxPenalty; public double DynamicPaymentMaxPenalty;
public double DynamicPaymentMaxBonus; public double DynamicPaymentMaxBonus;
@ -428,9 +430,15 @@ public class JobsConfiguration {
"Setting this too low may cause tick lag. Increase this to improve economy performance (at the cost of delays in payment)"); "Setting this too low may cause tick lag. Increase this to improve economy performance (at the cost of delays in payment)");
economyBatchDelay = getInt("economy-batch-delay", 5, config, writer); economyBatchDelay = getInt("economy-batch-delay", 5, config, writer);
writer.addComment("economy-async", "Enable async economy calls.", "Disabl this if you have issues with payments or your plugin is not thread safe."); writer.addComment("economy-async", "Enable async economy calls.", "Disable this if you have issues with payments or your plugin is not thread safe.");
economyAsync = getBoolean("economy-async", true, config, writer); economyAsync = getBoolean("economy-async", true, config, writer);
writer.addComment("Economy.MinimumOveralPayment.use",
"Determines minimum payment. In example if player uses McMMO treefeller and earns only 20%, but at same time he gets 25% penalty from dynamic payment. He can 'get' negative amount of money",
"This will limit it to particular percentage", "Works only when original payment is above 0");
useMinimumOveralPayment = getBoolean("Economy.MinimumOveralPayment.use", true, config, writer);
MinimumOveralPaymentLimit = getDouble("Economy.MinimumOveralPayment.limit", 0.1, config, writer);
writer.addComment("Economy.DynamicPayment.use", "Do you want to use dinamic payment dependent on how many players already working for jobs", writer.addComment("Economy.DynamicPayment.use", "Do you want to use dinamic payment dependent on how many players already working for jobs",
"This can help automaticaly lift up payments for not so popular jobs and lower for most popular ones"); "This can help automaticaly lift up payments for not so popular jobs and lower for most popular ones");
useDynamicPayment = getBoolean("Economy.DynamicPayment.use", false, config, writer); useDynamicPayment = getBoolean("Economy.DynamicPayment.use", false, config, writer);
@ -593,6 +601,9 @@ public class JobsConfiguration {
writer.addComment("ExploitProtections.McMMO.gigaDrillMultiplier", "Players will get part of money from braking blocks with gigaDrill ability enabled.", writer.addComment("ExploitProtections.McMMO.gigaDrillMultiplier", "Players will get part of money from braking blocks with gigaDrill ability enabled.",
"0.2 means 20% of original price"); "0.2 means 20% of original price");
gigaDrillMultiplier = getDouble("ExploitProtections.McMMO.gigaDrillMultiplier", 0.2, config, writer); gigaDrillMultiplier = getDouble("ExploitProtections.McMMO.gigaDrillMultiplier", 0.2, config, writer);
writer.addComment("ExploitProtections.McMMO.superBreakerMultiplier", "Players will get part of money from braking blocks with super breaker ability enabled.",
"0.2 means 20% of original price");
superBreakerMultiplier = getDouble("ExploitProtections.McMMO.superBreakerMultiplier", 0.2, config, writer);
writer.addComment("ExploitProtections.Spawner.PreventSlimeSplit", "Prevent slime spliting when they are from spawner", writer.addComment("ExploitProtections.Spawner.PreventSlimeSplit", "Prevent slime spliting when they are from spawner",
"Protects agains exploiting as new splited slimes is treated as naturaly spawned and not from spawner"); "Protects agains exploiting as new splited slimes is treated as naturaly spawned and not from spawner");

View File

@ -311,9 +311,11 @@ public class JobsPaymentListener implements Listener {
try { try {
if (McMMOlistener.mcMMOPresent) if (McMMOlistener.mcMMOPresent)
if (AbilityAPI.treeFellerEnabled(player)) if (AbilityAPI.treeFellerEnabled(player))
multiplier -= (1 - ConfigManager.getJobsConfiguration().TreeFellerMultiplier); multiplier = multiplier * ConfigManager.getJobsConfiguration().TreeFellerMultiplier;
else if (AbilityAPI.gigaDrillBreakerEnabled(player)) else if (AbilityAPI.gigaDrillBreakerEnabled(player))
multiplier -= (1 - ConfigManager.getJobsConfiguration().gigaDrillMultiplier); multiplier = multiplier * ConfigManager.getJobsConfiguration().gigaDrillMultiplier;
else if (AbilityAPI.superBreakerEnabled(player))
multiplier = multiplier * ConfigManager.getJobsConfiguration().superBreakerMultiplier;
} catch (IndexOutOfBoundsException e) { } catch (IndexOutOfBoundsException e) {
} }