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

42 lines
997 B
Java

package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Permission;
public class CmdAutoClaim extends FCommand
{
public CmdAutoClaim()
{
super();
this.aliases.add("autoclaim");
//this.requiredArgs.add("");
this.optionalArgs.put("faction", "your");
this.permission = Permission.AUTOCLAIM.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform()
{
Faction forFaction = this.argAsFaction(0, myFaction);
if (forFaction == null || (forFaction == myFaction && fme.getAutoClaimFor() == myFaction))
{
fme.setAutoClaimFor(null);
msg("<i>Auto-claiming of land disabled.");
return;
}
fme.setAutoClaimFor(forFaction);
msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(fme));
fme.attemptClaim(forFaction, me.getLocation(), true);
}
}