@@ -0,0 +1,2112 @@
+package net.c4k3.Portals;%0A%0Aimport org.bukkit.Material;%0Aimport org.bukkit.block.Block;%0Aimport org.bukkit.block.BlockFace;%0A%0Apublic class PortalCheck %7B%0A%0A%09public static boolean is_valid_portal(Block portal) %7B%0A%09%09return is_valid_portal(portal, null);%0A%09%7D%0A%0A%09/**%0A%09 * Checks whether the given location contains a valid portal%0A%09 * Meaning whether the location has obsidian setup in such a way that would%0A%09 * create a valid portal, not whether the obsidian there in particular is%0A%09 * active (i.e. no SQL lookups)%0A%09 * @param portal The location of the portal, given the lower block in its center%0A%09 * @param broken A hack for the check used in BlockBreak. The location of a%0A%09 * block that has just been broken, such that it can be counted as air, given%0A%09 * that blocks are not actually broken until the BlockBreakEvent is finished.%0A%09 * @return True if it is a valid portal, else false%0A%09 */%0A%09public static boolean is_valid_portal(Block portal, Block broken) %7B%0A%09%09BlockFace%5B%5D path_eastwest = %7BBlockFace.DOWN, BlockFace.EAST, BlockFace.UP,%0A%09%09%09%09BlockFace.UP, BlockFace.UP, BlockFace.WEST, BlockFace.WEST,%0A%09%09%09%09BlockFace.DOWN, BlockFace.DOWN, BlockFace.DOWN%7D;%0A%09%09BlockFace%5B%5D path_northsouth = %7BBlockFace.DOWN, BlockFace.SOUTH,%0A%09%09%09%09BlockFace.UP, BlockFace.UP, BlockFace.UP, BlockFace.NORTH,%0A%09%09%09%09BlockFace.NORTH, BlockFace.DOWN,BlockFace.DOWN, BlockFace.DOWN%7D;%0A%0A%09%09Block block = portal;%0A%09%09boolean eastwest_valid = true;%0A%0A%09%09for (int i = 0; i %3C path_eastwest.length; i++) %7B%0A%09%09%09block = block.getRelative(path_eastwest%5Bi%5D);%0A%09%09%09if (block.getType() != Material.OBSIDIAN %0A%09%09%09%09%09%7C%7C (broken != null &&block.getX() == broken.getX() %0A%09%09%09%09%09&& block.getY() == broken.getY() %0A%09%09%09%09%09&& block.getZ() == broken.getZ())) %7B%0A%09%09%09%09eastwest_valid = false;%0A%09%09%09%09break;%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09if (eastwest_valid)%0A%09%09%09return true;%0A%0A%09%09block = portal;%0A%09%09for (int i = 0; i %3C path_northsouth.length; i++) %7B%0A%09%09%09block = block.getRelative(path_northsouth%5Bi%5D);%0A%09%09%09if (block.getType() != Material.OBSIDIAN %0A%09%09%09%09%09%7C%7C (broken != null && block.getX() == broken.getX() %0A%09%09%09%09%09&& block.getY() == broken.getY() %0A%09%09%09%09%09&& block.getZ() == broken.getZ()))%0A%09%09%09%09return false;%0A%09%09%7D%0A%09%09return true;%0A%09%7D%0A%0A%7D%0A

Add PortalCheck class