conmsg: clear 作为保留子参数,恢复默认署名(不再当名字设置出去)
Check Source / check (push) Successful in 3s
Auto Release / build (push) Successful in 2m22s
Simple Test / test (push) Successful in 1s
Test Env / test (push) Successful in 1s

This commit is contained in:
youpaishidifu
2026-10-03 23:26:51 +08:00
parent c17c606ff2
commit c07c97b7ea
2 changed files with 13 additions and 3 deletions
+11 -1
View File
@@ -6530,8 +6530,18 @@ public class Main extends JavaPlugin
// 换行/制表一律压成空格(署名占一行,多行会破聊天框版式);
// 色码保留,由 parseLegacyOneLine 统一按 & 解析。
nm = nm.replaceAll("[\\r\\n\\t]+", " ").trim();
// ★ "clear" 是 conmsg 的保留子参数 = 恢复出厂设置(署名回到默认"管理员")。
// 只在本分支拦:控制台/玩家直接敲 /clear 仍走原版清背包,插件不接管。
if ("clear".equalsIgnoreCase(nm)) {
consoleName = null;
sender.sendMessage("§a已恢复控制台发言署名为默认:§f"
+ getConsoleName());
sender.sendMessage("§7(想清背包请直接敲 §f/clear §7,那是原版指令)");
getLogger().info("[无感切换] 控制台署名已恢复默认");
return true;
}
if (nm.isEmpty()) {
sender.sendMessage("§e用法: §f/conmsg <名字>");
sender.sendMessage("§e用法: §f/conmsg <名字> §e或 §f/conmsg clear §8(恢复默认)");
sender.sendMessage("§7当前署名: §f" + getConsoleName());
} else {
if (nm.length() > 16) nm = nm.substring(0, 16);
+2 -2
View File
@@ -118,8 +118,8 @@ commands:
description: 生成Web端登录令牌
usage: /web
conmsg:
description: 控制台发言署名(仅控制台可用,替换转发聊天时的 Console 字样)
usage: /conmsg <名字>
description: 控制台发言署名(仅控制台可用,替换转发聊天时的 Console 字样)—— conmsg clear 恢复默认"管理员"
usage: /conmsg <名字> | /conmsg clear
控制台:
description: 生成Web端登录令牌(中文版)
usage: /控制台