From b03338d05ecb8a40aa6d221dfa46a1112108ef3c Mon Sep 17 00:00:00 2001 From: mathias Date: Wed, 19 Dec 2018 23:35:07 +0200 Subject: [PATCH] Optimize physics --- src/main/java/pw/kaboom/extras/Events.java | 32 ++++++---------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/src/main/java/pw/kaboom/extras/Events.java b/src/main/java/pw/kaboom/extras/Events.java index 40e3c13..0f45904 100644 --- a/src/main/java/pw/kaboom/extras/Events.java +++ b/src/main/java/pw/kaboom/extras/Events.java @@ -205,32 +205,18 @@ class Events implements Listener { event.setCancelled(true); } } else if (main.nonSolidDoubleBlockList.contains(block.getType())) { - /*if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR || - (main.nonSolidBlockList.contains(block.getRelative(BlockFace.DOWN).getType()) && block.getRelative(BlockFace.DOWN).getType() != block.getType())) { - for (int y = block.getRelative(BlockFace.UP).getY(); y <= 128; y++) { - World world = event.getBlock().getWorld(); - Block coordBlock = world.getBlockAt(new Location(world, block.getX(), y, block.getZ())); - - if (coordBlock.getType() == block.getType()) { - coordBlock.setType(Material.AIR, false); - continue; - } - - break; - } - - block.setType(Material.AIR, false);*/ - /*} else */if (block.getRelative(BlockFace.DOWN).getType() == block.getType()) { + if (block.getRelative(BlockFace.DOWN).getType() == block.getType()) { event.setCancelled(true); + } else if ((block.getRelative(BlockFace.DOWN).getType() == Material.AIR || + main.nonSolidBlockList.contains(block.getRelative(BlockFace.DOWN).getType())) && + block.getRelative(BlockFace.UP).getType() == Material.AIR) { + block.setType(Material.AIR, false); } } else if (main.nonSolidSingularBlockList.contains(block.getType())) { - /*if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR || + if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR || main.nonSolidBlockList.contains(block.getRelative(BlockFace.DOWN).getType())) { block.setType(Material.AIR, false); - BlockState state = block.getState(); - state.setType(Material.AIR); - state.update(true, false); - }*/ + } } } @@ -517,9 +503,9 @@ class Events implements Listener { event.disallow(Result.KICK_OTHER, "The server is throttled due to bot attacks. Please try logging in again."); main.onlineCount++; } - /*} else if (!(event.getHostname().startsWith("play.kaboom.pw") && + } else if (!(event.getHostname().startsWith("play.kaboom.pw") && event.getHostname().endsWith(":64518"))) { - event.disallow(Result.KICK_OTHER, "You connected to the server using an outdated server address/IP.\nPlease use the following address/IP:\n\nkaboom.pw");*/ + event.disallow(Result.KICK_OTHER, "You connected to the server using an outdated server address/IP.\nPlease use the following address/IP:\n\nkaboom.pw"); } else { event.allow(); }