125续15h 修 /rules 找不到命令 + JSON 块乱签仍按用户协议处置
Auto Release / build (push) Successful in 4m19s

两个根因:
1. /rules 找不到命令:15g 漏在 plugin.yml 注册 /rules(Bukkit 要求自定义命令必须声明)。补 commands: rules: 条目。
2. JSON 块乱签仍按用户协议 del 处置:executeDenyAction 入口无差别重读 用户协议/action.json 并强制覆盖 actions.denyAction。
   15f 把 JSON 块乱签接进 executeDenyAction 后,JSON 块的 deny:kick 被 action.json 的 del 覆盖(截图铁证:JSON 块配置 deny:kick 但踢出文案仍是用户协议 del 文案)。
   修复:PendingSign 加 isJsonBlock 标记(pendingFile 含「公告/自定义屏幕」→ true);
   executeDenyAction 加 jsonBlockSource 参数,JSON 块场景跳过重读 action.json,沿用 markdown 内嵌 json 块的 deny 值;
   踢出/封禁文案按 jsonBlockSource 分流(用户协议 vs 该通知)。
   4 处乱签分支 + confirmDeny 调用点统一改 executeDenyAction(p, actions, isJsonBlock)。

编译 rc=0,jar 36e80fd3。
This commit is contained in:
youpaishidifu
2026-11-19 18:24:50 +08:00
parent 676ab7db55
commit df6bcf0b1a
2 changed files with 54 additions and 30 deletions
@@ -278,7 +278,7 @@ public class CustomScreenManager implements Listener {
* 死循环弹窗:关闭即重弹,必须表态(签收或拒签)。 * 死循环弹窗:关闭即重弹,必须表态(签收或拒签)。
*/ */
private void showBedrockSign(Player p, String pendingFile, String ackFileName, String content, ActionConfig actions) { private void showBedrockSign(Player p, String pendingFile, String ackFileName, String content, ActionConfig actions) {
PendingSign ps = new PendingSign(pendingFile, ackFileName, content, actions); PendingSign ps = new PendingSign(pendingFile, ackFileName, content, actions, pendingFile.contains(NOTIFICATION_DIR));
pendingSigs.put(p.getUniqueId(), ps); pendingSigs.put(p.getUniqueId(), ps);
// ══ 125 续15 修复 Bug1(基岩版按钮无效):标题用纯 ASCII "AGREEMENT_SIGN" ══ // ══ 125 续15 修复 Bug1(基岩版按钮无效):标题用纯 ASCII "AGREEMENT_SIGN" ══
@@ -502,7 +502,7 @@ public class CustomScreenManager implements Listener {
* 死循环:未表态前每次上线都重新弹。 * 死循环:未表态前每次上线都重新弹。
*/ */
private void showCustomScreen(Player p, String pendingFile, String ackFileName, String content, ActionConfig actions) { private void showCustomScreen(Player p, String pendingFile, String ackFileName, String content, ActionConfig actions) {
PendingSign ps = new PendingSign(pendingFile, ackFileName, content, actions); PendingSign ps = new PendingSign(pendingFile, ackFileName, content, actions, pendingFile.contains(NOTIFICATION_DIR));
pendingSigs.put(p.getUniqueId(), ps); pendingSigs.put(p.getUniqueId(), ps);
try { try {
@@ -582,7 +582,7 @@ public class CustomScreenManager implements Listener {
// 把用户协议专属处置套到 JSON 块场景(用户铁证:JSON 块配置 deny:kick,但被按用户协议规则处置)。 // 把用户协议专属处置套到 JSON 块场景(用户铁证:JSON 块配置 deny:kick,但被按用户协议规则处置)。
// 现改:提示乱写 + 立即执行当前 JSON 块 denyAction(kick/del/ban),两种处置彻底解耦。 // 现改:提示乱写 + 立即执行当前 JSON 块 denyAction(kick/del/ban),两种处置彻底解耦。
player.sendMessage(Component.text("§c签名「" + sigTrim + "」与您的游戏ID(" + player.getName() + ")不匹配,闲杂人员过不了门禁,将执行拒签动作。")); player.sendMessage(Component.text("§c签名「" + sigTrim + "」与您的游戏ID(" + player.getName() + ")不匹配,闲杂人员过不了门禁,将执行拒签动作。"));
executeDenyAction(player, cur.actions); executeDenyAction(player, cur.actions, cur.isJsonBlock);
cleanupUI(player); cleanupUI(player);
pendingSigs.remove(player.getUniqueId()); pendingSigs.remove(player.getUniqueId());
draftSignatures.remove(player.getUniqueId()); draftSignatures.remove(player.getUniqueId());
@@ -694,7 +694,7 @@ public class CustomScreenManager implements Listener {
// ★ 125 续15f 解耦:乱写签名=闲杂人员,走拒签路径(executeDenyAction)而非"用户协议送客"路径。 // ★ 125 续15f 解耦:乱写签名=闲杂人员,走拒签路径(executeDenyAction)而非"用户协议送客"路径。
// 提示乱写 + 立即执行当前 JSON 块 denyAction(kick/del/ban),两种处置彻底解耦。 // 提示乱写 + 立即执行当前 JSON 块 denyAction(kick/del/ban),两种处置彻底解耦。
player.sendMessage(Component.text("§c签名「" + sigTrim + "」与您的游戏ID(" + player.getName() + ")不匹配,闲杂人员过不了门禁,将执行拒签动作。")); player.sendMessage(Component.text("§c签名「" + sigTrim + "」与您的游戏ID(" + player.getName() + ")不匹配,闲杂人员过不了门禁,将执行拒签动作。"));
executeDenyAction(player, cur.actions); executeDenyAction(player, cur.actions, cur.isJsonBlock);
cleanupUI(player); cleanupUI(player);
pendingSigs.remove(player.getUniqueId()); pendingSigs.remove(player.getUniqueId());
draftSignatures.remove(player.getUniqueId()); draftSignatures.remove(player.getUniqueId());
@@ -937,7 +937,7 @@ public class CustomScreenManager implements Listener {
return; return;
} }
// 执行拒签动作 // 执行拒签动作
executeDenyAction(player, ps.actions); executeDenyAction(player, ps.actions, ps.isJsonBlock);
cleanupUI(player); cleanupUI(player);
pendingSigs.remove(player.getUniqueId()); pendingSigs.remove(player.getUniqueId());
draftSignatures.remove(player.getUniqueId()); draftSignatures.remove(player.getUniqueId());
@@ -990,31 +990,38 @@ public class CustomScreenManager implements Listener {
} }
} }
private void executeDenyAction(Player p, ActionConfig actions) { private void executeDenyAction(Player p, ActionConfig actions, boolean jsonBlockSource) {
// ★ 125 续11:入口重新读 action.json(用当前时刻值覆盖弹窗时刻的旧值) // ★ 125 续11:入口重新读 action.json(用当前时刻值覆盖弹窗时刻的旧值)
// 根因:弹窗时刻 parseActionConfig 读 action.json 失败走默认 kick → PendingSign.actions.denyAction=kick; // 根因:弹窗时刻 parseActionConfig 读 action.json 失败走默认 kick → PendingSign.actions.denyAction=kick;
// 拒签执行时重新读 action.json 成功(del),但旧代码仍用旧对象的 kick 值("动作挂错了")。 // 拒签执行时重新读 action.json 成功(del),但旧代码仍用旧对象的 kick 值("动作挂错了")。
// 修复:executeDenyAction 入口先重新读 action.json,若读到合法 deny 值则覆盖 actions.denyAction。 // 修复:executeDenyAction 入口先重新读 action.json,若读到合法 deny 值则覆盖 actions.denyAction。
// ★ 125 续15h 解耦:JSON 块场景(jsonBlockSource=true)跳过重读 action.json——
// JSON 块的 deny 来自 markdown 内嵌 json 块(已在 parseActionConfig 阶段正确读入 actions.denyAction),
// 不应被 用户协议/action.json 的 deny 值覆盖(15f 漏改根因:JSON 块 deny:kick 被 action.json del 覆盖 → 按用户协议处置)。
String oldDeny = actions.denyAction; String oldDeny = actions.denyAction;
try { if (!jsonBlockSource) {
File diagJson = new File(plugin.getDataFolder(), AGREEMENT_DIR + "/action.json"); try {
if (diagJson.exists()) { File diagJson = new File(plugin.getDataFolder(), AGREEMENT_DIR + "/action.json");
String raw = new String(Files.readAllBytes(diagJson.toPath())); if (diagJson.exists()) {
plugin.getLogger().warning("[自定义屏幕][诊断] action.json 原文(路径: " + diagJson.getAbsolutePath() + "):\n" + raw); String raw = new String(Files.readAllBytes(diagJson.toPath()));
// 解析重新读到的 deny 值(覆盖旧值) plugin.getLogger().warning("[自定义屏幕][诊断] action.json 原文(路径: " + diagJson.getAbsolutePath() + "):\n" + raw);
ActionConfig fresh = new ActionConfig(); // 解析重新读到的 deny 值(覆盖旧值)
parseJsonConfig(raw, fresh); ActionConfig fresh = new ActionConfig();
if (fresh.denyAction != null && !fresh.denyAction.isEmpty() parseJsonConfig(raw, fresh);
&& !fresh.denyAction.equalsIgnoreCase(oldDeny)) { if (fresh.denyAction != null && !fresh.denyAction.isEmpty()
plugin.getLogger().warning("[自定义屏幕][诊断] 重新读取 action.json 的 deny 值: " + fresh.denyAction && !fresh.denyAction.equalsIgnoreCase(oldDeny)) {
+ "(弹窗时刻旧值: " + oldDeny + "),已覆盖"); plugin.getLogger().warning("[自定义屏幕][诊断] 重新读取 action.json 的 deny 值: " + fresh.denyAction
actions.denyAction = fresh.denyAction; + "(弹窗时刻旧值: " + oldDeny + "),已覆盖");
actions.denyAction = fresh.denyAction;
}
} else {
plugin.getLogger().warning("[自定义屏幕][诊断] action.json 不存在(路径: " + diagJson.getAbsolutePath() + "),沿用弹窗时刻值 " + oldDeny);
} }
} else { } catch (Exception ex) {
plugin.getLogger().warning("[自定义屏幕][诊断] action.json 不存在(路径: " + diagJson.getAbsolutePath() + "),沿用弹窗时刻值 " + oldDeny); plugin.getLogger().warning("[自定义屏幕][诊断] 读取 action.json 失败: " + ex.getMessage() + ",沿用弹窗时刻值 " + oldDeny);
} }
} catch (Exception ex) { } else {
plugin.getLogger().warning("[自定义屏幕][诊断] 读取 action.json 失败: " + ex.getMessage() + ",沿用弹窗时刻值 " + oldDeny); plugin.getLogger().info("[自定义屏幕][诊断] JSON 块场景,沿用 markdown 内嵌 json 块的 deny 值: " + oldDeny + "(不重读 action.json)");
} }
String action = normalizeAction(actions.denyAction); String action = normalizeAction(actions.denyAction);
plugin.getLogger().info("[自定义屏幕] 玩家 " + p.getName() + " 拒签,执行动作: " + action plugin.getLogger().info("[自定义屏幕] 玩家 " + p.getName() + " 拒签,执行动作: " + action
@@ -1038,14 +1045,21 @@ public class CustomScreenManager implements Listener {
// 阻断 5 分钟快速重连窗口内检查点1/2 的"自动登录"(f030帧铁证"您已自动登录!")。 // 阻断 5 分钟快速重连窗口内检查点1/2 的"自动登录"(f030帧铁证"您已自动登录!")。
// 重进时 autoLogin 漏斗命中 isDeletedByDeny → 强制 /reg 重新注册 + /login。 // 重进时 autoLogin 漏斗命中 isDeletedByDeny → 强制 /reg 重新注册 + /login。
main.markDeletedByDeny(p.getName()); main.markDeletedByDeny(p.getName());
p.kick(Component.text("您已拒签用户协议,账号已被删除并被踢出服务器,需重新注册后方可再次进入。如有疑问请联系管理员。")); // ★ 125 续15h 解耦文案:用户协议 vs JSON 块公告 两种场景文案分开
p.kick(Component.text(jsonBlockSource
? "您已拒签该通知,账号已被删除并被踢出服务器,需重新注册后方可再次进入。如有疑问请联系管理员。"
: "您已拒签用户协议,账号已被删除并被踢出服务器,需重新注册后方可再次进入。如有疑问请联系管理员。"));
break; break;
case "kick": case "kick":
p.kick(Component.text("您已拒签用户协议,已被踢出服务器。如有疑问请联系管理员。")); p.kick(Component.text(jsonBlockSource
? "您已拒签该通知,已被踢出服务器。如有疑问请联系管理员。"
: "您已拒签用户协议,已被踢出服务器。如有疑问请联系管理员。"));
plugin.getLogger().info("[自定义屏幕] " + p.getName() + " 已踢出(kick)"); plugin.getLogger().info("[自定义屏幕] " + p.getName() + " 已踢出(kick)");
break; break;
case "ban": case "ban":
p.ban("您已拒签用户协议,已被封禁 1 年。如有疑问请联系管理员。", p.ban(jsonBlockSource
? "您已拒签该通知,已被封禁 1 年。如有疑问请联系管理员。"
: "您已拒签用户协议,已被封禁 1 年。如有疑问请联系管理员。",
java.time.Duration.ofDays(365), "Sdf1_login", false); java.time.Duration.ofDays(365), "Sdf1_login", false);
plugin.getLogger().info("[自定义屏幕] " + p.getName() + " 已封禁 1 年(ban)"); plugin.getLogger().info("[自定义屏幕] " + p.getName() + " 已封禁 1 年(ban)");
break; break;
@@ -1067,7 +1081,9 @@ public class CustomScreenManager implements Listener {
// ★ 125 续7:未知动作不再静默跳过(旧行为是"跳过执行",玩家看起来像"只关屏幕没后果"), // ★ 125 续7:未知动作不再静默跳过(旧行为是"跳过执行",玩家看起来像"只关屏幕没后果"),
// 保底执行 kick(最小副作用),同时大声 warning 提示管理员检查 action.json 配置。 // 保底执行 kick(最小副作用),同时大声 warning 提示管理员检查 action.json 配置。
plugin.getLogger().warning("[自定义屏幕] 未知拒签动作「" + action + "」(原始值「" + actions.denyAction + "」),已保底执行 kick。合法值:del/rm/delete/删号、kick/踢出、ban、banip"); plugin.getLogger().warning("[自定义屏幕] 未知拒签动作「" + action + "」(原始值「" + actions.denyAction + "」),已保底执行 kick。合法值:del/rm/delete/删号、kick/踢出、ban、banip");
p.kick(Component.text("您已拒签用户协议,已被踢出服务器(拒签动作未识别,已执行保底踢出)。如有疑问请联系管理员。")); p.kick(Component.text(jsonBlockSource
? "您已拒签该通知,已被踢出服务器(拒签动作未识别,已执行保底踢出)。如有疑问请联系管理员。"
: "您已拒签用户协议,已被踢出服务器(拒签动作未识别,已执行保底踢出)。如有疑问请联系管理员。"));
break; break;
} }
} }
@@ -1203,7 +1219,7 @@ public class CustomScreenManager implements Listener {
if (!draft.equalsIgnoreCase(p.getName())) { if (!draft.equalsIgnoreCase(p.getName())) {
// ★ 125 续15f 解耦:聊天里乱写签名=闲杂人员,走拒签路径(executeDenyAction)而非"用户协议送客"路径。 // ★ 125 续15f 解耦:聊天里乱写签名=闲杂人员,走拒签路径(executeDenyAction)而非"用户协议送客"路径。
p.sendMessage(Component.text("§c签名「" + draft + "」与您的游戏ID(" + p.getName() + ")不匹配,闲杂人员过不了门禁,将执行拒签动作。")); p.sendMessage(Component.text("§c签名「" + draft + "」与您的游戏ID(" + p.getName() + ")不匹配,闲杂人员过不了门禁,将执行拒签动作。"));
executeDenyAction(p, ps.actions); executeDenyAction(p, ps.actions, ps.isJsonBlock);
cleanupUI(p); cleanupUI(p);
pendingSigs.remove(p.getUniqueId()); pendingSigs.remove(p.getUniqueId());
draftSignatures.remove(p.getUniqueId()); draftSignatures.remove(p.getUniqueId());
@@ -1263,7 +1279,7 @@ public class CustomScreenManager implements Listener {
} else { } else {
// ★ 125 续15f 解耦:乱写签名=闲杂人员,走拒签路径(executeDenyAction)而非"用户协议送客"路径。 // ★ 125 续15f 解耦:乱写签名=闲杂人员,走拒签路径(executeDenyAction)而非"用户协议送客"路径。
p.sendMessage(Component.text("§c签名「" + signature + "」与您的游戏ID(" + p.getName() + ")不匹配,闲杂人员过不了门禁,将执行拒签动作。")); p.sendMessage(Component.text("§c签名「" + signature + "」与您的游戏ID(" + p.getName() + ")不匹配,闲杂人员过不了门禁,将执行拒签动作。"));
executeDenyAction(p, ps.actions); executeDenyAction(p, ps.actions, ps.isJsonBlock);
cleanupUI(p); cleanupUI(p);
pendingSigs.remove(p.getUniqueId()); pendingSigs.remove(p.getUniqueId());
draftSignatures.remove(p.getUniqueId()); draftSignatures.remove(p.getUniqueId());
@@ -1347,11 +1363,16 @@ public class CustomScreenManager implements Listener {
final String ackFileName; // 回执文件名(全局协议=玩家名.md,玩家通知=原文件名) final String ackFileName; // 回执文件名(全局协议=玩家名.md,玩家通知=原文件名)
final String content; final String content;
final ActionConfig actions; final ActionConfig actions;
PendingSign(String pendingFile, String ackFileName, String content, ActionConfig actions) { // ★ 125 续15h:标记来源(用户协议 / JSON 块公告)。
// JSON 块场景(pendingFile 含「公告/自定义屏幕」)的 actions.denyAction 来自 markdown 内嵌 json 块,
// executeDenyAction 不应再重新读 用户协议/action.json 覆盖(15f 漏改的根因:JSON 块 deny:kick 被用户协议 action.json 的 del 覆盖)。
final boolean isJsonBlock;
PendingSign(String pendingFile, String ackFileName, String content, ActionConfig actions, boolean isJsonBlock) {
this.pendingFile = pendingFile; this.pendingFile = pendingFile;
this.ackFileName = ackFileName; this.ackFileName = ackFileName;
this.content = content; this.content = content;
this.actions = actions; this.actions = actions;
this.isJsonBlock = isJsonBlock;
} }
} }
+3
View File
@@ -214,3 +214,6 @@ commands:
credits: credits:
description: 信誉积分管理(上报/审批/记录/规则) description: 信誉积分管理(上报/审批/记录/规则)
usage: /credits [上报|审批|记录|规则] [参数] usage: /credits [上报|审批|记录|规则] [参数]
rules:
description: 查看已签协议原文(CLI 分页 / GUI 书与笔)
usage: /rules [协议名|gui|prev|next|back|quit]