Commits

Jonas Konrad authored and md_5 committed 9f071ab402a
Only allow finite x,y,z and yaw,pitch values for Vector and Location

Many API methods rely on these to be finite (especially not NaN).
No tags

src/main/java/org/bukkit/util/BlockVector.java

Modified
9 9 * hash maps. Be aware that BlockVectors are mutable, but it is important
10 10 * that BlockVectors are never changed once put into a hash set or hash map.
11 11 */
12 12 @SerializableAs("BlockVector")
13 13 public class BlockVector extends Vector {
14 14
15 15 /**
16 16 * Construct the vector with all components as 0.
17 17 */
18 18 public BlockVector() {
19 - this.x = 0;
20 - this.y = 0;
21 - this.z = 0;
19 + super();
22 20 }
23 21
24 22 /**
25 23 * Construct the vector with another vector.
26 24 *
27 25 * @param vec The other vector.
28 26 */
29 27 public BlockVector(Vector vec) {
30 - this.x = vec.getX();
31 - this.y = vec.getY();
32 - this.z = vec.getZ();
28 + this(vec.getX(), vec.getY(), vec.getZ());
33 29 }
34 30
35 31 /**
36 32 * Construct the vector with provided integer components.
37 33 *
38 34 * @param x X component
39 35 * @param y Y component
40 36 * @param z Z component
41 37 */
42 38 public BlockVector(int x, int y, int z) {
43 - this.x = x;
44 - this.y = y;
45 - this.z = z;
39 + super(x, y, z);
46 40 }
47 41
48 42 /**
49 43 * Construct the vector with provided double components.
50 44 *
51 45 * @param x X component
52 46 * @param y Y component
53 47 * @param z Z component
54 48 */
55 49 public BlockVector(double x, double y, double z) {
56 - this.x = x;
57 - this.y = y;
58 - this.z = z;
50 + super(x, y, z);
59 51 }
60 52
61 53 /**
62 54 * Construct the vector with provided float components.
63 55 *
64 56 * @param x X component
65 57 * @param y Y component
66 58 * @param z Z component
67 59 */
68 60 public BlockVector(float x, float y, float z) {
69 - this.x = x;
70 - this.y = y;
71 - this.z = z;
61 + super(x, y, z);
72 62 }
73 63
74 64 /**
75 65 * Checks if another object is equivalent.
76 66 *
77 67 * @param obj The other object
78 68 * @return whether the other object is equivalent
79 69 */
80 70 @Override
81 71 public boolean equals(Object obj) {

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut