13
0

Fix nodepth portal
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2022-03-12 11:01:25 +01:00
Ursprung c2f722cd55
Commit 2922d9a61f
2 geänderte Dateien mit 10 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -145,6 +145,10 @@ public class Portal implements PortalHandler, ConfigurationSerializable {
return yRotation;
}
public double getDepth() {
return depth;
}
private static Iterable<ChunkCoords> perChunk(int minChunkX, int maxChunkX, int minChunkZ, int maxChunkZ) {
return () -> new Iterator<ChunkCoords>() {
private int x = minChunkX;

Datei anzeigen

@ -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,11 @@ public class TeleportPortal implements PortalHandler {
if(ModifyCommand.modifying(player))
player.sendMessage("teleport " + portal.getId() + " -> " + target.getId());
player.teleport(target.denormalize(portal.normalize(to).setX(1 - portal.normalize(from).getX())).toLocation(to.getWorld(), (float) (to.getYaw() - Math.toDegrees(target.getYrotation() - portal.getYrotation())), to.getPitch()), PlayerTeleportEvent.TeleportCause.PLUGIN);
Vector normalized = portal.normalize(to);
if (target.getDepth() != 0.0) {
normalized.setX(1 - portal.normalize(from).getX());
}
player.teleport(target.denormalize(normalized).toLocation(to.getWorld(), (float) (to.getYaw() - Math.toDegrees(target.getYrotation() - portal.getYrotation())), to.getPitch()), PlayerTeleportEvent.TeleportCause.PLUGIN);
}
@Override