-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathRegion.java
More file actions
38 lines (27 loc) · 963 Bytes
/
Region.java
File metadata and controls
38 lines (27 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.eternalcode.combat.region;
import org.bukkit.Location;
import org.bukkit.World;
public interface Region {
Point getCenter();
Location getMin();
Location getMax();
default boolean contains(Location location) {
if (location == null) {
return false;
}
Location min = this.getMin();
World regionWorld = min.getWorld();
World locationWorld = location.getWorld();
if (regionWorld == null || locationWorld == null || !regionWorld.equals(locationWorld)) {
return false;
}
return this.contains(location.getX(), location.getY(), location.getZ());
}
default boolean contains(double x, double y, double z) {
Location min = this.getMin();
Location max = this.getMax();
return x >= min.getX() && x < max.getX()
&& y >= min.getY() && y < max.getY()
&& z >= min.getZ() && z < max.getZ();
}
}