From 8018d68e429528602e9a45752f97bbce8a1c52f5 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Sun, 4 Feb 2024 04:58:19 +0000 Subject: [PATCH] fix: check the player is in the same world --- .../core/portal/AdvancedPortal.java | 3 +- .../repository/IPlayerDataRepository.java | 15 ------- .../impl/PlayerDataRepositoryImpl.java | 40 ------------------- 3 files changed, 2 insertions(+), 56 deletions(-) diff --git a/core/src/main/java/com/sekwah/advancedportals/core/portal/AdvancedPortal.java b/core/src/main/java/com/sekwah/advancedportals/core/portal/AdvancedPortal.java index de3c1f76..536852cc 100644 --- a/core/src/main/java/com/sekwah/advancedportals/core/portal/AdvancedPortal.java +++ b/core/src/main/java/com/sekwah/advancedportals/core/portal/AdvancedPortal.java @@ -16,6 +16,7 @@ import com.sekwah.advancedportals.core.warphandler.Tag; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +import java.util.Objects; /** * @author sekwah41 @@ -153,7 +154,7 @@ public class AdvancedPortal implements TagTarget { double playerY = loc.posY; double playerZ = loc.posZ; - return playerX >= this.minLoc.posX - additionalArea && + return Objects.equals(loc.worldName, this.minLoc.worldName) && playerX >= this.minLoc.posX - additionalArea && playerX < this.maxLoc.posX + 1 + additionalArea && playerY >= this.minLoc.posY - additionalArea && playerY < this.maxLoc.posY + 1 + additionalArea && diff --git a/core/src/main/java/com/sekwah/advancedportals/core/repository/IPlayerDataRepository.java b/core/src/main/java/com/sekwah/advancedportals/core/repository/IPlayerDataRepository.java index 15727b78..975170d5 100644 --- a/core/src/main/java/com/sekwah/advancedportals/core/repository/IPlayerDataRepository.java +++ b/core/src/main/java/com/sekwah/advancedportals/core/repository/IPlayerDataRepository.java @@ -8,19 +8,4 @@ import com.sekwah.advancedportals.core.serializeddata.PlayerData; import java.util.UUID; public interface IPlayerDataRepository extends IJsonRepository { - void addSelectedPortal(UUID selectedPlayer, String portal); - - void removeSelectedPortal(UUID uuid); - - void addSelectedPosition(UUID uuid, boolean isPos1, BlockLocation portalLocation); - - void removeSelectedPosition(UUID uuid, boolean isPos1); - - void removeAllSelectedHand(UUID uuid); - - void activateCooldown(PlayerContainer player); - - void playerLeave(PlayerContainer player); - - boolean inPortalRegion(PlayerLocation loc); } diff --git a/core/src/main/java/com/sekwah/advancedportals/core/repository/impl/PlayerDataRepositoryImpl.java b/core/src/main/java/com/sekwah/advancedportals/core/repository/impl/PlayerDataRepositoryImpl.java index 1e77bc49..cbb118e7 100644 --- a/core/src/main/java/com/sekwah/advancedportals/core/repository/impl/PlayerDataRepositoryImpl.java +++ b/core/src/main/java/com/sekwah/advancedportals/core/repository/impl/PlayerDataRepositoryImpl.java @@ -49,44 +49,4 @@ public class PlayerDataRepositoryImpl implements IPlayerDataRepository { public List getAll() { return null; } - - @Override - public void addSelectedPortal(UUID selectedPlayer, String portal) { - - } - - @Override - public void removeSelectedPortal(UUID uuid) { - - } - - @Override - public void addSelectedPosition(UUID uuid, boolean isPos1, BlockLocation portalLocation) { - - } - - @Override - public void removeSelectedPosition(UUID uuid, boolean isPos1) { - - } - - @Override - public void removeAllSelectedHand(UUID uuid) { - - } - - @Override - public void activateCooldown(PlayerContainer player) { - - } - - @Override - public void playerLeave(PlayerContainer player) { - - } - - @Override - public boolean inPortalRegion(PlayerLocation loc) { - return false; - } }