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

42 lines
1.0 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
2013-04-16 10:11:59 +02:00
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
2013-04-10 13:12:22 +02:00
public class CmdFactionsAutoClaim extends FCommand
{
2013-04-10 13:12:22 +02:00
public CmdFactionsAutoClaim()
{
super();
2013-04-16 10:11:59 +02:00
this.addAliases("autoclaim");
2013-04-16 10:11:59 +02:00
this.optionalArgs.put("faction", "your");
2013-04-16 10:11:59 +02:00
this.addRequirements(ReqHasPerm.get(Perm.AUTOCLAIM.node));
this.addRequirements(ReqIsPlayer.get());
}
@Override
public void perform()
{
Faction forFaction = this.argAsFaction(0, myFaction);
if (forFaction == null || forFaction == fme.getAutoClaimFor())
{
fme.setAutoClaimFor(null);
2011-10-10 13:40:24 +02:00
msg("<i>Auto-claiming of land disabled.");
return;
}
if ( ! FPerm.TERRITORY.has(fme, forFaction, true)) return;
fme.setAutoClaimFor(forFaction);
msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(fme));
fme.attemptClaim(forFaction, me.getLocation(), true);
}
}