第87批 液体使用语义统一+违禁品退还消息中文化

- AreaCLIManager.getPermList: liquid 动态label改静态'液体使用'(与GUI 500/703行一致)
- getPermNameByKey: 补 liquid→'液体使用'(切换消息不再弹英文liquid)
- togglePerm 切换消息: 按列表enabled语义显示——deny类显示oldState、allow/和平/公共类显示!oldState,
  修复'消息已启用但列表已禁用'语义反转(所有开关受益)
- togglePlayerPerm 设置消息: 统一为'✔已启用/✘已禁用',与per-player列表渲染语义对齐
- AreaProtection.handleConfiscate: 默认没收文案按returnOnLeave分叉——
  退还开启:'你的物品被设为违禁品,离开领地时会自动退还';关闭:'你携带了违禁品,已被没收'
- Matname/英文物品名: matname()→ItemNameResolver.toChinese()(没收/退还两处,中文名如'岩浆桶')
- handleConfiscateReturn: 文案'已退还没收物品'→'你的物品在此领地被设为违禁品,离开时已自动退还'
This commit is contained in:
youpaishidifu
2026-11-05 20:00:00 +08:00
parent 059884772b
commit db437ca193
2 changed files with 16 additions and 8 deletions
+9 -3
View File
@@ -630,7 +630,10 @@ public class AreaCLIManager {
String permName = getPermNameByKey(permKey); String permName = getPermNameByKey(permKey);
boolean newState = !oldState; boolean newState = !oldState;
p.sendMessage("§a已切换 §e" + permName + " §7→ " + (newState ? "§a已启用" : "§c已关闭")); // ★ 显示语义与列表渲染保持一致:列表 enabled 对 deny 类开关=!denyXXX(切换后 =oldState),
// 对 allow/和平/公共类=字段值本身(切换后 =newState)。避免「消息已启用/列表已禁用」错位。
boolean shownOn = shortKeyToDenyField(permKey).startsWith("deny") ? oldState : newState;
p.sendMessage("§a已切换 §e" + permName + " §7→ " + (shownOn ? "§a✔已启用" : "§c✘已禁用"));
} }
/** /**
@@ -717,7 +720,7 @@ public class AreaCLIManager {
perms.add(new PermItem("block_break", "破坏方块", !land.denyBlockBreak)); perms.add(new PermItem("block_break", "破坏方块", !land.denyBlockBreak));
perms.add(new PermItem("spawn_egg", "生物蛋", !land.denySpawnEgg)); perms.add(new PermItem("spawn_egg", "生物蛋", !land.denySpawnEgg));
perms.add(new PermItem("wax", "涂蜡/刮蜡", !land.denyWax)); perms.add(new PermItem("wax", "涂蜡/刮蜡", !land.denyWax));
perms.add(new PermItem("liquid", land.denyLiquidUse ? "禁止舀水/岩浆(含炼药锅)" : "允许舀水/岩浆(含炼药锅)", !land.denyLiquidUse)); perms.add(new PermItem("liquid", "液体使用", !land.denyLiquidUse));
perms.add(new PermItem("entity_interact", "实体交互(船/矿车/盔甲架/展示框)", !land.denyEntityInteract)); perms.add(new PermItem("entity_interact", "实体交互(船/矿车/盔甲架/展示框)", !land.denyEntityInteract));
perms.add(new PermItem("container", "容器管理", !land.denyContainer)); perms.add(new PermItem("container", "容器管理", !land.denyContainer));
perms.add(new PermItem("pvp", "玩家对战", !land.denyPVP)); perms.add(new PermItem("pvp", "玩家对战", !land.denyPVP));
@@ -765,6 +768,7 @@ public class AreaCLIManager {
case "block_break": return "破坏方块"; case "block_break": return "破坏方块";
case "spawn_egg": return "生物蛋"; case "spawn_egg": return "生物蛋";
case "wax": return "涂蜡/刮蜡"; case "wax": return "涂蜡/刮蜡";
case "liquid": return "液体使用";
case "container": return "容器管理"; case "container": return "容器管理";
case "pvp": return "玩家对战"; case "pvp": return "玩家对战";
case "mount": return "骑乘坐具"; case "mount": return "骑乘坐具";
@@ -1140,7 +1144,9 @@ public class AreaCLIManager {
areaProtect.setPlayerPerm(landId, targetPlayer, denyField, newVal); areaProtect.setPlayerPerm(landId, targetPlayer, denyField, newVal);
String permName = getPermNameByKey(permKey); String permName = getPermNameByKey(permKey);
p.sendMessage("§a已设置 §e" + targetPlayer + " §a的 §e" + permName + " §7→ " + (newVal ? "§a允许" : "§c禁止")); // ★ 语义与列表渲染一致:列表 enabled = !deny值(!newVal),deny 类和 allow/和平/公共类均成立
boolean shownAllowed = !newVal;
p.sendMessage("§a已设置 §e" + targetPlayer + " §a的 §e" + permName + " §7→ " + (shownAllowed ? "§a✔已启用" : "§c✘已禁用"));
// 刷新页面 // 刷新页面
showPlayerPerm(p, landName, targetPlayer, page); showPlayerPerm(p, landName, targetPlayer, page);
+7 -5
View File
@@ -13134,7 +13134,7 @@ public class AreaProtection implements Listener {
totalRemoved += count; totalRemoved += count;
if (!confiscatedNames.isEmpty()) if (!confiscatedNames.isEmpty())
confiscatedNames += "§7、§e"; confiscatedNames += "§7、§e";
confiscatedNames += "§e" + matname(mat) confiscatedNames += "§e" + ItemNameResolver.toChinese(mat)
+ " x" + count; + " x" + count;
} }
} }
@@ -13154,14 +13154,16 @@ public class AreaProtection implements Listener {
String msg = (ac.confiscateMsg != null String msg = (ac.confiscateMsg != null
&& !ac.confiscateMsg.isEmpty()) && !ac.confiscateMsg.isEmpty())
? ac.confiscateMsg ? ac.confiscateMsg
: "你携带了违禁品,已被没收"; : (ac.returnOnLeave
? "你的物品被设为违禁品,离开领地时会自动退还"
: "你携带了违禁品,已被没收");
// ★ 替换变量 // ★ 替换变量
msg = msg.replace("{player}", p.getName()) msg = msg.replace("{player}", p.getName())
.replace("{area}", ac.name) .replace("{area}", ac.name)
.replace("{count}", String.valueOf(totalRemoved)) .replace("{count}", String.valueOf(totalRemoved))
.replace("{items}", confiscatedNames); .replace("{items}", confiscatedNames);
p.sendMessage("§c§l[区域防护] §f" + msg); p.sendMessage("§c§l[区域防护] §f" + msg);
p.sendMessage("§7没收物品: " + confiscatedNames); p.sendMessage("§7" + (ac.returnOnLeave ? "违禁物品: " : "没收物品: ") + confiscatedNames);
if (ac.enableAnnounce if (ac.enableAnnounce
&& ac.announceTemplate != null && ac.announceTemplate != null
@@ -13227,12 +13229,12 @@ public class AreaProtection implements Listener {
} }
returned += it.getAmount(); returned += it.getAmount();
if (names.length() > 0) names.append("§7、§e"); if (names.length() > 0) names.append("§7、§e");
names.append("§e").append(matname(it.getType())) names.append("§e").append(ItemNameResolver.toChinese(it.getType()))
.append(" x").append(it.getAmount()); .append(" x").append(it.getAmount());
} }
if (returned > 0) { if (returned > 0) {
p.sendMessage("§a§l[区域防护] §f你离开领地 §e" + areaName p.sendMessage("§a§l[区域防护] §f你离开领地 §e" + areaName
+ "§f,已退还没收物品: " + names); + "§f,你的物品在此领地被设为违禁品,离开时已自动退还: " + names);
} }
} }