Workaround from player-exploiting the latest suggested config
This commit is contained in:
parent
0af0416235
commit
22670ddb15
@ -241,6 +241,7 @@ public class Conf {
|
|||||||
public static double econCostPower = 0.0;
|
public static double econCostPower = 0.0;
|
||||||
public static double econCostShow = 0.0;
|
public static double econCostShow = 0.0;
|
||||||
public static double econFactionStartingBalance = 0.0;
|
public static double econFactionStartingBalance = 0.0;
|
||||||
|
public static double econDenyWithdrawWhenMinutesAgeLessThan = 2880; // 2 days
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -42,7 +42,10 @@ public class CmdMoneyTransferFf extends FCommand {
|
|||||||
if (to == null) {
|
if (to == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Conf.econFactionStartingBalance != 0 && (System.currentTimeMillis() - myFaction.getFoundedDate()) <= (Conf.econDenyWithdrawWhenMinutesAgeLessThan * 6000)) {
|
||||||
|
msg("Your faction is too young to transfer money like this");
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean success = Econ.transferMoney(fme, from, to, amount);
|
boolean success = Econ.transferMoney(fme, from, to, amount);
|
||||||
|
|
||||||
if (success && Conf.logMoneyTransactions) {
|
if (success && Conf.logMoneyTransactions) {
|
||||||
|
@ -42,6 +42,10 @@ public class CmdMoneyTransferFp extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Conf.econFactionStartingBalance != 0 && (System.currentTimeMillis() - myFaction.getFoundedDate()) <= (Conf.econDenyWithdrawWhenMinutesAgeLessThan * 6000)) {
|
||||||
|
msg("Your faction is too young to transfer money like this");
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean success = Econ.transferMoney(fme, from, to, amount);
|
boolean success = Econ.transferMoney(fme, from, to, amount);
|
||||||
|
|
||||||
if (success && Conf.logMoneyTransactions) {
|
if (success && Conf.logMoneyTransactions) {
|
||||||
|
@ -42,6 +42,10 @@ public class CmdMoneyTransferPf extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Conf.econFactionStartingBalance != 0 && (System.currentTimeMillis() - myFaction.getFoundedDate()) <= (Conf.econDenyWithdrawWhenMinutesAgeLessThan * 6000)) {
|
||||||
|
msg("Your faction is too young to transfer money like this");
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean success = Econ.transferMoney(fme, from, to, amount);
|
boolean success = Econ.transferMoney(fme, from, to, amount);
|
||||||
|
|
||||||
if (success && Conf.logMoneyTransactions) {
|
if (success && Conf.logMoneyTransactions) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.SavageFactions;
|
import com.massivecraft.factions.SavageFactions;
|
||||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
@ -45,6 +46,11 @@ public class CmdMoneyWithdraw extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Conf.econFactionStartingBalance != 0 && (System.currentTimeMillis() - myFaction.getFoundedDate()) <= (Conf.econDenyWithdrawWhenMinutesAgeLessThan * 6000)) {
|
||||||
|
msg("Your faction is too young to withdraw money like this");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean success = Econ.transferMoney(fme, faction, fme, amount);
|
boolean success = Econ.transferMoney(fme, faction, fme, amount);
|
||||||
|
|
||||||
if (success && Conf.logMoneyTransactions) {
|
if (success && Conf.logMoneyTransactions) {
|
||||||
|
@ -270,15 +270,20 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Econ.shouldBeUsed() && !disbanderIsConsole) {
|
if (Econ.shouldBeUsed() && !disbanderIsConsole) {
|
||||||
//Give all the faction's money to the disbander
|
// Should we prevent to withdraw money if the faction was just created
|
||||||
double amount = Econ.getBalance(this.getAccountId());
|
if (Conf.econFactionStartingBalance != 0 && (System.currentTimeMillis() - this.foundedDate) <= (Conf.econDenyWithdrawWhenMinutesAgeLessThan * 6000)) {
|
||||||
Econ.transferMoney(fdisbander, this, fdisbander, amount, false);
|
msg("Your faction is too young to withdraw money like this");
|
||||||
|
} else {
|
||||||
|
//Give all the faction's money to the disbander
|
||||||
|
double amount = Econ.getBalance(this.getAccountId());
|
||||||
|
Econ.transferMoney(fdisbander, this, fdisbander, amount, false);
|
||||||
|
|
||||||
if (amount > 0.0) {
|
if (amount > 0.0) {
|
||||||
String amountString = Econ.moneyString(amount);
|
String amountString = Econ.moneyString(amount);
|
||||||
msg(TL.COMMAND_DISBAND_HOLDINGS, amountString);
|
msg(TL.COMMAND_DISBAND_HOLDINGS, amountString);
|
||||||
//TODO: Format this correctly and translate
|
//TODO: Format this correctly and translate
|
||||||
SavageFactions.plugin.log(fdisbander.getName() + " has been given bank holdings of " + amountString + " from disbanding " + this.getTag() + ".");
|
SavageFactions.plugin.log(fdisbander.getName() + " has been given bank holdings of " + amountString + " from disbanding " + this.getTag() + ".");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user