First try at a tax system

This hasn't been tested. This is a tax system where Factions can tax their players. Later it should be extended do that servers can tax factions based on how much land they have claimed. We start of with this simpler system to make sure that can be tested in real-life environments before we go ahead with the more full fledged system.
This commit is contained in:
Magnus Ulf
2019-07-15 07:55:12 +02:00
parent 193a4acc83
commit 35c38ce4b8
13 changed files with 416 additions and 93 deletions

View File

@@ -51,6 +51,7 @@ public class CmdFactions extends FactionsCommand
public CmdFactionsRelationOld cmdFactionsRelationOldTruce = new CmdFactionsRelationOld("truce");
public CmdFactionsRelationOld cmdFactionsRelationOldNeutral = new CmdFactionsRelationOld("neutral");
public CmdFactionsRelationOld cmdFactionsRelationOldEnemy = new CmdFactionsRelationOld("enemy");
public CmdFactionsTax cmdFactionsTax = new CmdFactionsTax();
public CmdFactionsPerm cmdFactionsPerm = new CmdFactionsPerm();
public CmdFactionsFlag cmdFactionsFlag = new CmdFactionsFlag();
public CmdFactionsFly cmdFactionsFly = new CmdFactionsFly();

View File

@@ -51,7 +51,7 @@ public class CmdFactionsMoneyconvert extends FactionsCommand
" This command allows to convert to the new system where the money of a Faction" +
" is stored within the Factions plugin. Then all economy plugins can be used with Factions.");
}
ConfirmationUtil.tryConfirm(this);
MConf.get().useNewMoneySystem = true;

View File

@@ -0,0 +1,11 @@
package com.massivecraft.factions.cmd;
public class CmdFactionsTax extends FactionsCommand
{
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
}

View File

@@ -0,0 +1,49 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.task.TaskTax;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.money.Money;
import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.massivecore.util.Txt;
import java.util.LinkedHashMap;
public class CmdFactionsTaxInfo extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsTaxInfo()
{
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform() throws MassiveException
{
if (!TaskTax.get().areTaxesEnabled())
{
throw new MassiveException().addMsg("<b>Tax is not enabled on this server.");
}
LinkedHashMap<TimeUnit, Long> timeUnitcounts = TimeDiffUtil.limit(TimeDiffUtil.unitcounts(MConf.get().taxTaskPeriodMillis, TimeUnit.getAll()), 3);
String periodString = TimeDiffUtil.formatedVerboose(timeUnitcounts);
msg("<key>Taxation Period: <i>every %s<i>.", periodString);
long nextTaxationTime = MConf.get().taxTaskPeriodMillis + MConf.get().taxTaskPeriodMillis;
msg("<key>Next Taxation: %s", Txt.getTimeDeltaDescriptionRelNow(nextTaxationTime));
String minTax = Money.format(MConf.get().taxPlayerMinimum);
String maxTax = Money.format(MConf.get().taxPlayerMaximum);
msg("<i>Taxes for players can be set between <reset>%s <i>and <reset>%s<i>.", minTax, maxTax);
}
}