/* * This file is a part of the SteamWar software. * * Copyright (C) 2024 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 . */ package de.steamwar.bausystem.region; import com.sk89q.worldedit.EditSession; import de.steamwar.bausystem.utils.PasteBuilder; import lombok.NonNull; import org.bukkit.Location; import javax.annotation.Nullable; import java.io.File; import java.util.UUID; import java.util.function.BiConsumer; public final class FixedGlobalRegion implements Region { public static final FixedGlobalRegion INSTANCE = new FixedGlobalRegion(); 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 FlagStorage FLAG_STORAGE = new FixedGlobalFlagStorage(); private static final UUID GLOBAL_REGION_ID = new UUID(0, 0); private static final Area GLOBAL_AREA = new 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 EditSession 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 executor) { } @Override public boolean isChunkOutside(int chunkX, int chunkZ) { return false; } }; private static final RegionConfig GLOBAL_CONFIG = new RegionConfig(null); private FixedGlobalRegion() { } @Override public RegionType getType() { return RegionType.GLOBAL; } @Override public @NonNull UUID getID() { return GLOBAL_REGION_ID; } @Override public @NonNull FlagStorage getFlags() { return FLAG_STORAGE; } @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 RegionConfig getGameModeConfig() { return GLOBAL_CONFIG; } @Override public @NonNull RegionHistory getHistory() { return RegionHistory.EMPTY; } @Override public @NonNull RegionBackups getBackups() { return RegionBackups.EMPTY; } }