public void saveLevel() throws IOException
    {
        if(level != null)
        {
            if(level.worldType != WorldType.CLIENT)
            {
                File f = level.getChunkFolder();
                if(f == null)
                {
                    f = new File(new File(getFolder(), "saves"), level.getName());
                    f.mkdirs();
                }
                else if(!f.exists())
                {
                    f.mkdirs();
                }
                level.save(f);
            }
            else
            {
                if(this.getClientNetwork() != null)
                {
                    NetworkCommons.sendPacketTo(new PacketDisconnect(), false, getClientNetwork().getClientConnection());
                    this.getClientNetwork().getClientConnection().close();
                }
            }
        }
    }