Fix circle claim and bump the max radius.

This commit is contained in:
Olof Larsson 2014-10-14 08:19:00 +02:00
parent 2c08c1a32c
commit 8f694e6277
4 changed files with 17 additions and 24 deletions

View File

@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
public class CmdFactionsSet extends FactionsCommand

View File

@ -36,26 +36,22 @@ public class CmdFactionsSetCircle extends CmdFactionsSetXRadius
final PS chunk = PS.valueOf(me).getChunk(true);
final Set<PS> chunks = new LinkedHashSet<PS>();
chunks.add(chunk); // The center should come first for pretty messages
Integer radiusZero = this.getRadiusZero();
if (radiusZero == null) return null;
double radius = radiusZero + 1.5; // Tweak ze magic constant to get ze requested behavior.
double radiusSquared = radius * radius;
double radiusSquared = radiusZero * radiusZero;
chunks.add(chunk); // The center should come first for pretty messages
final int xmin = chunk.getChunkX() - radiusZero;
final int xmax = chunk.getChunkX() + radiusZero;
final int zmin = chunk.getChunkZ() - radiusZero;
final int zmax = chunk.getChunkZ() + radiusZero;
for (int x = xmin; x <= xmax; x++)
for (int dx = -radiusZero; dx <= radiusZero; dx++)
{
for (int z = zmin; z <= zmax; z++)
for (int dz = -radiusZero; dz <= radiusZero; dz++)
{
double dx = x - chunk.getChunkX();
double dz = z - chunk.getChunkZ();
if (dx*dx + dz*dz > radiusSquared) continue;
int x = chunk.getChunkX() + dx;
int z = chunk.getChunkZ() + dz;
chunks.add(chunk.withChunkX(x).withChunkZ(z));
}
}

View File

@ -36,20 +36,18 @@ public class CmdFactionsSetSquare extends CmdFactionsSetXRadius
final PS chunk = PS.valueOf(me).getChunk(true);
final Set<PS> chunks = new LinkedHashSet<PS>();
chunks.add(chunk); // The center should come first for pretty messages
Integer radiusZero = this.getRadiusZero();
if (radiusZero == null) return null;
chunks.add(chunk); // The center should come first for pretty messages
final int xmin = chunk.getChunkX() - radiusZero;
final int xmax = chunk.getChunkX() + radiusZero;
final int zmin = chunk.getChunkZ() - radiusZero;
final int zmax = chunk.getChunkZ() + radiusZero;
for (int x = xmin; x <= xmax; x++)
for (int dx = -radiusZero; dx <= radiusZero; dx++)
{
for (int z = zmin; z <= zmax; z++)
for (int dz = -radiusZero; dz <= radiusZero; dz++)
{
int x = chunk.getChunkX() + dx;
int z = chunk.getChunkZ() + dz;
chunks.add(chunk.withChunkX(x).withChunkZ(z));
}
}

View File

@ -151,7 +151,7 @@ public class MConf extends Entity<MConf>
// SET LIMITS
// -------------------------------------------- //
public int setRadiusMax = 5;
public int setRadiusMax = 30;
public int setFillMax = 1000;
// -------------------------------------------- //