From 9121bb069d012476528204d99bec01c89af6ed13 Mon Sep 17 00:00:00 2001 From: youpaishidifu Date: Fri, 10 Jul 2026 23:16:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DPHP=E6=9D=83=E9=99=90?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=B8=B8=E6=88=8F=EF=BC=9A1.updateLandFieldF?= =?UTF-8?q?romWeb=E7=99=BD=E5=90=8D=E5=8D=95=E8=A1=A5=E5=85=85is=5Fpublic?= =?UTF-8?q?=5Fbuilding/allow=5Fvisitor=5Fteleport=EF=BC=9B2.updateVisitorP?= =?UTF-8?q?ermFromWeb=E6=94=AF=E6=8C=81PHP=E6=98=BE=E5=BC=8F=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E5=88=87=E6=8D=A2=EF=BC=88admin=E2=86=94member?= =?UTF-8?q?=E2=86=94visitor=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Sdf1_login/AreaProtection.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/Sdf1_login/AreaProtection.java b/src/main/java/Sdf1_login/AreaProtection.java index ded7de3..2bb383f 100644 --- a/src/main/java/Sdf1_login/AreaProtection.java +++ b/src/main/java/Sdf1_login/AreaProtection.java @@ -8237,7 +8237,8 @@ public class AreaProtection implements Listener { "deny_thrown_projectiles", "deny_glowing", "deny_redstone_interaction", "deny_door_interaction", "deny_noteblock_jukebox", "deny_lead", "deny_crop_harvest", "deny_wool_shear", "deny_animal_feeding", - "deny_container", "deny_mob_attack", "deny_fluid" + "deny_container", "deny_mob_attack", "deny_fluid", + "is_public_building", "allow_visitor_teleport" )); if (!allowedFields.contains(field)) { plugin.getLogger().warning("[防护] PHP端更新未知字段: " + field); @@ -8299,17 +8300,18 @@ public class AreaProtection implements Listener { isAdmin = "admin".equalsIgnoreCase(effectiveRole); } - if (isAdmin) { - // ★ 管理员:永远保留 admin 角色,只更新 permissions JSON - effectiveRole = "admin"; - } else if (role != null && !role.isEmpty()) { - // 非管理员:显式角色切换(来自 change_visitor_role) + if (role != null && !role.isEmpty()) { + // ★ PHP显式携带role(来自changeVisitorRole):允许任何角色切换 effectiveRole = role.toLowerCase(); if ("admin".equalsIgnoreCase(role)) { setLandAdmin(lname, playerName, true); - effectiveRole = "admin"; + } else if ("member".equals(effectiveRole) || "visitor".equals(effectiveRole)) { + // 降级:取消管理员标记 + setLandAdmin(lname, playerName, false); } - // ★ 移除旧逻辑:不再允许通过 perm_change 将 admin 降为 visitor/member + } else if (isAdmin) { + // 无显式role + 本地是admin:保留admin角色,只更新permissions + effectiveRole = "admin"; } // role 为空或 visitor + 非 admin:effectiveRole 保持 localRole 或默认 visitor