查看: 460|回復: 0

[閒聊閒語] 操作

[複製鏈接]

71

主題

267

帖子

5707

金錢

火焰之影

Rank: 8Rank: 8

威望
247
精華
0
貢獻
0
鑽石
0
閱讀權限
50
積分
6468
在線時間
110 小時
相冊
0
日誌
0
好友
0
發表於 2026-2-9 22:13 | 顯示全部樓層 |閱讀模式
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]package l1j.server.server.utils;
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]import l1j.server.server.model.Instance.L1PcInstance;
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]import l1j.server.server.serverpackets.S_SystemMessage;
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]import java.util.logging.Level;
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]import java.util.logging.Logger;
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]/**
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)] * WHO功能統一錯誤處理器
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)] * 處理WHO相關功能的各種錯誤情況
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)] */
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]public class WhoErrorHandler {
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        private static final Logger _log = Logger.getLogger(WhoErrorHandler.class.getName());
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]       
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        // 錯誤類型枚舉
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        public enum ErrorType {
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                PLAYER_NOT_FOUND,
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                PERMISSION_DENIED,
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                NETWORK_ERROR,
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                DATABASE_ERROR,
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                VALIDATION_ERROR,
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                TIMEOUT_ERROR,
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                UNKNOWN_ERROR
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        }
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        /**
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]         * 處理錯誤並發送適當的訊息給玩家
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]         */
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        public static void handleError(L1PcInstance pc, Exception e, String operation) {
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                if (pc == null) {
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                        _log.log(Level.WARNING, "WHO操作失敗(玩家為null): " + operation, e);
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                        return;
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                }
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                _log.log(Level.WARNING, "WHO功能執行失敗: " + operation + " - 玩家: " + pc.getName(), e);
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]               
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                ErrorType errorType = classifyError(e);
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                String message = getErrorMessage(errorType);
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]               
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                pc.sendPackets(new S_SystemMessage(message));
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        }
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        /**
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]         * 處理特定錯誤類型
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]         */
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        public static void handleError(L1PcInstance pc, ErrorType errorType, String details) {
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                if (pc == null) {
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                        _log.log(Level.WARNING, "WHO操作失敗(玩家為null): " + details);
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                        return;
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                }
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                _log.log(Level.WARNING, "WHO操作失敗: " + errorType + " - " + details + " - 玩家: " + pc.getName());
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]               
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                String message = getErrorMessage(errorType);
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                if (details != null && !details.isEmpty()) {
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                        message += " (" + details + ")";
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                }
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]               
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                pc.sendPackets(new S_SystemMessage(message));
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        }
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        /**
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]         * 處理玩家未找到的錯誤
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]         */
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        public static void handlePlayerNotFound(L1PcInstance pc, String targetName) {
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                if (pc == null) return;
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]               
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                _log.log(Level.INFO, "玩家未找到: " + targetName + " - 查詢者: " + pc.getName());
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]                pc.sendPackets(new S_SystemMessage("找不到玩家: " + targetName));
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        }
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        /**
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]         * 處理權限不足的錯誤
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]         */
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)]        public static void handlePermissionDenied(L1PcInstance pc, String action) {
[color=rgba(252, 249, 249, 0.698)][backcolor=rgba(14, 11, 11, 0.498)][backcolor=lab(99.9988 0.0188053 -0.00110865 / 0.09)]                if (pc == null) return;





上一篇︰0209搖一搖
下一篇︰搖一搖~~搖一搖!!
您需要登錄後才可以回帖 登錄 | 註冊會員

本版積分規則

天堂私服列表

45客服

Archiver| 45天堂私服論壇   分享到微博! 分享到臉書! 分享到噗浪! 分享到維特! 分享到Google+! 分享到LINE!

45天堂私服發佈站 ©    天堂私服架設教學  提供最新天堂私服最新資訊

流量最高、品質最好、服務最優、玩家首選、最新天堂私服資訊,都在45天堂私服發佈站.    免責聲明

Sitetag
line客服聯繫
掃一掃二碼
Line客服聯繫
24H專人回覆
返回頂部 返回列表