mirror of
https://github.com/Zrips/Jobs.git
synced 2025-02-18 05:11:32 +01:00
Correct way to calculate finall income when it negative
This commit is contained in:
parent
31ce825224
commit
b98c0b87d6
@ -26,7 +26,7 @@ import org.bukkit.plugin.RegisteredServiceProvider;
|
|||||||
|
|
||||||
import com.gamingmesh.jobs.economy.BlackholeEconomy;
|
import com.gamingmesh.jobs.economy.BlackholeEconomy;
|
||||||
import com.gamingmesh.jobs.economy.VaultEconomy;
|
import com.gamingmesh.jobs.economy.VaultEconomy;
|
||||||
import com.gamingmesh.jobs.economy.IConomyAdapter;
|
import com.gamingmesh.jobs.economy.IConomy6Adapter;
|
||||||
|
|
||||||
public class HookEconomyTask implements Runnable {
|
public class HookEconomyTask implements Runnable {
|
||||||
private Jobs plugin;
|
private Jobs plugin;
|
||||||
@ -79,7 +79,7 @@ public class HookEconomyTask implements Runnable {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Jobs.setEconomy(this.plugin, new IConomyAdapter((com.iCo6.iConomy) p));
|
Jobs.setEconomy(this.plugin, new IConomy6Adapter((com.iCo6.iConomy) p));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Jobs.consoleMsg("&e[" + this.plugin.getDescription().getName() + "] UNKNOWN iConomy version.");
|
Jobs.consoleMsg("&e[" + this.plugin.getDescription().getName() + "] UNKNOWN iConomy version.");
|
||||||
return false;
|
return false;
|
||||||
|
@ -924,7 +924,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
// Calculate income
|
// Calculate income
|
||||||
if (income != 0D) {
|
if (income != 0D) {
|
||||||
income = income + ((income > 0D ? income : -income) * boost.getFinal(CurrencyType.MONEY));
|
income = boost.getFinalAmount(CurrencyType.MONEY, income);
|
||||||
if (GconfigManager.useMinimumOveralPayment && income > 0) {
|
if (GconfigManager.useMinimumOveralPayment && income > 0) {
|
||||||
double maxLimit = income * GconfigManager.MinimumOveralPaymentLimit;
|
double maxLimit = income * GconfigManager.MinimumOveralPaymentLimit;
|
||||||
if (income < maxLimit) {
|
if (income < maxLimit) {
|
||||||
@ -935,7 +935,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
// Calculate points
|
// Calculate points
|
||||||
if (pointAmount != 0D) {
|
if (pointAmount != 0D) {
|
||||||
pointAmount = pointAmount + ((pointAmount > 0D ? pointAmount : -pointAmount) * boost.getFinal(CurrencyType.POINTS));
|
pointAmount = boost.getFinalAmount(CurrencyType.POINTS, pointAmount);
|
||||||
if (GconfigManager.useMinimumOveralPoints && pointAmount > 0) {
|
if (GconfigManager.useMinimumOveralPoints && pointAmount > 0) {
|
||||||
double maxLimit = pointAmount * GconfigManager.MinimumOveralPaymentLimit;
|
double maxLimit = pointAmount * GconfigManager.MinimumOveralPaymentLimit;
|
||||||
if (pointAmount < maxLimit) {
|
if (pointAmount < maxLimit) {
|
||||||
@ -945,7 +945,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate exp
|
// Calculate exp
|
||||||
expAmount = expAmount + ((expAmount > 0D ? expAmount : -expAmount) * boost.getFinal(CurrencyType.EXP));
|
expAmount = boost.getFinalAmount(CurrencyType.EXP, expAmount);
|
||||||
|
|
||||||
if (GconfigManager.useMinimumOveralPayment && expAmount > 0) {
|
if (GconfigManager.useMinimumOveralPayment && expAmount > 0) {
|
||||||
double maxLimit = expAmount * GconfigManager.MinimumOveralPaymentLimit;
|
double maxLimit = expAmount * GconfigManager.MinimumOveralPaymentLimit;
|
||||||
|
@ -510,17 +510,15 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
|
|
||||||
double income = info.getIncome(level, numjobs);
|
double income = info.getIncome(level, numjobs);
|
||||||
|
|
||||||
// Jobs.getPlayerManager().getFinalBonus(player, prog)
|
income = boost.getFinalAmount(CurrencyType.MONEY, income);
|
||||||
|
|
||||||
income = income + (income * boost.getFinal(CurrencyType.MONEY));
|
|
||||||
String incomeColor = income >= 0 ? "" : ChatColor.DARK_RED.toString();
|
String incomeColor = income >= 0 ? "" : ChatColor.DARK_RED.toString();
|
||||||
|
|
||||||
double xp = info.getExperience(level, numjobs);
|
double xp = info.getExperience(level, numjobs);
|
||||||
xp = xp + (xp * boost.getFinal(CurrencyType.EXP));
|
xp = boost.getFinalAmount(CurrencyType.EXP, xp);
|
||||||
String xpColor = xp >= 0 ? "" : ChatColor.GRAY.toString();
|
String xpColor = xp >= 0 ? "" : ChatColor.GRAY.toString();
|
||||||
|
|
||||||
double points = info.getPoints(level, numjobs);
|
double points = info.getPoints(level, numjobs);
|
||||||
points = points + (points * boost.getFinal(CurrencyType.POINTS));
|
points = boost.getFinalAmount(CurrencyType.POINTS, points);
|
||||||
String pointsColor = xp >= 0 ? "" : ChatColor.RED.toString();
|
String pointsColor = xp >= 0 ? "" : ChatColor.RED.toString();
|
||||||
|
|
||||||
if (income == 0D && points == 0D && xp == 0D)
|
if (income == 0D && points == 0D && xp == 0D)
|
||||||
|
@ -43,6 +43,10 @@ public class Boost {
|
|||||||
return getFinal(BT, false, false);
|
return getFinal(BT, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFinalAmount(CurrencyType BT, double income) {
|
||||||
|
return income + ((income > 0D ? income : -income) * getFinal(BT, false, false));
|
||||||
|
}
|
||||||
|
|
||||||
public double getFinal(CurrencyType BT, boolean percent, boolean excludeExtra) {
|
public double getFinal(CurrencyType BT, boolean percent, boolean excludeExtra) {
|
||||||
double r = 0D;
|
double r = 0D;
|
||||||
for (BoostOf one : BoostOf.values()) {
|
for (BoostOf one : BoostOf.values()) {
|
||||||
|
1
com/gamingmesh/jobs/economy/.gitignore
vendored
1
com/gamingmesh/jobs/economy/.gitignore
vendored
@ -9,3 +9,4 @@
|
|||||||
/IConomy7Adapter.class
|
/IConomy7Adapter.class
|
||||||
/IConomyAdapter.class
|
/IConomyAdapter.class
|
||||||
/CraftConomy3Adapter.class
|
/CraftConomy3Adapter.class
|
||||||
|
/SaneEconomyAdapter.class
|
||||||
|
@ -5,11 +5,11 @@ import org.bukkit.OfflinePlayer;
|
|||||||
import com.iCo6.iConomy;
|
import com.iCo6.iConomy;
|
||||||
import com.iCo6.system.Accounts;
|
import com.iCo6.system.Accounts;
|
||||||
|
|
||||||
public class IConomyAdapter implements Economy {
|
public class IConomy6Adapter implements Economy {
|
||||||
|
|
||||||
iConomy icon;
|
iConomy icon;
|
||||||
|
|
||||||
public IConomyAdapter(iConomy iconomy) {
|
public IConomy6Adapter(iConomy iconomy) {
|
||||||
icon = iconomy;
|
icon = iconomy;
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
name: Jobs
|
name: Jobs
|
||||||
description: Jobs Plugin for the BukkitAPI
|
description: Jobs Plugin for the BukkitAPI
|
||||||
main: com.gamingmesh.jobs.Jobs
|
main: com.gamingmesh.jobs.Jobs
|
||||||
version: 3.8.0
|
version: 3.8.1
|
||||||
author: phrstbrn
|
author: phrstbrn
|
||||||
softdepend: [Vault, iConomy, MythicMobs, McMMO]
|
softdepend: [Vault, iConomy, MythicMobs, McMMO]
|
||||||
commands:
|
commands:
|
||||||
|
Loading…
Reference in New Issue
Block a user