Factions/src/com/massivecraft/factions/cmd/CmdUnclaimall.java

50 lines
1.3 KiB
Java

package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.struct.Permission;
public class CmdUnclaimall extends FCommand
{
public CmdUnclaimall()
{
this.aliases.add("unclaimall");
this.aliases.add("declaimall");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.UNCLAIM_ALL.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeAdmin = false;
}
@Override
public void perform()
{
if (Econ.shouldBeUsed())
{
double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded());
if(Conf.bankFactionPaysLandCosts)
{
if ( ! Econ.modifyMoney(myFaction, refund, "to unclaim all faction land", "for unclaiming all faction land")) return;
}
else
{
if ( ! Econ.modifyMoney(fme , refund, "to unclaim all faction land", "for unclaiming all faction land")) return;
}
}
Board.unclaimAll(myFaction.getId());
myFaction.msg("%s<i> unclaimed ALL of your faction's land.", fme.describeTo(myFaction, true));
SpoutFeatures.updateTerritoryDisplayLoc(null);
}
}