diff --git a/pom.xml b/pom.xml index 9ebc4ad..43af8b8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ be.bendem.bukkit OreBroadcast - 1.7.0-SNAPSHOT + 1.7.1-SNAPSHOT jar OreBroadcast diff --git a/src/main/java/be/bendem/bukkit/orebroadcast/OreBroadcastException.java b/src/main/java/be/bendem/bukkit/orebroadcast/OreBroadcastException.java deleted file mode 100644 index 4c506f2..0000000 --- a/src/main/java/be/bendem/bukkit/orebroadcast/OreBroadcastException.java +++ /dev/null @@ -1,7 +0,0 @@ -package be.bendem.bukkit.orebroadcast; - -/** - * @author bendem - */ -@SuppressWarnings("serial") -public class OreBroadcastException extends Exception {} diff --git a/src/main/java/be/bendem/bukkit/orebroadcast/handlers/BlockBreakListener.java b/src/main/java/be/bendem/bukkit/orebroadcast/handlers/BlockBreakListener.java index 6b2d6de..0487f24 100644 --- a/src/main/java/be/bendem/bukkit/orebroadcast/handlers/BlockBreakListener.java +++ b/src/main/java/be/bendem/bukkit/orebroadcast/handlers/BlockBreakListener.java @@ -14,7 +14,6 @@ import be.bendem.bukkit.orebroadcast.OreBroadcast; import be.bendem.bukkit.orebroadcast.OreBroadcastEvent; -import be.bendem.bukkit.orebroadcast.OreBroadcastException; public class BlockBreakListener implements Listener { @@ -104,17 +103,14 @@ public void onBlockBreak(BlockBreakEvent event) { private Set getVein(Block block) { Set vein = new HashSet<>(); vein.add(block); - try { - getVein(block, vein); - } catch(OreBroadcastException e) { - return null; - } + getVein(block, vein); + return vein; } - private void getVein(Block block, Set vein) throws OreBroadcastException { + private void getVein(Block block, Set vein) { if(vein.size() > plugin.getConfig().getInt("max-vein-size", 500)) { - throw new OreBroadcastException(); + return; } int i, j, k; @@ -126,6 +122,11 @@ private void getVein(Block block, Set vein) throws OreBroadcastException && equals(block, relative) // block has not the same type && ((i != 0 || j != 0 || k != 0)) // comparing block to itself && !plugin.isBlackListed(relative)) {// don't consider blacklisted blocks + + if(vein.size() > plugin.getConfig().getInt("max-vein-size", 500)) { + continue; + } + vein.add(relative); getVein(relative, vein); }