封堵容器管理禁用时访客越权开箱
onInventoryOpen 在 denyContainer=false 时直接放行所有人, 导致完全无领地权限的外部玩家也能开箱。 现于 denyContainer 判定前拦截 getPermissionLevel 返回 null 的未授权玩家, 一律禁止访问容器;VISITOR 成员行为不变。
This commit is contained in:
@@ -4695,6 +4695,15 @@ public class AreaProtection implements Listener {
|
||||
// ★ 公共设施连控:公共设施启用时,访客自动获得容器交互权限(跳过禁止检查)
|
||||
if (ac.isPublicBuilding) return;
|
||||
|
||||
// ★ 漏洞封堵:完全无该领地权限的外部玩家(getPermissionLevel 返回 null),
|
||||
// 无论容器管理(denyContainer)开关如何,一律禁止访问领地内容器。
|
||||
// 否则 denyContainer=false 时所有玩家(含未授权)开箱无任何限制。
|
||||
if (getPermissionLevel(p, ac) == null) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage("§c§l[区域防护] §f你没有该领地的访问权限,无法使用容器");
|
||||
return;
|
||||
}
|
||||
|
||||
// ★ 容器管理权限:denyContainer=true时非领主/管理员不能访问容器
|
||||
if (getEffectiveDeny(p, ac, "denyContainer")) {
|
||||
e.setCancelled(true);
|
||||
|
||||
Reference in New Issue
Block a user