public void addClaim(Claim claim) { claimMap.put(claim.toString(), claim); com.sethcran.cityscape.Claim north = getClaimAt(claim.getX(), claim.getZ() + 1, claim.getWorld()); com.sethcran.cityscape.Claim east = getClaimAt(claim.getX() + 1, claim.getZ(), claim.getWorld()); com.sethcran.cityscape.Claim south = getClaimAt(claim.getX(), claim.getZ() - 1, claim.getWorld()); com.sethcran.cityscape.Claim west = getClaimAt(claim.getX() - 1, claim.getZ(), claim.getWorld()); if (north != null) { if (!north.getCityName().equals(claim.getCityName())) north = null; } if (east != null) { if (!east.getCityName().equals(claim.getCityName())) east = null; } if (south != null) { if (!south.getCityName().equals(claim.getCityName())) south = null; } if (west != null) { if (!west.getCityName().equals(claim.getCityName())) west = null; } getCity(claim.getCityName()).addClaim(claim, north, east, south, west); }
public void unclaimAll(String cityName, Claim claim) { City city = cityCache.get(cityName); Collection<Claim> cc = claimMap.values(); Iterator<Claim> iter = cc.iterator(); while (iter.hasNext()) { Claim c = iter.next(); if (c.getCityName().equals(cityName)) { iter.remove(); city.removeClaim(c); } } claimMap.put(claim.toString(), claim); city.addClaim(claim, null, null, null, null); city.setUsedClaims(1); city.removeAllPlots(); }
public void removeClaim(Claim claim) { claimMap.remove(claim.toString()); Chunk chunk = getServer().getWorld(claim.getWorld()).getChunkAt(claim.getX(), claim.getZ()); Block minBlock = chunk.getBlock(0, 0, 0); Block maxBlock = chunk.getBlock(15, 0, 15); int xmin = minBlock.getX(); int zmin = minBlock.getZ(); int xmax = maxBlock.getX(); int zmax = maxBlock.getZ(); City city = getCity(claim.getCityName()); ArrayList<Integer> idList = city.removeIntersectingPlots(xmin, zmin, xmax, zmax); for (int i : idList) { database.removePlot(i); } city.setUsedClaims(city.getUsedClaims() - 1); city.removeClaim(claim); }