Added radius claim
This commit is contained in:
src/com/massivecraft/factions
@ -1,5 +1,10 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
@ -13,6 +18,7 @@ public class CmdClaim extends FCommand
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("faction", "your");
|
||||
this.optionalArgs.put("radius", "1");
|
||||
|
||||
this.permission = Permission.CLAIM.node;
|
||||
this.disableOnLock = true;
|
||||
@ -28,8 +34,23 @@ public class CmdClaim extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
// Read and validate input
|
||||
Faction forFaction = this.argAsFaction(0, myFaction);
|
||||
fme.attemptClaim(forFaction, me.getLocation(), true);
|
||||
double radius = this.argAsDouble(1, 1d);
|
||||
radius -= 0.5;
|
||||
if (radius <= 0)
|
||||
{
|
||||
msg("<b>That radius is to small.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the FLocations
|
||||
Set<FLocation> flocs = new FLocation(me).getCircle(radius);
|
||||
p.log(flocs);
|
||||
for (FLocation floc : flocs)
|
||||
{
|
||||
fme.attemptClaim(forFaction, new Location(floc.getWorld(), floc.getX()*16, 1, floc.getZ()*16), true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user