Fix circle claim and bump the max radius.
This commit is contained in:
		@@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.massivecraft.factions.Perm;
 | 
					import com.massivecraft.factions.Perm;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsSet extends FactionsCommand
 | 
					public class CmdFactionsSet extends FactionsCommand
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,26 +36,22 @@ public class CmdFactionsSetCircle extends CmdFactionsSetXRadius
 | 
				
			|||||||
		final PS chunk = PS.valueOf(me).getChunk(true);
 | 
							final PS chunk = PS.valueOf(me).getChunk(true);
 | 
				
			||||||
		final Set<PS> chunks = new LinkedHashSet<PS>();
 | 
							final Set<PS> chunks = new LinkedHashSet<PS>();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							chunks.add(chunk); // The center should come first for pretty messages
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		Integer radiusZero = this.getRadiusZero();
 | 
							Integer radiusZero = this.getRadiusZero();
 | 
				
			||||||
		if (radiusZero == null) return null;
 | 
							if (radiusZero == null) return null;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		double radius = radiusZero + 1.5; // Tweak ze magic constant to get ze requested behavior.
 | 
							double radiusSquared = radiusZero * radiusZero;
 | 
				
			||||||
		double radiusSquared = radius * radius;
 | 
					 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		chunks.add(chunk); // The center should come first for pretty messages
 | 
							for (int dx = -radiusZero; dx <= radiusZero; dx++)
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		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 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;
 | 
									if (dx*dx + dz*dz > radiusSquared) continue;
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
									int x = chunk.getChunkX() + dx;
 | 
				
			||||||
 | 
									int z = chunk.getChunkZ() + dz;
 | 
				
			||||||
 | 
									
 | 
				
			||||||
				chunks.add(chunk.withChunkX(x).withChunkZ(z));
 | 
									chunks.add(chunk.withChunkX(x).withChunkZ(z));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,20 +36,18 @@ public class CmdFactionsSetSquare extends CmdFactionsSetXRadius
 | 
				
			|||||||
		final PS chunk = PS.valueOf(me).getChunk(true);
 | 
							final PS chunk = PS.valueOf(me).getChunk(true);
 | 
				
			||||||
		final Set<PS> chunks = new LinkedHashSet<PS>();
 | 
							final Set<PS> chunks = new LinkedHashSet<PS>();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							chunks.add(chunk); // The center should come first for pretty messages
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		Integer radiusZero = this.getRadiusZero();
 | 
							Integer radiusZero = this.getRadiusZero();
 | 
				
			||||||
		if (radiusZero == null) return null;
 | 
							if (radiusZero == null) return null;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		chunks.add(chunk); // The center should come first for pretty messages
 | 
							for (int dx = -radiusZero; dx <= radiusZero; dx++)
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		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 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));
 | 
									chunks.add(chunk.withChunkX(x).withChunkZ(z));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -151,7 +151,7 @@ public class MConf extends Entity<MConf>
 | 
				
			|||||||
	// SET LIMITS
 | 
						// SET LIMITS
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public int setRadiusMax = 5;
 | 
						public int setRadiusMax = 30;
 | 
				
			||||||
	public int setFillMax = 1000;
 | 
						public int setFillMax = 1000;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user