2014-10-13 15:14:34 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
2015-10-21 19:35:41 +02:00
|
|
|
import com.massivecraft.factions.cmd.type.TypeFaction;
|
2014-10-13 15:14:34 +02:00
|
|
|
import com.massivecraft.factions.entity.MConf;
|
2015-02-12 12:00:55 +01:00
|
|
|
import com.massivecraft.massivecore.MassiveException;
|
2015-11-06 02:10:29 +01:00
|
|
|
import com.massivecraft.massivecore.command.type.primitive.TypeInteger;
|
2014-10-13 15:14:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
public abstract class CmdFactionsSetXRadius extends CmdFactionsSetX
|
|
|
|
{
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// CONSTRUCT
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2014-11-19 10:30:44 +01:00
|
|
|
public CmdFactionsSetXRadius(boolean claim)
|
2014-10-13 15:14:34 +02:00
|
|
|
{
|
2014-11-19 10:30:44 +01:00
|
|
|
// Super
|
|
|
|
super(claim);
|
|
|
|
|
2015-10-21 19:35:41 +02:00
|
|
|
// Parameters
|
|
|
|
this.addParameter(1, TypeInteger.get(), "radius");
|
2014-11-19 10:30:44 +01:00
|
|
|
if (claim)
|
|
|
|
{
|
2015-10-21 19:35:41 +02:00
|
|
|
this.addParameter(TypeFaction.get(), "faction", "you");
|
2014-11-19 10:30:44 +01:00
|
|
|
this.setFactionArgIndex(1);
|
|
|
|
}
|
2014-10-13 15:14:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// EXTRAS
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2015-02-12 12:00:55 +01:00
|
|
|
public Integer getRadius() throws MassiveException
|
2014-10-13 15:14:34 +02:00
|
|
|
{
|
2015-05-22 10:21:35 +02:00
|
|
|
int radius = this.readArgAt(0);
|
2014-10-13 15:14:34 +02:00
|
|
|
|
|
|
|
// Radius Claim Min
|
|
|
|
if (radius < 1)
|
|
|
|
{
|
|
|
|
msg("<b>If you specify a radius, it must be at least 1.");
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Radius Claim Max
|
2016-02-02 19:03:11 +01:00
|
|
|
if (radius > MConf.get().setRadiusMax && ! msender.isOverriding())
|
2014-10-13 15:14:34 +02:00
|
|
|
{
|
|
|
|
msg("<b>The maximum radius allowed is <h>%s<b>.", MConf.get().setRadiusMax);
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return radius;
|
|
|
|
}
|
|
|
|
|
2015-02-12 12:00:55 +01:00
|
|
|
public Integer getRadiusZero() throws MassiveException
|
2014-10-13 15:14:34 +02:00
|
|
|
{
|
|
|
|
Integer ret = this.getRadius();
|
|
|
|
if (ret == null) return ret;
|
|
|
|
return ret - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|