private boolean k(Player p) {
        EntityPlayer minecraftPlayer = ((CraftPlayer)p).getHandle();
        Random random = new Random();
        double d3 = minecraftPlayer.locX;
        double d4 = minecraftPlayer.locY;
        double d5 = minecraftPlayer.locZ;
        double d0 = d3 + (random.nextDouble() - 0.5D) * 32.0D;
        double d1 = d4 + (double) (random.nextInt(32) - 16);
        double d2 = d5 + (random.nextDouble() - 0.5D) * 32.0D;
        int i = MathHelper.floor(d0);
        int j = MathHelper.floor(d1);
        int k = MathHelper.floor(d2);

        if (minecraftPlayer.world.isLoaded(i, j, k)) {
            boolean flag = false;

            while (!flag && j > 0) {
                net.minecraft.server.v1_7_R3.Block block = minecraftPlayer.world.getType(i, j - 1, k);

                if (block.getMaterial().isSolid()) {
                    flag = true;
                } else {
                    --d1;
                    --j;
                }
            }

            if (flag) {
                //Refactor to use the available bukkit functionality
                Location dest = p.getLocation().clone();
                dest.setX(d0);
                dest.setY(d1);
                dest.setZ(d2);
                //Use the more specific (and more relevant) PlayerTeleportEvent
                PlayerTeleportEvent teleport = new PlayerTeleportEvent(p,
                        p.getLocation(),
                        dest,
                        PlayerTeleportEvent.TeleportCause.PLUGIN);
                plugin.getServer().getPluginManager().callEvent(teleport);
                if (teleport.isCancelled()) {
                    return false;
                }

                Location to = teleport.getTo();
                //minecraftPlayer.setPosition(to.getX(), to.getY(), to.getZ());
                //Substitute the setPosition code without actually setting the position
                double locX = to.getX();
                double locY = to.getY();
                double locZ = to.getZ();
                float f = minecraftPlayer.width / 2.0F;
                float f1 = minecraftPlayer.length;

                //Create the boundingBox the setPosition call would have made
                AxisAlignedBB boundingBox = minecraftPlayer.boundingBox.clone().b(
                        locX - (double) f,
                        locY - (double) minecraftPlayer.height + (double) minecraftPlayer.V,
                        locZ - (double) f,
                        locX + (double) f,
                        locY - (double) minecraftPlayer.height + (double) minecraftPlayer.V + (double) f1,
                        locZ + (double) f);
                //Doesn't matter that minecraftPlayer has the wrong position information as this call tree never uses anything other than Class.isAssignableFrom
                if (minecraftPlayer.world.getCubes(minecraftPlayer, boundingBox).isEmpty() && !minecraftPlayer.world.containsLiquid(boundingBox)) {
                    //Replace setPosition with the speedhack-safe version for players
                    minecraftPlayer.playerConnection.teleport(to);
                    for (int l = 0; l < PARTICLES; ++l) {
                        double d6 = (double) l / ((double) PARTICLES - 1.0D);
                        float f2 = (random.nextFloat() - 0.5F) * 0.2F;
                        float f3 = (random.nextFloat() - 0.5F) * 0.2F;
                        float f4 = (random.nextFloat() - 0.5F) * 0.2F;
                        double d7 = d3 + (minecraftPlayer.locX - d3) * d6 + (random.nextDouble() - 0.5D) * (double) minecraftPlayer.width * 2.0D;
                        double d8 = d4 + (minecraftPlayer.locY - d4) * d6 + random.nextDouble() * (double) minecraftPlayer.length;
                        double d9 = d5 + (minecraftPlayer.locZ - d5) * d6 + (random.nextDouble() - 0.5D) * (double) minecraftPlayer.width * 2.0D;

                        minecraftPlayer.world.addParticle("portal", d7, d8, d9, (double) f2, (double) f3, (double) f4);
                    }

                    minecraftPlayer.world.makeSound(d3, d4, d5, "mob.endermen.portal", 1.0F, 1.0F);
                    minecraftPlayer.makeSound("mob.endermen.portal", 1.0F, 1.0F);
                    return true;
                } else {
                    return false;
                }
            }
        }
        return false;
    }