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