Fix portal checks ignoring worlds; resolves #919

This commit is contained in:
Daniel Saukel 2020-10-31 19:50:32 +01:00
parent b28423fa58
commit 1482bb5902
2 changed files with 5 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;
}