Thanks @AEtherSurfer, changed the order of faction and radius in the claim command and added a maximum radius.

This commit is contained in:
Olof Larsson 2013-04-24 20:17:20 +02:00
parent ce1c69d0ca
commit 882bdf4c88
3 changed files with 24 additions and 11 deletions

View File

@ -4,7 +4,7 @@ import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.UConf;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.task.SpiralTask;
import com.massivecraft.mcore.cmd.arg.ARInteger;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
@ -19,8 +19,8 @@ public class CmdFactionsClaim extends FCommand
{
this.addAliases("claim");
this.addOptionalArg("faction", "you");
this.addOptionalArg("radius", "1");
this.addOptionalArg("faction", "you");
this.addRequirements(ReqHasPerm.get(Perm.CLAIM.node));
this.addRequirements(ReqIsPlayer.get());
@ -30,12 +30,12 @@ public class CmdFactionsClaim extends FCommand
public void perform()
{
// Args
final Faction forFaction = this.arg(0, ARFaction.get(me));
if (forFaction == null) return;
Integer radius = this.arg(1, ARInteger.get(), 1);
Integer radius = this.arg(0, ARInteger.get(), 1);
if (radius == null) return;
final Faction forFaction = this.arg(1, ARFaction.get(me), myFaction);
if (forFaction == null) return;
// FPerm
if (!FPerm.TERRITORY.has(sender, forFaction, true)) return;
@ -46,6 +46,12 @@ public class CmdFactionsClaim extends FCommand
return;
}
if (radius > MConf.get().radiusClaimRadiusLimit && !fme.isUsingAdminMode())
{
msg("<b>The maximum radius allowed is <h>%s<b>.", MConf.get().radiusClaimRadiusLimit);
return;
}
// Apply
// single chunk
@ -70,7 +76,7 @@ public class CmdFactionsClaim extends FCommand
new SpiralTask(PS.valueOf(me), radius)
{
private int failCount = 0;
private final int limit = UConf.get(me).radiusClaimFailureLimit - 1;
private final int limit = MConf.get().radiusClaimFailureLimit - 1;
@Override
public boolean work()

View File

@ -51,6 +51,16 @@ public class MConf extends Entity<MConf>
public boolean removePlayerDataWhenBanned = true;
public double removePlayerDataAfterInactiveDays = 20.0;
// -------------------------------------------- //
// CLAIM LIMITS
// -------------------------------------------- //
// if someone is doing a radius claim and the process fails to claim land this many times in a row, it will exit
public int radiusClaimFailureLimit = 9;
// the maximum radius allowed when using the claim command.
public int radiusClaimRadiusLimit = 5;
// -------------------------------------------- //
// CHAT
// -------------------------------------------- //

View File

@ -76,9 +76,6 @@ public class UConf extends Entity<UConf>
public int claimsRequireMinFactionMembers = 1;
public int claimedLandsMax = 0;
// if someone is doing a radius claim and the process fails to claim land this many times in a row, it will exit
public int radiusClaimFailureLimit = 9;
// -------------------------------------------- //
// HOMES
// -------------------------------------------- //