public Room(int[] rnum, String rname, String rpass, int rlvl, String rowner, String rip, PrintWriter osock, BotClass _bot, SQLDatabase _sql)
    {
        try
        {
            this.sql = _sql;
            this.roomnum = rnum;
            this.roomname = rname;
            this.roompass = rpass;
            this.roomlevel = rlvl;
            this.roomowner = rowner;
            this.roomip = rip;
            this.roomplayer[0] = rowner;
            this.roomsocks[0] = osock;
            this.bot[0] = _bot;
            this.roomport[0] = 0;
            this.roomposi[0] = 0x70;
            this.roomid[0] = 0;
            this.roomready[0] = true;
            this.roomreadytoplay[0] = false;

            String[] ip = rip.split("\\.");
            for (int i = 0; i < 4; i++)
            {
                this.roomips[0][i] = (byte) Integer.parseInt(ip[i]);
            }

            switch (roomnum[0])
            {
                case 0:
                    this.roomtyp = 2;
                    this.sector = new Sector();
                    break;

                case 1:
                    this.roomtyp = 0;
                    break;

                case 2:
                    this.roomtyp = 3;
                    break;
            }

            sql.doupdate("INSERT INTO `rooms` (`ip`) VALUES ('" + this.roomip + "')");

            Packet pack = new Packet();
            pack.addHeader((byte) 0xEE, (byte) 0x2E);
            pack.addPacketHead((byte) 0x01, (byte) 0x00);
            pack.addByte((byte) (this.roomnum[1] + 89));
            switch (this.roomnum[0])
            {
                case 0:
                    pack.addByte((byte) 0x02);
                    break;

                case 1:
                    pack.addByte((byte) 0x00);
                    break;

                case 2:
                    pack.addByte((byte) 0x03);
                    break;

            }
            String[] aip = this.roomip.split("\\.");
            pack.addByte4((byte) Integer.parseInt(aip[0]),
                    (byte) Integer.parseInt(aip[1]),
                    (byte) Integer.parseInt(aip[2]),
                    (byte) Integer.parseInt(aip[3]));

            writeRoomPlayer(0, pack);
            pack.clean();

            ResultSet rs;
            while (this.roomport[0] == 0)
            {
                rs = sql.doquery("SELECT `port` FROM `rooms` WHERE `ip`='" + this.roomip + "'");
                if (rs.next())
                    this.roomport[0] = rs.getInt("port");
            }

            sql.doupdate("DELETE FROM `rooms` WHERE `ip` = '"+this.roomip+"' and `port` = '"+this.roomport[0]+"'");
            debug("[this.roomip]" + this.roomip);
            debug("[this.roomport]" + this.roomport);
            debug("[this.roompass]" + this.roompass);



            pack.addHeader((byte) 0x4A, (byte) 0x2F);
            pack.addByte4((byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00);
            writeRoomPlayer(0, pack);
            pack.clean();
            this.roommap = 0;

            pack.addHeader((byte) 0x39, (byte) 0x27);
            pack.addInt(7033, 2, true);
            for (int i = 0; i < 7; i++)
            {

                pack.addByte2((byte) 0x00, (byte) 0x00);
            }
            writeRoomPlayer(0, pack);

        } catch (Exception e)
        {
        }
    }