From 4d5b601038a54d830477e0190e039b621e4e6022 Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Sat, 25 Feb 2012 23:17:46 +0100 Subject: [PATCH] using Plugin.log instead of System.out.println --- .../mcteam/ancientgates/util/FloodUtil.java | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/org/mcteam/ancientgates/util/FloodUtil.java b/src/org/mcteam/ancientgates/util/FloodUtil.java index 3e83e54..5d89798 100644 --- a/src/org/mcteam/ancientgates/util/FloodUtil.java +++ b/src/org/mcteam/ancientgates/util/FloodUtil.java @@ -2,11 +2,13 @@ package org.mcteam.ancientgates.util; import java.util.HashSet; import java.util.Set; +import java.util.logging.Level; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.mcteam.ancientgates.Conf; +import org.mcteam.ancientgates.Plugin; public class FloodUtil { private static final Set exp1 = new HashSet(); @@ -49,34 +51,33 @@ public class FloodUtil { return blocks1; } - public static Set getAirFloodBlocks(Block startBlock, Set foundBlocks, Set expandFaces, int limit) { - if (foundBlocks == null) { + public static Set getAirFloodBlocks(Block startBlock, Set foundBlocks, Set expandFaces, int limit) + { + if (foundBlocks == null) return null; + + if (foundBlocks.size() > limit) + { + Plugin.log(Level.ALL, "exceeding gate size limit."); + return null; } - //System.out.println("limit: " + limit); - if (foundBlocks.size() > limit) { - System.out.println("Exceeding gate size limit."); - return null; - } - - if (foundBlocks.contains(startBlock)) { + if (foundBlocks.contains(startBlock)) 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 ... foundBlocks.add(startBlock); // ... And flood away ! - for (BlockFace face : expandFaces) { + for (BlockFace face : expandFaces) + { Block potentialBlock = startBlock.getRelative(face); foundBlocks = getAirFloodBlocks(potentialBlock, foundBlocks, expandFaces, limit); } } - if (foundBlocks != null) { - //System.out.println("size: " + foundBlocks.size()); - } + return foundBlocks; }