From 46897f06af58160e48498f980f414d25c788c5e5 Mon Sep 17 00:00:00 2001 From: youpaishidifu Date: Thu, 2 Jul 2026 20:01:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A2=86=E5=9C=B0=E7=A6=81?= =?UTF-8?q?=E6=AD=A2=E7=82=B9=E7=87=83=EF=BC=9A=E6=94=AF=E6=8C=81=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E6=BA=90/=E7=9B=AE=E6=A0=87=E5=8F=8C=E9=A2=86?= =?UTF-8?q?=E5=9C=B0=EF=BC=8C=E8=A6=86=E7=9B=96=E9=9D=9E=E7=8E=A9=E5=AE=B6?= =?UTF-8?q?=E6=9D=A5=E6=BA=90(TNT/=E9=97=AA=E7=94=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Sdf1_login/AreaProtection.java | 23 +++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/main/java/Sdf1_login/AreaProtection.java b/src/main/java/Sdf1_login/AreaProtection.java index 37168fe..2ddad79 100644 --- a/src/main/java/Sdf1_login/AreaProtection.java +++ b/src/main/java/Sdf1_login/AreaProtection.java @@ -9512,14 +9512,26 @@ public class AreaProtection implements Listener { @EventHandler public void onIgnite(BlockIgniteEvent e) { Player p = e.getPlayer(); - if (p == null) return; // 非玩家点燃的(闪电等) + AreaConfig srcArea = null; + AreaConfig tgtArea = null; + // 检查源领地(玩家所在位置)和目标领地(被点燃方块位置) + if (p != null) { + srcArea = getArea( + p.getWorld().getName(), + p.getLocation().getBlockX(), + p.getLocation().getBlockY(), + p.getLocation().getBlockZ()); + } Block block = e.getBlock(); - AreaConfig ac = getArea( + tgtArea = getArea( block.getWorld().getName(), block.getX(), block.getY(), block.getZ()); - if (ac != null && ac.denyFire) { + // 任何一方denyFire=true就阻止 + if ((srcArea != null && srcArea.denyFire) || (tgtArea != null && tgtArea.denyFire)) { e.setCancelled(true); - p.sendMessage("§c§l[区域防护] §f此区域禁止点燃物品"); + if (p != null) { + p.sendMessage("§c§l[区域防护] §f此区域禁止点燃物品"); + } } } @@ -9530,8 +9542,9 @@ public class AreaProtection implements Listener { AreaConfig ac = getArea( block.getWorld().getName(), block.getX(), block.getY(), block.getZ()); - if (ac != null && ac.denyFireSpread) + if (ac != null && ac.denyFireSpread) { e.setCancelled(true); + } } // ===== ★ 拴绳使用(给生物拴绳或拉拽)=====