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

53 lines
1.2 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role;
2011-10-09 20:10:19 +02:00
public class CmdAutoClaim extends FCommand
{
2011-10-09 20:10:19 +02:00
public CmdAutoClaim()
{
super();
this.aliases.add("autoclaim");
//this.requiredArgs.add("");
this.optionalArgs.put("faction", "your");
2011-10-09 21:57:43 +02:00
this.permission = Permission.AUTOCLAIM.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
2011-10-23 17:55:53 +02:00
senderMustBeOfficer = false;
senderMustBeLeader = false;
}
@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 (! fme.canClaimForFaction(forFaction))
{
if (myFaction == forFaction)
msg("<b>You must be <h>%s<b> to claim land.", Role.MODERATOR.toString());
else
msg("<b>You can't claim land for <h>%s<b>.", forFaction.describeTo(fme));
return;
}
fme.setAutoClaimFor(forFaction);
msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(fme));
fme.attemptClaim(forFaction, me.getLocation(), true);
}
}