forked from SteamWar/SteamWar
Add GlobalRegion
This commit is contained in:
+2
-2
@@ -20,6 +20,7 @@
|
|||||||
package de.steamwar.bausystem.region;
|
package de.steamwar.bausystem.region;
|
||||||
|
|
||||||
import de.steamwar.bausystem.region.dynamic.Tile;
|
import de.steamwar.bausystem.region.dynamic.Tile;
|
||||||
|
import de.steamwar.bausystem.region.dynamic.global.GlobalRegion;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -49,7 +50,6 @@ public class DynamicRegionSystem implements RegionSystem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save() {
|
public void save() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -59,7 +59,7 @@ public class DynamicRegionSystem implements RegionSystem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull Region getGlobalRegion() {
|
public @NonNull Region getGlobalRegion() {
|
||||||
return null;
|
return GlobalRegion.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Region get(int x, int z, boolean fastCache, Collection<Region> regions) {
|
private Region get(int x, int z, boolean fastCache, Collection<Region> regions) {
|
||||||
|
|||||||
+133
@@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2025 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.region.dynamic.global;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
|
import de.steamwar.bausystem.region.*;
|
||||||
|
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||||
|
import de.steamwar.sql.GameModeConfig;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
|
public class GlobalRegion implements Region {
|
||||||
|
|
||||||
|
public static final GlobalRegion INSTANCE = new GlobalRegion();
|
||||||
|
|
||||||
|
private static final Point MIN_POINT = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||||
|
private static final Point MAX_POINT = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||||
|
|
||||||
|
private static final Region.Area GLOBAL_AREA = new Region.Area() {
|
||||||
|
@Override
|
||||||
|
public @NonNull Point getMinPoint(boolean extension) {
|
||||||
|
return MIN_POINT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull Point getMaxPoint(boolean extension) {
|
||||||
|
return MAX_POINT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull Point getCopyPoint() {
|
||||||
|
return Point.ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean inRegion(Location location, boolean extension) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Clipboard copy(boolean extension) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public File getResetFile() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset(PasteBuilder pasteBuilder, boolean extension) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forEachChunk(BiConsumer<Integer, Integer> executor) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isChunkOutside(int chunkX, int chunkZ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull UUID getID() {
|
||||||
|
return RegionSystem.GLOBAL_REGION_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull RegionType getType() {
|
||||||
|
return RegionType.GLOBAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull RegionData getRegionData() {
|
||||||
|
return null; // TODO: Implement!
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull Area getArea() {
|
||||||
|
return GLOBAL_AREA;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull Area getBuildArea() {
|
||||||
|
return Area.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull Area getTestblockArea() {
|
||||||
|
return Area.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull GameModeConfig<Material, String> getGameModeConfig() {
|
||||||
|
return GameModeConfig.getDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull RegionHistory getHistory() {
|
||||||
|
return RegionHistory.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull RegionBackups getBackups() {
|
||||||
|
return RegionBackups.EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user