Archived
0

Location implements cloneable

This commit is contained in:
Forwolk
2018-07-11 18:38:37 +03:00
parent 444f532f11
commit aae2035207

View File

@@ -9,15 +9,17 @@ import lombok.Data;
@AllArgsConstructor
@Data
public class Location {
public class Location implements Cloneable {
private double x, y, z;
public static Location copyOf(Location location) {
return new Location(
location.x,
location.y,
location.z
);
return location.clone();
}
public Location (Location location) {
this.x = location.getX();
this.y = location.getY();
this.z = location.getZ();
}
public void set(Location location) {
@@ -45,4 +47,13 @@ public class Location {
public int getBlockZ() {
return (int) z;
}
@Override
protected Location clone() {
try {
return (Location) super.clone();
} catch (CloneNotSupportedException e) {
return null;
}
}
}