From c6303199920975fc6cddddc4cce4d49ed0b88b6e Mon Sep 17 00:00:00 2001 From: EXtremeExploit Date: Mon, 8 Apr 2024 10:52:09 -0300 Subject: [PATCH] Make entities appear at world spawn when they go trough exit end portal --- .../listeners/MVNPEntityListener.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/onarandombox/MultiverseNetherPortals/listeners/MVNPEntityListener.java b/src/main/java/com/onarandombox/MultiverseNetherPortals/listeners/MVNPEntityListener.java index 9ac0d9f..8217932 100644 --- a/src/main/java/com/onarandombox/MultiverseNetherPortals/listeners/MVNPEntityListener.java +++ b/src/main/java/com/onarandombox/MultiverseNetherPortals/listeners/MVNPEntityListener.java @@ -146,9 +146,12 @@ private Location getLocation(Entity e, Location currentLocation, PortalType type } else { String destinationWorld = ""; + boolean shouldAppearAtSpawn = false; + if (this.nameChecker.isValidEndName(currentWorld)) { if (type == PortalType.ENDER) { destinationWorld = this.nameChecker.getNormalName(currentWorld, type); + shouldAppearAtSpawn = true; } else if (type == PortalType.NETHER) { destinationWorld = this.nameChecker.getNetherName(this.nameChecker.getNormalName(currentWorld, type)); } @@ -166,7 +169,12 @@ private Location getLocation(Entity e, Location currentLocation, PortalType type } } - newTo = this.linkChecker.findNewTeleportLocation(currentLocation, destinationWorld, e); + if (shouldAppearAtSpawn) { + MultiverseWorld tpTo = this.worldManager.getMVWorld(destinationWorld); + newTo = this.linkChecker.findNewTeleportLocation(tpTo.getSpawnLocation(), destinationWorld, e); + } else { + newTo = this.linkChecker.findNewTeleportLocation(currentLocation, destinationWorld, e); + } } }