package de.teleportsuite.models;

import org.bukkit.Bukkit;
import org.bukkit.Location;

public class TeleportLocation {
    private String world;
    private double x, y, z;
    private float yaw, pitch;
    private String server;

    public TeleportLocation(String world, double x, double y, double z, float yaw, float pitch, String server) {
        this.world = world; this.x = x; this.y = y; this.z = z;
        this.yaw = yaw; this.pitch = pitch; this.server = server;
    }

    public TeleportLocation(Location loc, String server) {
        this.world = loc.getWorld().getName();
        this.x = loc.getX(); this.y = loc.getY(); this.z = loc.getZ();
        this.yaw = loc.getYaw(); this.pitch = loc.getPitch();
        this.server = server;
    }

    public Location toBukkitLocation() {
        return new Location(Bukkit.getWorld(world), x, y, z, yaw, pitch);
    }

    public String getWorld() { return world; }
    public double getX() { return x; }
    public double getY() { return y; }
    public double getZ() { return z; }
    public float getYaw() { return yaw; }
    public float getPitch() { return pitch; }
    public String getServer() { return server; }
    public boolean isLocalServer(String localServer) {
        return server == null || server.equals("local") || server.equals(localServer);
    }
}
