게임강의
리니지 분류

SP팩기반sp7final 1.63 서버창 기능중 리로드 제외한 캐릭터 저장및 밴 해제[옆동네 펌]

컨텐츠 정보

본문

Guimain.java 에 연동하기 위한

 

lineage.world.object.instance.PcInstance.java

 

 

    /**
    * 사용자 정보 저장 처리 함수.
    */
    private void toSave() {
        if (getMap() != Lineage.teamBattleMap) {
            Connection con = null;
            try {
                con = DatabaseConnection.getLineage();
                toSave(con);
            } catch (Exception e) {
                lineage.share.System.println(PcInstance.class.toString() + " : toSave()");
                lineage.share.System.println(e);
            } finally {
                DatabaseConnection.close(con);
            }
        }
    }

    /**
    * gui에서 사용중
    *
    * @param
    * @return 2017-09-06 by all_night.
    */
    public void toCharacterSave() {
        Connection con = null;
        try {
            con = DatabaseConnection.getLineage();
            toSave(con);
        } catch (Exception e) {
            lineage.share.System.println(PcInstance.class.toString() + " : toSave()");
            lineage.share.System.println(e);
        } finally {
            DatabaseConnection.close(con);
        }
    }

 

 

    /**
    * 사용자 정보 저장 처리 함수.
    */
    public void toSave(Connection con){
        // 저장
        CharactersDatabase.saveDungeon(con, this);
        CharactersDatabase.saveInventory(con, this);
        CharactersDatabase.saveSkill(con, this);
        CharactersDatabase.saveBuff(con, this);
        CharactersDatabase.saveBook(con, this);
        CharactersDatabase.saveCharacter(con, this);
        SummonController.toSave(con, this);
        FriendController.toSave(con, this);
        CharactersDatabase.updatePoint(getName(), getPoint(), false);
    }

//이부분은 기존소스를 아래처럼 좀 더 보강한 소스로 교체합니다.
 

    /**
    * 사용자 정보 저장 처리 함수.
    */
    public void toSave(Connection con) {
        // 저장
        try {
        CharactersDatabase.saveDungeon(con, this);
        } catch (Exception e) {
            lineage.share.System.println("saveDungeon | 캐릭명: " + getName());
            lineage.share.System.println(e);
        }
        try {
            CharactersDatabase.saveInventory(con, this);
        } catch (Exception e) {
            lineage.share.System.println("saveInventory | 캐릭명: " + getName());
            lineage.share.System.println(e);
        }

        try {
            CharactersDatabase.saveSkill(con, this);
        } catch (Exception e) {
            lineage.share.System.println("saveSkill | 캐릭명: " + getName());
            lineage.share.System.println(e);
        }

        try {
            CharactersDatabase.saveBuff(con, this);
        } catch (Exception e) {
            lineage.share.System.println("saveBuff | 캐릭명: " + getName());
            lineage.share.System.println(e);
        }

        try {
            CharactersDatabase.saveBook(con, this);
        } catch (Exception e) {
            lineage.share.System.println("saveBook | 캐릭명: " + getName());
            lineage.share.System.println(e);
        }

        try {
            CharactersDatabase.saveCharacter(con, this);
        } catch (Exception e) {
            lineage.share.System.println("saveCharacter | 캐릭명: " + getName());
            lineage.share.System.println(e);
        }

        try {
            SummonController.toSave(con, this);
        } catch (Exception e) {
            lineage.share.System.println("SummonController.toSave | 캐릭명: " + getName());
            lineage.share.System.println(e);
        }
        try {
            CharactersDatabase.updatePoint(getName(), getPoint(), false);
        } catch (Exception e) {
            lineage.share.System.println("CharactersDatabase.updatePoint | 캐릭명: " + getName());
            lineage.share.System.println(e);
        }
    }
=====================================================================================================
lineage.database.BadIpDatabase.java

 

    /**
    * 배드 아이피 등록 처리 메서드.
    * @param ip
    */
    static public void append(String ip) {
        //
        if(find(ip) != null)
            return;
        //
        Ip i = new Ip();
        i.setIp( ip );
        i.setTime( System.currentTimeMillis() );
       
        list.add( i );
    }

    static public void remove(String ip) {
        synchronized (list) {
            Ip i = find(ip);
             
            if (i != null) {
                list.remove(i);
            }
        }
    }
         
    static public void removeAll() {
        synchronized (list) {
            list.clear();
        }
    }   

 

 

lineage.world.controller.CommandController.java

 

import lineage.database.BadIpDatabase;

 

    /**
    * 차단.
    *  : ScreenRenderComposite 에서 사용중
    * @param o
    * @param st
    */
    static public void toBan(object o, StringTokenizer st){ // 검색
    .
    .
    .
            ChattingController.toChatting(o, "차단 완료.", Lineage.CHATTING_MODE_MESSAGE);
        }
    }
    public static void toBanRemove(object o, StringTokenizer st) {
        boolean find = false;
        String ip = null;
        String account = null;
        String name = st.nextToken().toLowerCase();

           
        Connection con = null;
        PreparedStatement stt = null;
        ResultSet rs = null;
        try {
            con = DatabaseConnection.getLineage();
            stt = con.prepareStatement("SELECT * FROM characters WHERE LOWER(name)=?");
            stt.setString(1, name);
            rs = stt.executeQuery();
             
            if (rs.next()) {
                find = true;
                account = rs.getString("account");
            }
        } catch (Exception e) {
            lineage.share.System.println("[벤 해제] 캐릭터 계정 찾기 오류: " + e);
        } finally {
            DatabaseConnection.close(con, stt, rs);
        }

           
        try {
            con = DatabaseConnection.getLineage();
            stt = con.prepareStatement("SELECT * FROM accounts WHERE LOWER(id)=?");
            stt.setString(1, account);
            rs = stt.executeQuery();
             
            if (rs.next()) {
                find = true;
                ip = rs.getString("last_ip");
                BadIpDatabase.remove(ip);
            }
        } catch (Exception e) {
            lineage.share.System.println("[벤] 계정으로 마지막 접속 IP찾기 오류: " + e);
        } finally {
            DatabaseConnection.close(con, stt, rs);
        }

           
        if (find) {
            try {
                con = DatabaseConnection.getLineage();
               
                stt = con.prepareStatement("UPDATE accounts SET block_date='0000-00-00 00:00:00' WHERE LOWER(id)=?");
                stt.setString(1, account);
                stt.executeUpdate();
                stt.close();
            } catch (Exception e) {
                lineage.share.System.println("[벤 해제] 계정 차단 해제 오류: " + e);
            } finally {
                DatabaseConnection.close(con, stt, rs);
            }
             
            try {
                con = DatabaseConnection.getLineage();
               
                stt = con.prepareStatement("UPDATE characters SET block_date='0000-00-00 00:00:00' WHERE LOWER(name)=?");
                stt.setString(1, name);
                stt.executeUpdate();
            } catch (Exception e) {
                lineage.share.System.println("[벤 해제] 캐릭터 차단 해제 오류: " + e);
              } finally {
                  DatabaseConnection.close(con, stt, rs);
              }
             
            if (o != null)
                ChattingController.toChatting(o, String.format("[계정: %s] [캐릭터: %s] [IP: %s] 벤 해제 완료.", new Object[] { account, name, ip }), 20);
        }
    }
         
    public static void toBanAllRemove(object o) {
        Connection con = null;
        PreparedStatement stt = null;
           
        try {
            con = DatabaseConnection.getLineage();
             
            stt = con.prepareStatement("UPDATE accounts SET block_date='0000-00-00 00:00:00'");
            stt.executeUpdate();
            stt.close();

             
            stt = con.prepareStatement("UPDATE characters SET block_date='0000-00-00 00:00:00'");
            stt.executeUpdate();
             
            BadIpDatabase.removeAll();
        } catch (Exception e) {
            lineage.share.System.println("[전체 벤 해제] 계정, 캐릭터 차단 해제 오류: " + e);
        } finally {
            DatabaseConnection.close(con, stt);
        }
           
        if (o != null) {
            ChattingController.toChatting(o, "전체 벤 해제 완료.", 20);
        } else {
              lineage.share.System.println("전체 벤 해제 완료.");
        }
    }

관련자료

댓글 0
등록된 댓글이 없습니다.
리니지 6 / 1 페이지
번호
제목
이름

강의실

🏆 포인트 랭킹 TOP 10
순위 닉네임 포인트
1 no_profile 타키야겐지쪽지보내기 자기소개 아이디로 검색 전체게시물 82,042
2 no_profile 라프텔쪽지보내기 자기소개 아이디로 검색 전체게시물 51,280
3 no_profile 동가리쪽지보내기 자기소개 아이디로 검색 전체게시물 32,591
4 no_profile Revolution쪽지보내기 자기소개 아이디로 검색 전체게시물 28,199
5 서번트쪽지보내기 자기소개 아이디로 검색 전체게시물 23,416
6 no_profile 닥터스쪽지보내기 자기소개 아이디로 검색 전체게시물 22,310
7 no_profile 불멸의행복쪽지보내기 자기소개 아이디로 검색 전체게시물 13,822
8 no_profile 호롤롤로쪽지보내기 자기소개 아이디로 검색 전체게시물 13,500
9 no_profile 검은고양이쪽지보내기 자기소개 아이디로 검색 전체게시물 13,246
10 no_profile 하늘2쪽지보내기 자기소개 아이디로 검색 전체게시물 13,239
알림 0