forked from SteamWar/SteamWar
Change Region.Area to abstract class instead of interface
This commit is contained in:
@@ -74,14 +74,14 @@ public interface Region extends RegionDataStore {
|
||||
@NonNull
|
||||
RegionBackups getBackups();
|
||||
|
||||
interface Area {
|
||||
abstract class Area {
|
||||
|
||||
int WORLD_MIN_Y = Bukkit.getWorlds().get(0).getMinHeight();
|
||||
int WORLD_MAX_Y = Bukkit.getWorlds().get(0).getMaxHeight();
|
||||
public static final int WORLD_MIN_Y = Bukkit.getWorlds().get(0).getMinHeight();
|
||||
public static final int WORLD_MAX_Y = Bukkit.getWorlds().get(0).getMaxHeight();
|
||||
|
||||
Area EMPTY = new Area() {
|
||||
public static final Area EMPTY = new Area() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
protected boolean isEmptyInternal() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -129,20 +129,24 @@ public interface Region extends RegionDataStore {
|
||||
}
|
||||
};
|
||||
|
||||
default boolean isEmpty() {
|
||||
public final boolean isEmpty() {
|
||||
return isEmptyInternal();
|
||||
}
|
||||
|
||||
boolean isEmptyInternal() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
Point getMinPoint(boolean extension);
|
||||
public abstract Point getMinPoint(boolean extension);
|
||||
|
||||
@NonNull
|
||||
Point getMaxPoint(boolean extension);
|
||||
public abstract Point getMaxPoint(boolean extension);
|
||||
|
||||
@NonNull
|
||||
Point getCopyPoint();
|
||||
public abstract Point getCopyPoint();
|
||||
|
||||
default boolean inRegion(Location location, boolean extension) {
|
||||
public boolean inRegion(Location location, boolean extension) {
|
||||
Point minPoint = getMinPoint(extension);
|
||||
Point maxPoint = getMaxPoint(extension);
|
||||
if (location.getBlockX() < minPoint.getX() || location.getBlockX() > maxPoint.getX()) return false;
|
||||
@@ -151,7 +155,7 @@ public interface Region extends RegionDataStore {
|
||||
return true;
|
||||
}
|
||||
|
||||
default boolean inRegion(int x, int z, boolean extension) {
|
||||
public boolean inRegion(int x, int z, boolean extension) {
|
||||
Point minPoint = getMinPoint(extension);
|
||||
Point maxPoint = getMaxPoint(extension);
|
||||
if (x < minPoint.getX() || x > maxPoint.getX()) return false;
|
||||
@@ -160,17 +164,17 @@ public interface Region extends RegionDataStore {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
default Clipboard copy(boolean extension) {
|
||||
public Clipboard copy(boolean extension) {
|
||||
return FlatteningWrapper.impl.copy(getMinPoint(extension), getMaxPoint(extension), getCopyPoint());
|
||||
}
|
||||
|
||||
default void reset(PasteBuilder pasteBuilder, boolean extension) {
|
||||
public void reset(PasteBuilder pasteBuilder, boolean extension) {
|
||||
place(pasteBuilder, extension);
|
||||
}
|
||||
|
||||
void place(PasteBuilder pasteBuilder, boolean extension);
|
||||
public abstract void place(PasteBuilder pasteBuilder, boolean extension);
|
||||
|
||||
default void forEachChunk(BiConsumer<Integer, Integer> executor) {
|
||||
public void forEachChunk(BiConsumer<Integer, Integer> executor) {
|
||||
Point minPoint = getMinPoint(false);
|
||||
Point maxPoint = getMaxPoint(false);
|
||||
for (int x = (int) Math.floor(minPoint.getX() / 16.0); x <= (int) Math.ceil(maxPoint.getX() / 16.0); x++) {
|
||||
@@ -180,7 +184,7 @@ public interface Region extends RegionDataStore {
|
||||
}
|
||||
}
|
||||
|
||||
default boolean isChunkOutside(int chunkX, int chunkZ) {
|
||||
public boolean isChunkOutside(int chunkX, int chunkZ) {
|
||||
Point minPoint = getMinPoint(true);
|
||||
Point maxPoint = getMaxPoint(true);
|
||||
return Math.floor(minPoint.getX() / 16.0) > chunkX || chunkX >= Math.ceil(maxPoint.getX() / 16.0) ||
|
||||
|
||||
Reference in New Issue
Block a user