From 9213918995e08103ca16694d55ebbaa0cb5c5f16 Mon Sep 17 00:00:00 2001 From: youpaishidifu Date: Wed, 22 Jul 2026 11:02:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9C=AB=E5=BD=B1=E4=BA=BA=E8=A1=8C?= =?UTF-8?q?=E4=B8=BA=E7=A6=81=E7=94=A8=E6=97=B6=E5=85=A8=E9=9D=A2=E6=8B=A6?= =?UTF-8?q?=E6=88=AA=20-=20=E6=8B=BE=E5=8F=96=E6=96=B9=E5=9D=97=E3=80=81AI?= =?UTF-8?q?=E5=AF=BB=E8=B7=AF=E3=80=81=E4=BC=A0=E9=80=81=E3=80=81=E8=87=AA?= =?UTF-8?q?=E7=84=B6=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Sdf1_login/AreaProtection.java | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/Sdf1_login/AreaProtection.java b/src/main/java/Sdf1_login/AreaProtection.java index 7cb46f4..e4e4bba 100644 --- a/src/main/java/Sdf1_login/AreaProtection.java +++ b/src/main/java/Sdf1_login/AreaProtection.java @@ -46,6 +46,7 @@ import java.util.HashSet; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; import org.bukkit.event.entity.EntitySpawnEvent; +import com.destroystokyo.paper.event.entity.EntityPathfindEvent; import org.bukkit.entity.Item; import org.bukkit.event.inventory.InventoryOpenEvent; @@ -5351,11 +5352,11 @@ public class AreaProtection implements Listener { e.getBlock().getX(), e.getBlock().getY(), e.getBlock().getZ()); if (ac != null && ac.denyFire) e.setCancelled(true); } - // ★ 禁止末影人抱走耕地 - if (e.getEntityType().name().equals("ENDERMAN") && e.getBlock().getType() == Material.FARMLAND) { + // ★ 末影人行为控制:禁止末影人抱走方块 + if (e.getEntityType().name().equals("ENDERMAN")) { AreaConfig ac = getArea(e.getBlock().getWorld().getName(), e.getBlock().getX(), e.getBlock().getY(), e.getBlock().getZ()); - if (ac != null && ac.denyFarmlandTrample) { + if (ac != null && ac.denyEnderTeleport) { e.setCancelled(true); } } @@ -5742,6 +5743,19 @@ public class AreaProtection implements Listener { // 如果起点在禁止传送的领地内,终点在允许传送的领地内,已在上面处理 } + // ★ 末影人行为控制(禁止末影人AI寻路进入领地) + @EventHandler + public void onEndermanPathfind(EntityPathfindEvent e) { + if (!e.getEntity().getType().name().equals("ENDERMAN")) return; + Location loc = e.getLoc(); + if (loc == null) return; + AreaConfig ac = getArea(loc.getWorld().getName(), + loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + if (ac != null && ac.denyEnderTeleport) { + e.setCancelled(true); + } + } + // ★ 末影人生成控制(自然生成时禁止进入领地) @EventHandler public void onEndermanSpawn(CreatureSpawnEvent e) {