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

60 lines
1.3 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
2011-07-18 22:06:02 +02:00
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.struct.Permission;
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("");
2011-10-15 19:46:44 +02:00
this.optionalArgs.put("on/off", "flip");
2011-10-09 21:57:43 +02:00
this.permission = Permission.AUTOCLAIM.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeAdmin = false;
}
@Override
public void perform()
{
boolean enabled = this.argAsBool(0, ! fme.isAutoClaimEnabled());
fme.setIsAutoClaimEnabled(enabled);
if ( ! enabled)
{
2011-10-10 13:40:24 +02:00
msg("<i>Auto-claiming of land disabled.");
return;
}
FLocation flocation = new FLocation(fme);
if (Conf.worldsNoClaiming.contains(flocation.getWorldName()))
{
2011-10-10 13:40:24 +02:00
msg("<b>Sorry, this world has land claiming disabled.");
fme.setIsAutoClaimEnabled(false);
return;
}
if (myFaction.getLandRounded() >= myFaction.getPowerRounded())
{
2011-10-10 13:40:24 +02:00
msg("<b>You can't claim more land! You need more power!");
fme.setIsAutoClaimEnabled(false);
return;
}
2011-10-10 13:40:24 +02:00
msg("<i>Auto-claiming of land enabled.");
2011-10-22 16:00:24 +02:00
fme.attemptClaim(myFaction, me.getLocation(), false);
}
}