mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-27 12:46:09 +01:00
Thanks @AEtherSurfer, changed the order of faction and radius in the claim command and added a maximum radius.
This commit is contained in:
parent
ce1c69d0ca
commit
882bdf4c88
@ -4,7 +4,7 @@ import com.massivecraft.factions.FPerm;
|
|||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||||
import com.massivecraft.factions.entity.Faction;
|
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.factions.task.SpiralTask;
|
||||||
import com.massivecraft.mcore.cmd.arg.ARInteger;
|
import com.massivecraft.mcore.cmd.arg.ARInteger;
|
||||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||||
@ -19,8 +19,8 @@ public class CmdFactionsClaim extends FCommand
|
|||||||
{
|
{
|
||||||
this.addAliases("claim");
|
this.addAliases("claim");
|
||||||
|
|
||||||
this.addOptionalArg("faction", "you");
|
|
||||||
this.addOptionalArg("radius", "1");
|
this.addOptionalArg("radius", "1");
|
||||||
|
this.addOptionalArg("faction", "you");
|
||||||
|
|
||||||
this.addRequirements(ReqHasPerm.get(Perm.CLAIM.node));
|
this.addRequirements(ReqHasPerm.get(Perm.CLAIM.node));
|
||||||
this.addRequirements(ReqIsPlayer.get());
|
this.addRequirements(ReqIsPlayer.get());
|
||||||
@ -30,12 +30,12 @@ public class CmdFactionsClaim extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
final Faction forFaction = this.arg(0, ARFaction.get(me));
|
Integer radius = this.arg(0, ARInteger.get(), 1);
|
||||||
if (forFaction == null) return;
|
|
||||||
|
|
||||||
Integer radius = this.arg(1, ARInteger.get(), 1);
|
|
||||||
if (radius == null) return;
|
if (radius == null) return;
|
||||||
|
|
||||||
|
final Faction forFaction = this.arg(1, ARFaction.get(me), myFaction);
|
||||||
|
if (forFaction == null) return;
|
||||||
|
|
||||||
// FPerm
|
// FPerm
|
||||||
if (!FPerm.TERRITORY.has(sender, forFaction, true)) return;
|
if (!FPerm.TERRITORY.has(sender, forFaction, true)) return;
|
||||||
|
|
||||||
@ -46,6 +46,12 @@ public class CmdFactionsClaim extends FCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (radius > MConf.get().radiusClaimRadiusLimit && !fme.isUsingAdminMode())
|
||||||
|
{
|
||||||
|
msg("<b>The maximum radius allowed is <h>%s<b>.", MConf.get().radiusClaimRadiusLimit);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
|
|
||||||
// single chunk
|
// single chunk
|
||||||
@ -70,7 +76,7 @@ public class CmdFactionsClaim extends FCommand
|
|||||||
new SpiralTask(PS.valueOf(me), radius)
|
new SpiralTask(PS.valueOf(me), radius)
|
||||||
{
|
{
|
||||||
private int failCount = 0;
|
private int failCount = 0;
|
||||||
private final int limit = UConf.get(me).radiusClaimFailureLimit - 1;
|
private final int limit = MConf.get().radiusClaimFailureLimit - 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean work()
|
public boolean work()
|
||||||
|
@ -51,6 +51,16 @@ public class MConf extends Entity<MConf>
|
|||||||
public boolean removePlayerDataWhenBanned = true;
|
public boolean removePlayerDataWhenBanned = true;
|
||||||
public double removePlayerDataAfterInactiveDays = 20.0;
|
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
|
// CHAT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -76,9 +76,6 @@ public class UConf extends Entity<UConf>
|
|||||||
public int claimsRequireMinFactionMembers = 1;
|
public int claimsRequireMinFactionMembers = 1;
|
||||||
public int claimedLandsMax = 0;
|
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
|
// HOMES
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
Loading…
Reference in New Issue
Block a user