All pastes #78232 Raw Edit

nanowish

public java v1 · immutable
·published 2006-07-03 22:30 UTC
rendered paste body
   private void enterRaceClan(L2PcInstance activeChar)    {        Connection con = null;        String clanName = null;        if (activeChar.getClan() == null && activeChar.getLevel() <= 1 && activeChar.getExp() == 1 && !activeChar.isGM())        {            try            {                try                    {                    if (activeChar.getRace() == Race.darkelf) clanName = Config.DE_CLAN;                    if (activeChar.getRace() == Race.dwarf) clanName = Config.DWARF_CLAN;                    if (activeChar.getRace() == Race.human) clanName = Config.HUMAN_CLAN;                    if (activeChar.getRace() == Race.elf) clanName = Config.ELF_CLAN;                    if (activeChar.getRace() == Race.orc) clanName = Config.ORC_CLAN;                         con = L2DatabaseFactory.getInstance().getConnection();                        Statement idClanRace = con.createStatement();                        ResultSet rset = idClanRace.executeQuery("SELECT `clan_id` FROM `clan_data` WHERE `clan_name`='"+clanName+"';");                        while (rset.next())                        {                                                     L2Clan clan = new L2Clan(rset.getInt("clan_id"));                                                clan.addClanMember(activeChar);                                                //should be update packet only                        activeChar.sendPacket(new PledgeShowInfoUpdate(clan, activeChar));                        activeChar.broadcastUserInfo();                                                SystemMessage sm = new SystemMessage(SystemMessage.ENTERED_THE_CLAN);                        activeChar.sendPacket(sm);                                                //L2ClanMember[] members = clan.getMembers();                        PledgeShowMemberListAdd la = new PledgeShowMemberListAdd(activeChar);                        sm = new SystemMessage(SystemMessage.S1_HAS_JOINED_CLAN);                        sm.addString(activeChar.getName());                                                clan.broadcastToOnlineMembers(la);                        clan.broadcastToOnlineMembers(sm);                                                // this activates the clan tab on the new member                        activeChar.sendPacket(new PledgeShowMemberListAll(clan, activeChar));                        activeChar.setDeleteClanTime(0);                        activeChar.setClan(clan);                        activeChar.setClanPrivileges(0);                        ClientThread.saveCharToDisk(activeChar);                         _log.info(activeChar+ " vient d'etre ajoute au clan des " +clan+ " !");                        }                    }                    catch (SQLException esql)                                 {System.out.println("ERREUR REQUETE ID CLAN-RACE!! :" +esql);}        }        catch (Exception e)                    {e.printStackTrace();}        finally {            try {con.close();}                  catch (Exception e) {e.printStackTrace();}                 }