code style.

This commit is contained in:
Tobias Ottenweller 2013-05-19 11:59:47 +02:00
parent 6bd53a3fe6
commit be3c541845

View File

@ -38,23 +38,19 @@ public class FloodUtil
Set<Block> blocks1 = getAirFloodBlocks(block, new HashSet<Block>(), exp1, frameBlockSearchLimit); Set<Block> blocks1 = getAirFloodBlocks(block, new HashSet<Block>(), exp1, frameBlockSearchLimit);
Set<Block> blocks2 = getAirFloodBlocks(block, new HashSet<Block>(), exp2, frameBlockSearchLimit); Set<Block> blocks2 = getAirFloodBlocks(block, new HashSet<Block>(), exp2, frameBlockSearchLimit);
if (blocks1 == null && blocks2 == null) if (blocks1 == null && blocks2 == null) {
{
return null; return null;
} }
if (blocks1 == null) if (blocks1 == null) {
{
return blocks2; return blocks2;
} }
if (blocks2 == null) if (blocks2 == null) {
{
return blocks1; return blocks1;
} }
if (blocks1.size() > blocks2.size()) if (blocks1.size() > blocks2.size()) {
{
return blocks2; return blocks2;
} }
@ -64,28 +60,25 @@ public class FloodUtil
private static Set<Block> getAirFloodBlocks(Block startBlock, Set<Block> foundBlocks, Set<BlockFace> expandFaces, int limit) private static Set<Block> getAirFloodBlocks(Block startBlock, Set<Block> foundBlocks, Set<BlockFace> expandFaces, int limit)
{ {
if (foundBlocks == null) if (foundBlocks == null) {
{
return null; return null;
} }
if (foundBlocks.size() > limit) if (foundBlocks.size() > limit) {
{
Plugin.log(Level.ALL, "exceeding gate size limit."); Plugin.log(Level.ALL, "exceeding gate size limit.");
return null; return null;
} }
if (foundBlocks.contains(startBlock)) if (foundBlocks.contains(startBlock)) {
return foundBlocks; return foundBlocks;
}
if (startBlock.getType() == Material.AIR || startBlock.getType() == Material.PORTAL) if (startBlock.getType() == Material.AIR || startBlock.getType() == Material.PORTAL) {
{
// ... We found a block :D ... // ... We found a block :D ...
foundBlocks.add(startBlock); foundBlocks.add(startBlock);
// ... And flood away ! // ... And flood away !
for (BlockFace face : expandFaces) for (BlockFace face : expandFaces) {
{
Block potentialBlock = startBlock.getRelative(face); Block potentialBlock = startBlock.getRelative(face);
foundBlocks = getAirFloodBlocks(potentialBlock, foundBlocks, expandFaces, limit); foundBlocks = getAirFloodBlocks(potentialBlock, foundBlocks, expandFaces, limit);
} }
@ -93,5 +86,4 @@ public class FloodUtil
return foundBlocks; return foundBlocks;
} }
} }