用户设计口径(类比 app 打勾进服务 + 额外签名层): - 签收:点「✓ 签收」= 打了勾(知情同意),但额外加一层签名确认。签名空 → 不粗暴拒绝, 弹新 Dialog 要求填签名(满足「爱撒谎/没看见」路径——知情即可,签名是附加确认层); 签名非空 → 直接落盘回执单,玩家正常游戏。 - 拒签:点「✘ 拒签」→ 弹二次确认 Dialog(讲清利害关系:拒签后果=del 删号+踢出需重新注册, 两按钮「确认拒签」/「后悔,继续签署」);点「确认拒签」→ 走 executeDenyAction; 点「后悔」→ 退回主 Dialog 重新签署。 修复(commit 125 续13,CustomScreenManager): ① 签收按钮回调:signature 空 → showSignatureDialog(新 Dialog 要求填签名,仍空则提示重填再弹一次); 非空 → handleAccept(玩家名兜底保证校验通过)。 ② 拒签按钮回调:不再直接 confirmDeny,改 showDenyConfirmDialog(二次确认屏,含后果说明 + 「确认拒签」/「后悔继续签署」两按钮;后悔→2tick 后重弹主 Dialog)。 ③ 新增 showSignatureDialog + showDenyConfirmDialog 两个方法(MultiActionType,独立回调)。 部署:commit + jar 双端 SFTP MATCH。未重启。 重启后验:Java 版玩家上线弹 Dialog → ① 点「✓ 签收」不填签名 → 弹「请签收」Dialog 要求填游戏ID, 填了→落盘回执单玩家正常游戏;② 点「✘ 拒签」→ 弹「拒签确认」Dialog 讲后果(删号+踢出需重新注册), 点「确认拒签」→ del 删号+kick;点「后悔,继续签署」→ 退回主 Dialog 可重新签。
This commit is contained in:
@@ -492,14 +492,20 @@ public class CustomScreenManager implements Listener {
|
||||
if (!(audience instanceof Player player)) return;
|
||||
PendingSign cur = pendingSigs.get(player.getUniqueId());
|
||||
if (cur == null) return;
|
||||
// ★ 125 续12:点「签收」按钮 = 明确同意,直接签收(不依赖签名匹配)。
|
||||
// 签名从 DialogInput key="signature" 取;若空或不匹配玩家名,统一用玩家名兜底
|
||||
// (保证 handleAccept L625 的「signature==玩家名」校验必通过,回执单能落盘)。
|
||||
// ★ 125 续13:点「签收」按钮 = 明确同意。
|
||||
// 签名从 DialogInput key="signature" 取;若空 → 弹新 Dialog 要求签名(不粗暴拒绝,
|
||||
// 满足玩家「爱撒谎/没看见」的路径——知情即可,签名只是附加确认层);
|
||||
// 签名非空 → 直接 handleAccept 落盘回执单(用玩家名兜底保证校验通过)。
|
||||
String signature = response.getText("signature");
|
||||
String sigTrim = signature != null ? signature.trim() : "";
|
||||
String sigForAck = (!sigTrim.isEmpty() && sigTrim.equalsIgnoreCase(player.getName()))
|
||||
? sigTrim : player.getName(); // 空/不匹配 → 玩家名兜底
|
||||
if (sigTrim.isEmpty()) {
|
||||
// 签名缺失 → 弹签名 Dialog(要求填写游戏ID)
|
||||
showSignatureDialog(player, cur);
|
||||
} else {
|
||||
String sigForAck = sigTrim.equalsIgnoreCase(player.getName())
|
||||
? sigTrim : player.getName(); // 不匹配也用玩家名兜底
|
||||
handleAccept(player, cur, sigForAck);
|
||||
}
|
||||
},
|
||||
acceptOptions
|
||||
)
|
||||
@@ -515,9 +521,9 @@ public class CustomScreenManager implements Listener {
|
||||
if (!(audience instanceof Player player)) return;
|
||||
PendingSign cur = pendingSigs.get(player.getUniqueId());
|
||||
if (cur == null) return;
|
||||
String signature = response.getText("signature");
|
||||
confirmDeny(player, new File(cur.pendingFile).getName(),
|
||||
signature != null ? signature.trim() : "");
|
||||
// ★ 125 续13:点「拒签」按钮 → 弹二次确认 Dialog(讲清利害关系:
|
||||
// 拒签后果=del 删号+踢出,需重新注册;两按钮「确认拒签」/「后悔继续签署」)。
|
||||
showDenyConfirmDialog(player, cur);
|
||||
},
|
||||
denyOptions
|
||||
)
|
||||
@@ -551,6 +557,166 @@ public class CustomScreenManager implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ★ 125 续13:签名缺失时弹新 Dialog(要求填写游戏ID,不粗暴拒绝——知情即可,签名是附加确认层)。
|
||||
* 类比 app 设计:打了勾(点签收按钮)就能进,只不过额外加一层签名确认。
|
||||
*/
|
||||
private void showSignatureDialog(Player p, PendingSign ps) {
|
||||
try {
|
||||
io.papermc.paper.registry.data.dialog.DialogBase base =
|
||||
io.papermc.paper.registry.data.dialog.DialogBase.builder(
|
||||
Component.text("【请签收】" + new File(ps.pendingFile).getName())
|
||||
)
|
||||
.canCloseWithEscape(false)
|
||||
.afterAction(io.papermc.paper.registry.data.dialog.DialogBase.DialogAfterAction.CLOSE)
|
||||
.body(java.util.List.of(
|
||||
io.papermc.paper.registry.data.dialog.body.DialogBody.plainMessage(
|
||||
Component.text("§e您尚未填写签名。请输入您的游戏ID作为签名后确认签收。")
|
||||
.color(net.kyori.adventure.text.format.NamedTextColor.YELLOW),
|
||||
300
|
||||
)
|
||||
))
|
||||
.inputs(java.util.List.of(
|
||||
io.papermc.paper.registry.data.dialog.input.DialogInput.text(
|
||||
"signature", 300,
|
||||
Component.text("签名(输入您的游戏ID)"),
|
||||
true, "", 64, null
|
||||
)
|
||||
))
|
||||
.build();
|
||||
|
||||
final ClickCallback.Options sigOpts = ClickCallback.Options.builder()
|
||||
.uses(ClickCallback.UNLIMITED_USES).build();
|
||||
|
||||
io.papermc.paper.registry.data.dialog.ActionButton confirmBtn =
|
||||
io.papermc.paper.registry.data.dialog.ActionButton.create(
|
||||
Component.text("§a§l✔ 确认签收"),
|
||||
Component.text("填写签名后确认签收用户协议"),
|
||||
200,
|
||||
io.papermc.paper.registry.data.dialog.action.DialogAction.customClick(
|
||||
(response, audience) -> {
|
||||
if (!(audience instanceof Player player)) return;
|
||||
PendingSign cur = pendingSigs.get(player.getUniqueId());
|
||||
if (cur == null) return;
|
||||
String signature = response.getText("signature");
|
||||
String sigTrim = signature != null ? signature.trim() : "";
|
||||
if (sigTrim.isEmpty()) {
|
||||
// 仍为空 → 提示重新填写(不粗暴拒绝,再弹一次)
|
||||
player.sendMessage(Component.text("§c签名不能为空,请重新填写您的游戏ID"));
|
||||
showSignatureDialog(player, cur);
|
||||
return;
|
||||
}
|
||||
String sigForAck = sigTrim.equalsIgnoreCase(player.getName())
|
||||
? sigTrim : player.getName();
|
||||
handleAccept(player, cur, sigForAck);
|
||||
},
|
||||
sigOpts
|
||||
)
|
||||
);
|
||||
|
||||
io.papermc.paper.registry.data.dialog.type.MultiActionType type =
|
||||
io.papermc.paper.registry.data.dialog.type.DialogType.multiAction(
|
||||
java.util.List.of(confirmBtn), null, 1);
|
||||
|
||||
io.papermc.paper.dialog.Dialog dialog = io.papermc.paper.dialog.Dialog.create(
|
||||
builder -> builder.empty().base(base).type(type));
|
||||
p.showDialog(dialog);
|
||||
plugin.getLogger().info("[自定义屏幕] " + p.getName() + " 签名 Dialog 已弹出(签名缺失,要求填写)");
|
||||
} catch (Exception ex) {
|
||||
plugin.getLogger().warning("[自定义屏幕] 签名 Dialog 弹出失败: " + ex.getMessage());
|
||||
p.sendMessage(Component.text("§c签名 Dialog 弹出失败,请直接输入 /sdf1_login sign <您的游戏ID> 签收"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ★ 125 续13:拒签二次确认 Dialog(讲清利害关系,可后悔退回)。
|
||||
* 两按钮:「确认拒签」(走 executeDenyAction)/「后悔,继续签署」(退回主 Dialog 重新签署)。
|
||||
*/
|
||||
private void showDenyConfirmDialog(Player p, PendingSign ps) {
|
||||
try {
|
||||
String consequences = ps.actions.denyAction.equalsIgnoreCase("del")
|
||||
? "§c拒签后果:账号将从登录数据库删除,并被踢出服务器,需重新注册后方可再次进入。此操作不可撤销。"
|
||||
: "§c拒签后果:执行 " + ps.actions.denyAction + " 动作(具体后果取决于配置)。";
|
||||
|
||||
io.papermc.paper.registry.data.dialog.DialogBase base =
|
||||
io.papermc.paper.registry.data.dialog.DialogBase.builder(
|
||||
Component.text("【拒签确认】" + new File(ps.pendingFile).getName())
|
||||
)
|
||||
.canCloseWithEscape(true) // 允许 ESC 关闭(= 后悔,不拒签)
|
||||
.afterAction(io.papermc.paper.registry.data.dialog.DialogBase.DialogAfterAction.NONE)
|
||||
.body(java.util.List.of(
|
||||
io.papermc.paper.registry.data.dialog.body.DialogBody.plainMessage(
|
||||
Component.text(consequences)
|
||||
.color(net.kyori.adventure.text.format.NamedTextColor.RED),
|
||||
400
|
||||
),
|
||||
io.papermc.paper.registry.data.dialog.body.DialogBody.plainMessage(
|
||||
Component.text("§7您确定要拒签吗?点「确认拒签」执行,点「后悔,继续签署」退回重新签署。")
|
||||
.color(net.kyori.adventure.text.format.NamedTextColor.GRAY),
|
||||
300
|
||||
)
|
||||
))
|
||||
.build();
|
||||
|
||||
final ClickCallback.Options denyConfirmOpts = ClickCallback.Options.builder()
|
||||
.uses(ClickCallback.UNLIMITED_USES).build();
|
||||
final ClickCallback.Options denyCancelOpts = ClickCallback.Options.builder()
|
||||
.uses(ClickCallback.UNLIMITED_USES).build();
|
||||
|
||||
io.papermc.paper.registry.data.dialog.ActionButton confirmDenyBtn =
|
||||
io.papermc.paper.registry.data.dialog.ActionButton.create(
|
||||
Component.text("§c§l✘ 确认拒签"),
|
||||
Component.text("执行 " + ps.actions.denyAction + " 动作(不可撤销)"),
|
||||
200,
|
||||
io.papermc.paper.registry.data.dialog.action.DialogAction.customClick(
|
||||
(response, audience) -> {
|
||||
if (!(audience instanceof Player player)) return;
|
||||
PendingSign cur = pendingSigs.get(player.getUniqueId());
|
||||
if (cur == null) return;
|
||||
// 二次确认通过 → 真正执行拒签动作
|
||||
confirmDeny(player, new File(cur.pendingFile).getName(), "");
|
||||
},
|
||||
denyConfirmOpts
|
||||
)
|
||||
);
|
||||
|
||||
io.papermc.paper.registry.data.dialog.ActionButton regretBtn =
|
||||
io.papermc.paper.registry.data.dialog.ActionButton.create(
|
||||
Component.text("§a§l↩ 后悔,继续签署"),
|
||||
Component.text("退回主 Dialog 重新签署用户协议"),
|
||||
200,
|
||||
io.papermc.paper.registry.data.dialog.action.DialogAction.customClick(
|
||||
(response, audience) -> {
|
||||
if (!(audience instanceof Player player)) return;
|
||||
PendingSign cur = pendingSigs.get(player.getUniqueId());
|
||||
if (cur == null) return;
|
||||
// 后悔 → 退回主 Dialog(重新弹出待签收屏)
|
||||
player.sendMessage(Component.text("§6已退回,请重新签署用户协议"));
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
|
||||
if (player.isOnline() && pendingSigs.containsKey(player.getUniqueId())) {
|
||||
showCustomScreen(player, cur.pendingFile, cur.ackFileName, cur.content, cur.actions);
|
||||
}
|
||||
}, 2L);
|
||||
},
|
||||
denyCancelOpts
|
||||
)
|
||||
);
|
||||
|
||||
io.papermc.paper.registry.data.dialog.type.MultiActionType type =
|
||||
io.papermc.paper.registry.data.dialog.type.DialogType.multiAction(
|
||||
java.util.List.of(confirmDenyBtn, regretBtn), null, 1);
|
||||
|
||||
io.papermc.paper.dialog.Dialog dialog = io.papermc.paper.dialog.Dialog.create(
|
||||
builder -> builder.empty().base(base).type(type));
|
||||
p.showDialog(dialog);
|
||||
plugin.getLogger().info("[自定义屏幕] " + p.getName() + " 拒签二次确认 Dialog 已弹出");
|
||||
} catch (Exception ex) {
|
||||
plugin.getLogger().warning("[自定义屏幕] 拒签确认 Dialog 弹出失败: " + ex.getMessage());
|
||||
p.sendMessage(Component.text("§c拒签确认 Dialog 弹出失败,请输入 /sdf1_login confirm deny "
|
||||
+ new File(ps.pendingFile).getName() + " 确认拒签"));
|
||||
}
|
||||
}
|
||||
|
||||
private org.bukkit.inventory.meta.ItemMeta buildMeta(Material mat, String displayName, String lore) {
|
||||
org.bukkit.inventory.meta.ItemMeta meta = plugin.getServer().getItemFactory().getItemMeta(mat);
|
||||
if (meta != null) {
|
||||
|
||||
Reference in New Issue
Block a user