From 1482bb5902c21354dd4db29bbebe0bfe122790f9 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Sat, 31 Oct 2020 19:50:32 +0100 Subject: [PATCH] Fix portal checks ignoring worlds; resolves #919 --- core/src/main/java/de/erethon/dungeonsxl/global/DPortal.java | 5 ++++- .../erethon/dungeonsxl/global/GlobalProtectionListener.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/de/erethon/dungeonsxl/global/DPortal.java b/core/src/main/java/de/erethon/dungeonsxl/global/DPortal.java index 84df4f5b..c8134466 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/global/DPortal.java +++ b/core/src/main/java/de/erethon/dungeonsxl/global/DPortal.java @@ -403,9 +403,12 @@ public class DPortal extends GlobalProtection { * @return the portal that the block belongs to, null if it belongs to none */ public static DPortal getByBlock(DungeonsXL plugin, Block block) { + if (plugin.isInstance(block.getWorld())) { + return null; + } for (GlobalProtection protection : plugin.getGlobalProtectionCache().getProtections(DPortal.class)) { DPortal portal = (DPortal) protection; - if (portal.getBlock1() == null || portal.getBlock2() == null) { + if (!portal.getWorld().equals(block.getWorld()) || portal.getBlock1() == null || portal.getBlock2() == null) { continue; } diff --git a/core/src/main/java/de/erethon/dungeonsxl/global/GlobalProtectionListener.java b/core/src/main/java/de/erethon/dungeonsxl/global/GlobalProtectionListener.java index afa9eb41..2ee9532b 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/global/GlobalProtectionListener.java +++ b/core/src/main/java/de/erethon/dungeonsxl/global/GlobalProtectionListener.java @@ -145,7 +145,7 @@ public class GlobalProtectionListener implements Listener { @EventHandler public void onPlayerMove(PlayerMoveEvent event) { Player player = event.getPlayer(); - if (DPlayerListener.isCitizensNPC(player)) { + if (DPlayerListener.isCitizensNPC(player) || plugin.isInstance(event.getTo().getWorld())) { return; }