2011-10-09 21:57:43 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
2011-06-10 21:26:12 +02:00
|
|
|
|
2013-04-09 13:24:55 +02:00
|
|
|
import com.massivecraft.factions.FPerm;
|
2011-10-22 17:03:49 +02:00
|
|
|
import com.massivecraft.factions.Faction;
|
2013-04-09 12:56:29 +02:00
|
|
|
import com.massivecraft.factions.Perm;
|
2011-10-09 14:53:38 +02:00
|
|
|
|
2013-04-10 13:12:22 +02:00
|
|
|
public class CmdFactionsAutoClaim extends FCommand
|
2011-10-09 14:53:38 +02:00
|
|
|
{
|
2013-04-10 13:12:22 +02:00
|
|
|
public CmdFactionsAutoClaim()
|
2011-10-09 14:53:38 +02:00
|
|
|
{
|
|
|
|
super();
|
|
|
|
this.aliases.add("autoclaim");
|
|
|
|
|
|
|
|
//this.requiredArgs.add("");
|
2011-10-22 17:03:49 +02:00
|
|
|
this.optionalArgs.put("faction", "your");
|
2011-10-09 14:53:38 +02:00
|
|
|
|
2013-04-09 12:56:29 +02:00
|
|
|
this.permission = Perm.AUTOCLAIM.node;
|
2011-10-09 14:53:38 +02:00
|
|
|
|
|
|
|
senderMustBePlayer = true;
|
|
|
|
senderMustBeMember = false;
|
2011-10-23 17:55:53 +02:00
|
|
|
senderMustBeOfficer = false;
|
|
|
|
senderMustBeLeader = false;
|
2011-06-10 21:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-10-09 14:53:38 +02:00
|
|
|
public void perform()
|
|
|
|
{
|
2011-10-22 17:03:49 +02:00
|
|
|
Faction forFaction = this.argAsFaction(0, myFaction);
|
2011-10-25 08:27:58 +02:00
|
|
|
if (forFaction == null || forFaction == fme.getAutoClaimFor())
|
2011-10-09 14:53:38 +02:00
|
|
|
{
|
2011-10-22 17:03:49 +02:00
|
|
|
fme.setAutoClaimFor(null);
|
2011-10-10 13:40:24 +02:00
|
|
|
msg("<i>Auto-claiming of land disabled.");
|
2011-06-10 21:26:12 +02:00
|
|
|
return;
|
|
|
|
}
|
2011-10-25 21:18:08 +02:00
|
|
|
|
|
|
|
if ( ! FPerm.TERRITORY.has(fme, forFaction, true)) return;
|
2011-10-22 17:03:49 +02:00
|
|
|
|
|
|
|
fme.setAutoClaimFor(forFaction);
|
|
|
|
|
|
|
|
msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(fme));
|
|
|
|
fme.attemptClaim(forFaction, me.getLocation(), true);
|
2011-06-10 21:26:12 +02:00
|
|
|
}
|
|
|
|
|
2011-10-22 17:03:49 +02:00
|
|
|
}
|