public boolean canBuildField(Player player, Block block, FieldSettings fs) { if (wg == null) { return true; } Location loc = block.getLocation(); World w = loc.getWorld(); int x = loc.getBlockX(); int y = loc.getBlockY(); int z = loc.getBlockZ(); int radius = fs.getRadius(); if (wg.canBuild(player, new Location(w, x + radius, y + radius, z + radius))) { if (wg.canBuild(player, new Location(w, x + radius, y + radius, z - radius))) { if (wg.canBuild(player, new Location(w, x + radius, y - radius, z + radius))) { if (wg.canBuild(player, new Location(w, x + radius, y - radius, z - radius))) { if (wg.canBuild(player, new Location(w, x - radius, y + radius, z + radius))) { if (wg.canBuild(player, new Location(w, x - radius, y + radius, z - radius))) { if (wg.canBuild(player, new Location(w, x - radius, y - radius, z + radius))) { if (wg.canBuild(player, new Location(w, x - radius, y - radius, z - radius))) { if (wg.canBuild(player, new Location(w, x, y, z))) { return true; } } } } } } } } } return false; }
public boolean canBuild(Player player, Location loc) { try { if (wg == null) { return true; } // if null passed then pick up some random player if (player == null) { player = plugin.getServer().getWorlds().get(0).getPlayers().get(0); } return wg.canBuild(player, loc); } catch (Exception ex) { return true; } }