Add possibility for new money system

This commit is contained in:
Magnus Ulf
2019-02-06 12:39:03 +01:00
parent 858343d121
commit 0a0cc047ae
6 changed files with 95 additions and 16 deletions

View File

@ -135,12 +135,10 @@ public class Faction extends Entity<Faction> implements FactionsParticipator, MP
// The powerBoost is a custom increase/decrease to default and maximum power.
// Null means the faction has powerBoost (0).
private Double powerBoost = null;
// Can anyone join the Faction?
// If the faction is open they can.
// If the faction is closed an invite is required.
// Null means default.
// private Boolean open = null;
// The money a Faction has
// null means 0.0
private Double money = null;
// This is the ids of the invited players.
// They are actually "senderIds" since you can invite "@console" to your faction.
@ -425,6 +423,28 @@ public class Faction extends Entity<Faction> implements FactionsParticipator, MP
// Mark as changed
this.changed();
}
// -------------------------------------------- //
// FIELD: money
// -------------------------------------------- //
public double getMoney()
{
if (!MConf.get().econEnabled) throw new UnsupportedOperationException("econ not enabled");
if (!MConf.get().bankEnabled) throw new UnsupportedOperationException("bank not enabled");
if (!MConf.get().useNewMoneySystem) throw new UnsupportedOperationException("this server does not use the new econ system");
return this.convertGet(this.money, 0D);
}
public void setMoney(Double money)
{
if (!MConf.get().econEnabled) throw new UnsupportedOperationException("econ not enabled");
if (!MConf.get().bankEnabled) throw new UnsupportedOperationException("bank not enabled");
if (!MConf.get().useNewMoneySystem) throw new UnsupportedOperationException("this server does not use the new econ system");
this.money = this.convertSet(money, this.money, 0D);
}
// -------------------------------------------- //
// FIELD: open

View File

@ -625,4 +625,6 @@ public class MConf extends Entity<MConf>
// If you set this to false the player executing the command will pay instead.
public boolean bankFactionPaysCosts = true;
public boolean useNewMoneySystem = false;
}