Skip to content

Commit

Permalink
Fixed betterphysics potential stackoverflow
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 committed Nov 15, 2016
1 parent f00f4fb commit db2e2a7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -55,15 +55,13 @@ public void onBlockUpdate(BlockPhysicsEvent event) {
private static void checkForPhysics(Block block) { private static void checkForPhysics(Block block) {
if(FallingLadders.isValid(block)) { if(FallingLadders.isValid(block)) {
Bukkit.getScheduler().runTask(CraftBookPlugin.inst(), new FallingLadders(block)); Bukkit.getScheduler().runTask(CraftBookPlugin.inst(), new FallingLadders(block));
checkForPhysics(block.getRelative(BlockFace.UP));
} }
} }


private static class FallingLadders implements Runnable { private static class FallingLadders implements Runnable {
private Block ladder; private Block ladder;


FallingLadders(Block ladder) { FallingLadders(Block ladder) {

this.ladder = ladder; this.ladder = ladder;
} }


Expand All @@ -76,6 +74,8 @@ public void run () {
if(!isValid(ladder)) return; if(!isValid(ladder)) return;
ladder.getWorld().spawnFallingBlock(ladder.getLocation().add(0.5, 0, 0.5), ladder.getType(), ladder.getData()); ladder.getWorld().spawnFallingBlock(ladder.getLocation().add(0.5, 0, 0.5), ladder.getType(), ladder.getData());
ladder.setType(Material.AIR, false); ladder.setType(Material.AIR, false);

checkForPhysics(ladder.getRelative(BlockFace.UP));
} }
} }


Expand Down

0 comments on commit db2e2a7

Please sign in to comment.