From 99d83f1b07bce616cab3d0c893775255601f7f14 Mon Sep 17 00:00:00 2001 From: youpaishidifu Date: Fri, 3 Jul 2026 23:11:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dtpaccept=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E8=A2=ABisValidRequest=E6=8F=90=E5=89=8D=E6=8B=A6?= =?UTF-8?q?=E6=88=AA=E5=AF=BC=E8=87=B44=E7=A7=92=E4=B9=9F=E6=8A=A5?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E3=80=82tpaccept=E7=8E=B0=E5=9C=A8=E5=85=88?= =?UTF-8?q?=E7=A1=AE=E5=AE=9AtargetName=E5=86=8D=E6=9F=A5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E6=97=B6=E9=97=B4=E6=88=B3=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E5=86=8D=E4=BE=9D=E8=B5=96teleportRequestTim?= =?UTF-8?q?es=E5=86=85=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Sdf1_login/TeleportManager.java | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/main/java/Sdf1_login/TeleportManager.java b/src/main/java/Sdf1_login/TeleportManager.java index 65218f3..b2f8323 100644 --- a/src/main/java/Sdf1_login/TeleportManager.java +++ b/src/main/java/Sdf1_login/TeleportManager.java @@ -680,21 +680,18 @@ public class TeleportManager implements Listener { // ★ 先检查是否有待处理请求且未过期 String targetName = null; if (args.length > 0) { - targetName = args[0]; - } - - // 如果是无参调用,收集 incoming senders 来判断 - Set currentIncoming = incomingRequests.get(player.getName()); - if ((targetName == null || targetName.isEmpty()) && (currentIncoming == null || currentIncoming.isEmpty())) { - player.sendMessage("§c[传送] 你没有待处理的传送请求"); - return true; - } - - // 如果有目标名,检查请求是否仍然有效 - if (targetName != null && !targetName.isEmpty()) { - if (!isValidRequest(player.getName(), targetName)) { - player.sendMessage("§c[传送] 请求 §f" + targetName + " §c的传送请求已过期或不存在"); - return true; + String arg = args[0]; + // ★ 优先当玩家名处理,在线则直接走玩家名逻辑 + Player possiblePlayer = Bukkit.getServer().getPlayer(arg); + if (possiblePlayer != null && possiblePlayer.isOnline()) { + targetName = arg; + } else { + try { + int index = Integer.parseInt(arg); + return handleTPAcceptCLI(player, index); + } catch (NumberFormatException e) { + targetName = arg; + } } }