From 65f6789c95dd32f8473a18be40282b8b930abae0 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 22 Mar 2022 22:38:39 +0100 Subject: [PATCH] Sound on portal --- src/de/steamwar/lobby/portal/TeleportPortal.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/lobby/portal/TeleportPortal.java b/src/de/steamwar/lobby/portal/TeleportPortal.java index eab3251..0b11a16 100644 --- a/src/de/steamwar/lobby/portal/TeleportPortal.java +++ b/src/de/steamwar/lobby/portal/TeleportPortal.java @@ -81,8 +81,9 @@ public class TeleportPortal implements PortalHandler { if (target.getDepth() != 0.0) { normalized.setX(1 - portal.normalize(from).getX()); } - player.playSound(player.getLocation(), Sound.BLOCK_ENCHANTMENT_TABLE_USE, 0.25f, 1.0f); - player.teleport(target.denormalize(normalized).toLocation(to.getWorld(), (float) (to.getYaw() - Math.toDegrees(target.getYrotation() - portal.getYrotation())), to.getPitch()), PlayerTeleportEvent.TeleportCause.PLUGIN); + Location portalTo = target.denormalize(normalized).toLocation(to.getWorld(), (float) (to.getYaw() - Math.toDegrees(target.getYrotation() - portal.getYrotation())), to.getPitch()); + player.teleport(portalTo, PlayerTeleportEvent.TeleportCause.PLUGIN); + player.playSound(portalTo, Sound.BLOCK_ENCHANTMENT_TABLE_USE, 0.25f, 1.0f); } @Override