Skip to content

Commit

Permalink
changed the handling of vein checks
Browse files Browse the repository at this point in the history
removed the OreBroadcastException and just broke out of the loops instead that way the vain is still reported.

should also stop if the vain is larger then config max size. was cases where it could.
  • Loading branch information
ironboundred committed Jul 15, 2022
1 parent 216338b commit cb1c27f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>be.bendem.bukkit</groupId>
<artifactId>OreBroadcast</artifactId>
<version>1.7.0-SNAPSHOT</version>
<version>1.7.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>OreBroadcast</name>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -104,17 +103,14 @@ public void onBlockBreak(BlockBreakEvent event) {
private Set<Block> getVein(Block block) {
Set<Block> 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<Block> vein) throws OreBroadcastException {
private void getVein(Block block, Set<Block> vein) {
if(vein.size() > plugin.getConfig().getInt("max-vein-size", 500)) {
throw new OreBroadcastException();
return;
}

int i, j, k;
Expand All @@ -126,6 +122,11 @@ private void getVein(Block block, Set<Block> 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);
}
Expand Down

0 comments on commit cb1c27f

Please sign in to comment.