From ecf855a25658edee06e7a10fe27fbc68a20b03b6 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 11 Mar 2022 21:11:32 +0100 Subject: [PATCH] Fix teleport depth --- src/de/steamwar/lobby/portal/TeleportPortal.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/lobby/portal/TeleportPortal.java b/src/de/steamwar/lobby/portal/TeleportPortal.java index 9a945f8..be926ba 100644 --- a/src/de/steamwar/lobby/portal/TeleportPortal.java +++ b/src/de/steamwar/lobby/portal/TeleportPortal.java @@ -25,6 +25,7 @@ import de.steamwar.lobby.listener.Portals; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.util.Vector; import java.util.*; import java.util.logging.Level; @@ -75,7 +76,8 @@ public class TeleportPortal implements PortalHandler { if(ModifyCommand.modifying(player)) player.sendMessage("teleport " + portal.getId() + " -> " + target.getId()); - player.teleport(target.denormalize(portal.normalize(to)).toLocation(to.getWorld(), (float) (to.getYaw() - Math.toDegrees(target.getYrotation() - portal.getYrotation())), to.getPitch()), PlayerTeleportEvent.TeleportCause.PLUGIN); + Vector normalized = portal.normalize(to); + player.teleport(target.denormalize(normalized.setX(1 - normalized.getX())).toLocation(to.getWorld(), (float) (to.getYaw() - Math.toDegrees(target.getYrotation() - portal.getYrotation())), to.getPitch()), PlayerTeleportEvent.TeleportCause.PLUGIN); } @Override