This commit is contained in:
tyuXX 2026-07-06 22:46:13 +03:00
parent 66f612268e
commit e8cd47a8d7
178 changed files with 5432 additions and 5187 deletions

View file

@ -1,41 +1,45 @@
package org.gsdistance.grimmsServer.Constructable;
import java.util.Objects;
import org.bukkit.Bukkit;
import org.bukkit.World;
public class Location {
public final double x;
public final double y;
public final double z;
public final String world;
public final double x;
public final double y;
public final double z;
public final String world;
public Location(org.bukkit.Location location) {
this.x = location.getX();
this.y = location.getY();
this.z = location.getZ();
this.world = Objects.requireNonNull(location.getWorld()).getName();
}
public Location(org.bukkit.Location location) {
this.x = location.getX();
this.y = location.getY();
this.z = location.getZ();
this.world = ((World)Objects.requireNonNull(location.getWorld())).getName();
}
public Location(String world, double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
this.world = world;
}
public Location(String world, double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
this.world = world;
}
public org.bukkit.Location toBukkitLocation() {
return new org.bukkit.Location(org.bukkit.Bukkit.getWorld(world), x, y, z);
}
public org.bukkit.Location toBukkitLocation() {
return new org.bukkit.Location(Bukkit.getWorld(this.world), this.x, this.y, this.z);
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
Location location = (Location) obj;
return x == location.x && y == location.y && z == location.z && Objects.equals(world, location.world);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
} else if (obj != null && this.getClass() == obj.getClass()) {
Location location = (Location)obj;
return this.x == location.x && this.y == location.y && this.z == location.z && Objects.equals(this.world, location.world);
} else {
return false;
}
}
@Override
public int hashCode() {
return Objects.hash(world, x, y, z);
}
public int hashCode() {
return Objects.hash(new Object[]{this.world, this.x, this.y, this.z});
}
}