Update some part of Region

This commit is contained in:
2024-10-04 19:55:58 +02:00
parent 45646b6ba3
commit 96daa2c861
46 changed files with 1445 additions and 79 deletions
@@ -42,7 +42,7 @@ import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Point;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -21,17 +21,12 @@ package de.steamwar.bausystem.features.backup;
import com.sk89q.worldedit.EditSession;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.region.Color;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
import de.steamwar.bausystem.region.tags.Tag;
import de.steamwar.bausystem.utils.PasteBuilder;
import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper;
import de.steamwar.command.TypeValidator;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import de.steamwar.linkage.Linked;
@@ -20,7 +20,7 @@
package de.steamwar.bausystem.features.countingwand;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Point;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.utils.ItemUtils;
import de.steamwar.inventory.SWItem;
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.features.countingwand;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Point;
import de.steamwar.linkage.Linked;
import org.bukkit.FluidCollisionMode;
import org.bukkit.event.EventHandler;
@@ -20,7 +20,7 @@
package de.steamwar.bausystem.features.killchecker;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Point;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
@@ -20,7 +20,7 @@
package de.steamwar.bausystem.features.observer;
import de.steamwar.Reflection;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Point;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
@@ -28,7 +28,7 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.session.ClipboardHolder;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.util.SelectCommand;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Point;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.flags.Flag;
@@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.region.items;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.bausystem.region.Color;
import de.steamwar.bausystem.regionnew.Color;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.features.script.lua.libs;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Point;
import lombok.AllArgsConstructor;
import org.bukkit.entity.Player;
import org.luaj.vm2.*;
@@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.script.lua.libs;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
import com.sk89q.worldedit.math.BlockVector3;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Point;
import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player;
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.features.slaves.laufbau;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Point;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -27,7 +27,7 @@ import com.sk89q.worldedit.world.block.BlockTypes;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Point;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
@@ -26,7 +26,7 @@ import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
import de.steamwar.bausystem.features.tracer.TNTPoint;
import de.steamwar.bausystem.features.tracer.Trace;
import de.steamwar.bausystem.features.tracer.TraceManager;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Point;
import de.steamwar.bausystem.utils.FlatteningWrapper;
import org.bukkit.Location;
import org.bukkit.World;
@@ -20,7 +20,7 @@
package de.steamwar.bausystem.features.team.boundary;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Point;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.core.TrickyParticleWrapper;
@@ -1,14 +1,12 @@
package de.steamwar.bausystem.features.util;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Point;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeValidator;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player;
@@ -28,7 +28,7 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import de.steamwar.bausystem.features.world.WorldEditListener;
import de.steamwar.bausystem.features.worldedit.utils.SpecialReplace;
import de.steamwar.bausystem.region.Color;
import de.steamwar.bausystem.regionnew.Color;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.utils.WorldEditUtils;
import de.steamwar.command.PreviousArguments;
@@ -1,39 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 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;
public enum Color {
WHITE,
ORANGE,
MAGENTA,
LIGHT_BLUE,
YELLOW,
LIME,
PINK,
GRAY,
LIGHT_GRAY,
CYAN,
PURPLE,
BLUE,
BROWN,
GREEN,
RED,
BLACK;
}
@@ -28,6 +28,7 @@ import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
import de.steamwar.bausystem.region.tags.Tag;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.regionnew.Point;
import de.steamwar.bausystem.shared.SizedStack;
import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.bausystem.utils.PasteBuilder;
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.region.flags.flagvalues;
import de.steamwar.bausystem.region.Color;
import de.steamwar.bausystem.regionnew.Color;
import de.steamwar.bausystem.region.flags.Flag;
import lombok.AllArgsConstructor;
import lombok.Getter;
@@ -0,0 +1,39 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew;
public enum Color {
WHITE,
ORANGE,
MAGENTA,
LIGHT_BLUE,
YELLOW,
LIME,
PINK,
GRAY,
LIGHT_GRAY,
CYAN,
PURPLE,
BLUE,
BROWN,
GREEN,
RED,
BLACK;
}
@@ -0,0 +1,29 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew;
import de.steamwar.bausystem.regionnew.flags.Flag;
public interface FlagStorage {
<T extends Enum<T> & Flag.Value<T>> boolean set(Flag<T> flag, Flag.Value<T> value);
<T extends Enum<T> & Flag.Value<T>> Flag.Value<T> get(Flag<T> flag);
}
@@ -1,23 +1,23 @@
/*
* This file is a part of the SteamWar software.
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
* 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 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.
* 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/>.
* 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;
package de.steamwar.bausystem.regionnew;
import com.sk89q.worldedit.math.BlockVector3;
import lombok.AllArgsConstructor;
@@ -0,0 +1,81 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew;
import com.sk89q.worldedit.EditSession;
import de.steamwar.bausystem.regionnew.flags.Flag;
import de.steamwar.sql.SchematicNode;
import lombok.NonNull;
import org.bukkit.Location;
import javax.annotation.Nullable;
import java.io.File;
import java.util.Optional;
public interface Region {
RegionType getType();
<T extends Enum<T> & Flag.Value<T>> RegionFlagPolicy hasFlag(@NonNull Flag<T> flag);
<T extends Enum<T> & Flag.Value<T>> boolean setFlag(@NonNull Flag<T> flag, Flag.Value<T> value);
<T extends Enum<T> & Flag.Value<T>> Optional<Flag.Value<T>> getFlag(@NonNull Flag<T> flag);
Point getMinPoint();
Point getMaxPoint();
boolean inRegion(Location location);
Optional<Point> getBuildMinPoint(boolean extension);
Optional<Point> getBuildMaxPoint(boolean extension);
boolean inBuildRegion(boolean extension);
Optional<Point> getTestblockMinPoint(boolean extension);
Optional<Point> getTestblockMaxPoint(boolean extension);
boolean inTestblockRegion(boolean extension);
// TODO: Add forEachChunk and getChunkOutsidePredicate
Optional<File> getGameModeConfig();
Optional<EditSession> copy();
Optional<EditSession> copyBuild();
Optional<EditSession> copyTestblock();
void reset();
void resetBuild(@Nullable SchematicNode schematicNode, boolean extension);
void resetTestblock(@Nullable SchematicNode schematicNode, boolean extension);
void remember(EditSession editSession);
boolean undo();
boolean redo();
}
@@ -0,0 +1,34 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@Getter
public enum RegionFlagPolicy {
NOT_APPLICABLE(false, false),
READ_ONLY(true, false),
WRITABLE(true, true);
private final boolean readable;
private final boolean writable;
}
@@ -0,0 +1,25 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew;
public enum RegionSide {
NORTH,
SOUTH
}
@@ -0,0 +1,40 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew;
import org.bukkit.Location;
import java.util.Optional;
import java.util.stream.Stream;
public interface RegionSystem {
void load();
void save();
Region getGlobalRegion();
Region get(Location location);
Optional<Region> getRegion(String name);
Stream<Region> getRegions();
boolean isModular();
}
@@ -0,0 +1,32 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public enum RegionType {
GLOBAL(true),
NORMAL(false),
;
private final boolean global;
}
@@ -0,0 +1,57 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew.flags;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ChangedMode implements Flag.Value<ChangedMode> {
NO_CHANGE("FLAG_CHANGED_NO_CHANGE", false),
HAS_CHANGE("FLAG_CHANGED_HAS_CHANGE", true);
private static ChangedMode[] values;
private final String chatValue;
private final Boolean changed;
@Override
public ChangedMode[] getValues() {
if (ChangedMode.values == null) {
ChangedMode.values = ChangedMode.values(); //NOSONAR
}
return ChangedMode.values;
}
@Override
public ChangedMode getValue() {
return this;
}
@Override
public ChangedMode getValueOf(final String name) {
try {
return ChangedMode.valueOf(name.toUpperCase());
} catch (IllegalArgumentException e) {
return NO_CHANGE;
}
}
}
@@ -0,0 +1,71 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew.flags;
import de.steamwar.bausystem.regionnew.Color;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ColorMode implements Flag.Value<ColorMode> {
WHITE("FLAG_COLOR_WHITE", Color.WHITE),
ORANGE("FLAG_COLOR_ORANGE", Color.ORANGE),
MAGENTA("FLAG_COLOR_MAGENTA", Color.MAGENTA),
LIGHT_BLUE("FLAG_COLOR_LIGHT_BLUE", Color.LIGHT_BLUE),
YELLOW("FLAG_COLOR_YELLOW", Color.YELLOW),
LIME("FLAG_COLOR_LIME", Color.LIME),
PINK("FLAG_COLOR_PINK", Color.PINK),
GRAY("FLAG_COLOR_GRAY", Color.GRAY),
LIGHT_GRAY("FLAG_COLOR_LIGHT_GRAY", Color.LIGHT_GRAY),
CYAN("FLAG_COLOR_CYAN", Color.CYAN),
PURPLE("FLAG_COLOR_PURPLE", Color.PURPLE),
BLUE("FLAG_COLOR_BLUE", Color.BLUE),
BROWN("FLAG_COLOR_BROWN", Color.BROWN),
GREEN("FLAG_COLOR_GREEN", Color.GREEN),
RED("FLAG_COLOR_RED", Color.RED),
BLACK("FLAG_COLOR_BLACK", Color.BLACK);
private static ColorMode[] values;
private final String chatValue;
private final Color color;
@Override
public ColorMode[] getValues() {
if (ColorMode.values == null) {
ColorMode.values = ColorMode.values(); //NOSONAR
}
return ColorMode.values;
}
@Override
public ColorMode getValue() {
return this;
}
@Override
public ColorMode getValueOf(final String name) {
try {
return ColorMode.valueOf(name.toUpperCase());
} catch (IllegalArgumentException e) {
return ColorMode.YELLOW;
}
}
}
@@ -0,0 +1,59 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew.flags;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum FireMode implements Flag.Value<FireMode> {
ALLOW("FLAG_FIRE_ALLOW"),
DENY("FLAG_FIRE_DENY");
private static FireMode[] values;
private final String chatValue;
@Override
public FireMode[] getValues() {
if (FireMode.values == null) {
FireMode.values = FireMode.values(); //NOSONAR
}
return FireMode.values;
}
@Override
public FireMode getValue() {
return this;
}
@Override
public FireMode getValueOf(final String name) {
try {
return FireMode.valueOf(name.toUpperCase());
} catch (IllegalArgumentException e) {
if (name.equalsIgnoreCase("false")) {
return FireMode.DENY;
}
return FireMode.ALLOW;
}
}
}
@@ -0,0 +1,102 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew.flags;
import de.steamwar.bausystem.shared.EnumDisplay;
import lombok.Getter;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
public class Flag<T extends Enum<T> & Flag.Value<T>> implements EnumDisplay {
public static final Flag<ColorMode> COLOR = new Flag<>("COLOR", "FLAG_COLOR", ColorMode.class, ColorMode.YELLOW);
public static final Flag<TNTMode> TNT = new Flag<>("TNT", "FLAG_TNT", TNTMode.class, TNTMode.ONLY_TB);
public static final Flag<FireMode> FIRE = new Flag<>("FIRE", "FLAG_FIRE", FireMode.class, FireMode.ALLOW);
public static final Flag<FreezeMode> FREEZE = new Flag<>("FREEZE", "FLAG_FREEZE", FreezeMode.class, FreezeMode.INACTIVE);
public static final Flag<ProtectMode> PROTECT = new Flag<>("PROTECT", "FLAG_PROTECT", ProtectMode.class, ProtectMode.ACTIVE);
public static final Flag<ItemMode> ITEMS = new Flag<>("ITEMS", "FLAG_ITEMS", ItemMode.class, ItemMode.INACTIVE);
public static final Flag<NoGravityMode> NO_GRAVITY = new Flag<>("NO_GRAVITY", "FLAG_NO_GRAVITY", NoGravityMode.class, NoGravityMode.INACTIVE);
public static final Flag<TestblockMode> TESTBLOCK = new Flag<>("TESTBLOCK", "FLAG_TESTBLOCK", TestblockMode.class, TestblockMode.NO_VALUE);
public static final Flag<ChangedMode> CHANGED = new Flag<>("CHANGED", "FLAG_CHANGED", ChangedMode.class, ChangedMode.NO_CHANGE);
@Getter
private static final Set<Flag> flags = new HashSet<>();
private static AtomicInteger counter = new AtomicInteger(0);
private String name;
private int ordinal;
@Getter
private String chatValue;
@Getter
private final Class<? extends Flag.Value<?>> valueType;
@Getter
private final Flag.Value<?> defaultValue;
@Getter
private final Flag.Value<?>[] values;
private Flag(String name, String chatValue, Class<? extends Flag.Value<T>> valueType, Value<T> defaultValue) {
flags.add(this);
this.name = name;
this.ordinal = counter.getAndIncrement();
this.chatValue = chatValue;
this.valueType = valueType;
this.defaultValue = defaultValue;
this.values = defaultValue.getValues();
}
public String name() {
return name;
}
public int ordinal() {
return ordinal;
}
public boolean oneOff(Flag<?>... flags) {
for (Flag<?> flag : flags) {
if (flag == this) {
return true;
}
}
return false;
}
public interface Value<T extends Enum<T> & Flag.Value<T>> extends EnumDisplay {
T getValue();
T getValueOf(final String name);
T[] getValues();
default String getName() {
return this.getValue().name().toLowerCase();
}
}
}
@@ -0,0 +1,60 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew.flags;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum FreezeMode implements Flag.Value<FreezeMode> {
ACTIVE("FLAG_FREEZE_ACTIVE"),
INACTIVE("FLAG_FREEZE_INACTIVE");
private static FreezeMode[] values;
private final String chatValue;
@Override
public FreezeMode[] getValues() {
if (FreezeMode.values == null) {
FreezeMode.values = FreezeMode.values(); //NOSONAR
}
return FreezeMode.values;
}
@Override
public FreezeMode getValue() {
return this;
}
@Override
public FreezeMode getValueOf(final String name) {
try {
return FreezeMode.valueOf(name.toUpperCase());
} catch (IllegalArgumentException e) {
if (name.equalsIgnoreCase("false")) {
return FreezeMode.INACTIVE;
}
return FreezeMode.INACTIVE;
}
}
}
@@ -0,0 +1,59 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew.flags;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ItemMode implements Flag.Value<ItemMode> {
ACTIVE("FLAG_ITEMS_ACTIVE"),
INACTIVE("FLAG_ITEMS_INACTIVE");
private static ItemMode[] values;
private final String chatValue;
@Override
public ItemMode[] getValues() {
if (ItemMode.values == null) {
ItemMode.values = ItemMode.values(); //NOSONAR
}
return ItemMode.values;
}
@Override
public ItemMode getValue() {
return this;
}
@Override
public ItemMode getValueOf(final String name) {
try {
return ItemMode.valueOf(name.toUpperCase());
} catch (IllegalArgumentException e) {
if (name.equalsIgnoreCase("false")) {
return ItemMode.INACTIVE;
}
return ItemMode.ACTIVE;
}
}
}
@@ -0,0 +1,59 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew.flags;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum NoGravityMode implements Flag.Value<NoGravityMode> {
ACTIVE("FLAG_NO_GRAVITY_ACTIVE"),
INACTIVE("FLAG_NO_GRAVITY_INACTIVE");
private static NoGravityMode[] values;
private final String chatValue;
@Override
public NoGravityMode[] getValues() {
if (NoGravityMode.values == null) {
NoGravityMode.values = NoGravityMode.values(); //NOSONAR
}
return NoGravityMode.values;
}
@Override
public NoGravityMode getValue() {
return this;
}
@Override
public NoGravityMode getValueOf(final String name) {
try {
return NoGravityMode.valueOf(name.toUpperCase());
} catch (IllegalArgumentException e) {
if (name.equalsIgnoreCase("false")) {
return NoGravityMode.INACTIVE;
}
return NoGravityMode.ACTIVE;
}
}
}
@@ -0,0 +1,59 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew.flags;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ProtectMode implements Flag.Value<ProtectMode> {
ACTIVE("FLAG_PROTECT_ACTIVE"),
INACTIVE("FLAG_PROTECT_INACTIVE");
private static ProtectMode[] values;
private final String chatValue;
@Override
public ProtectMode[] getValues() {
if (ProtectMode.values == null) {
ProtectMode.values = ProtectMode.values(); //NOSONAR
}
return ProtectMode.values;
}
@Override
public ProtectMode getValue() {
return this;
}
@Override
public ProtectMode getValueOf(final String name) {
try {
return ProtectMode.valueOf(name.toUpperCase());
} catch (IllegalArgumentException e) {
if (name.equalsIgnoreCase("false")) {
return ProtectMode.INACTIVE;
}
return ProtectMode.ACTIVE;
}
}
}
@@ -0,0 +1,58 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew.flags;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum TNTMode implements Flag.Value<TNTMode> {
ALLOW("FLAG_TNT_ALLOW"),
DENY("FLAG_TNT_DENY"),
ONLY_TB("FLAG_TNT_ONLY_TB"),
ONLY_BUILD("FLAG_TNT_ONLY_BUILD");
private static TNTMode[] values;
private final String chatValue;
@Override
public TNTMode[] getValues() {
if (TNTMode.values == null) {
TNTMode.values = TNTMode.values(); //NOSONAR
}
return TNTMode.values;
}
@Override
public TNTMode getValue() {
return this;
}
@Override
public TNTMode getValueOf(final String name) {
try {
return TNTMode.valueOf(name.toUpperCase());
} catch (IllegalArgumentException e) {
return TNTMode.ALLOW;
}
}
}
@@ -0,0 +1,61 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew.flags;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum TestblockMode implements Flag.Value<TestblockMode> {
NO_VALUE("FLAG_TESTBLOCK_NO_VALUE", false, false),
NORTH("FLAG_TESTBLOCK_NORTH", false, true),
SOUTH("FLAG_TESTBLOCK_SOUTH", false, false),
FIXED_NORTH("FLAG_TESTBLOCK_NORTH", true, true),
FIXED_SOUTH("FLAG_TESTBLOCK_SOUTH", true, false);
private static TestblockMode[] values;
private final String chatValue;
private final boolean fixed;
private final boolean north;
@Override
public TestblockMode[] getValues() {
if (TestblockMode.values == null) {
TestblockMode.values = TestblockMode.values(); //NOSONAR
}
return TestblockMode.values;
}
@Override
public TestblockMode getValue() {
return this;
}
@Override
public TestblockMode getValueOf(final String name) {
try {
return TestblockMode.valueOf(name.toUpperCase());
} catch (IllegalArgumentException e) {
return NO_VALUE;
}
}
}
@@ -22,7 +22,7 @@ package de.steamwar.bausystem.utils;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Point;
import de.steamwar.core.VersionDependent;
import org.bukkit.Material;
import org.bukkit.World;
@@ -26,8 +26,8 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import de.steamwar.bausystem.region.Color;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.regionnew.Color;
import de.steamwar.bausystem.regionnew.Point;
import de.steamwar.sql.SchematicData;
import de.steamwar.sql.SchematicNode;
import lombok.Getter;
@@ -0,0 +1,47 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
plugins {
steamwar.java
}
tasks.compileJava {
options.isWarnings = false
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
dependencies {
compileOnly(project(":BauSystem:BauSystem_Main"))
compileOnly(project(":SpigotCore"))
compileOnly(libs.spigotapi)
compileOnly(libs.axiom)
compileOnly(libs.authlib)
compileOnly(libs.viaapi)
compileOnly(libs.nms20)
compileOnly(libs.fawe18)
implementation(libs.luaj)
implementation(files("$projectDir/../libs/YAPION-SNAPSHOT.jar"))
}
@@ -0,0 +1,55 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew;
import de.steamwar.bausystem.regionnew.flags.Flag;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
public class FixedFlagStorage implements FlagStorage {
private Map<Flag<?>, Flag.Value<?>> flagMap = new HashMap<>();
public static FlagStorage createFromRegion(Region region) {
FlagStorage flagStorage = new FixedFlagStorage();
Flag.getFlags().forEach(flag -> {
if (region.hasFlag(flag).isReadable()) {
flagStorage.set(flag, flag.getDefaultValue());
}
});
return flagStorage;
}
public static FlagStorage createFromFile(File file) {
throw new IllegalStateException("Not implemented yet");
}
@Override
public <T extends Enum<T> & Flag.Value<T>> boolean set(Flag<T> flag, Flag.Value<T> value) {
return flagMap.put(flag, value) != value;
}
@Override
public <T extends Enum<T> & Flag.Value<T>> Flag.Value<T> get(Flag<T> flag) {
return (Flag.Value<T>) flagMap.get(flag);
}
}
@@ -0,0 +1,164 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew;
import com.sk89q.worldedit.EditSession;
import de.steamwar.bausystem.regionnew.flags.Flag;
import de.steamwar.sql.SchematicNode;
import lombok.NonNull;
import org.bukkit.Location;
import javax.annotation.Nullable;
import java.io.File;
import java.util.Optional;
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 final FlagStorage FLAG_STORAGE = FixedFlagStorage.createFromRegion(this); // TODO: Update to either File or Region creation!
private FixedGlobalRegion() {
}
@Override
public RegionType getType() {
return RegionType.GLOBAL;
}
@Override
public <T extends Enum<T> & Flag.Value<T>> RegionFlagPolicy hasFlag(@NonNull Flag<T> flag) {
if (flag.oneOff(Flag.TNT, Flag.FIRE, Flag.FREEZE, Flag.ITEMS)) {
return RegionFlagPolicy.WRITABLE;
}
return RegionFlagPolicy.NOT_APPLICABLE;
}
@Override
public <T extends Enum<T> & Flag.Value<T>> boolean setFlag(@NonNull Flag<T> flag, Flag.Value<T> value) {
return hasFlag(flag).isWritable() && FLAG_STORAGE.set(flag, value);
}
@Override
public <T extends Enum<T> & Flag.Value<T>> Optional<Flag.Value<T>> getFlag(@NonNull Flag<T> flag) {
if (hasFlag(flag).isReadable()) {
return Optional.of(FLAG_STORAGE.get(flag));
} else {
return Optional.empty();
}
}
@Override
public Point getMinPoint() {
return MIN_POINT;
}
@Override
public Point getMaxPoint() {
return MAX_POINT;
}
@Override
public boolean inRegion(Location location) {
return true;
}
@Override
public Optional<Point> getBuildMinPoint(boolean extension) {
return Optional.empty();
}
@Override
public Optional<Point> getBuildMaxPoint(boolean extension) {
return Optional.empty();
}
@Override
public boolean inBuildRegion(boolean extension) {
return false;
}
@Override
public Optional<Point> getTestblockMinPoint(boolean extension) {
return Optional.empty();
}
@Override
public Optional<Point> getTestblockMaxPoint(boolean extension) {
return Optional.empty();
}
@Override
public boolean inTestblockRegion(boolean extension) {
return false;
}
@Override
public Optional<File> getGameModeConfig() {
return Optional.empty();
}
@Override
public Optional<EditSession> copy() {
return Optional.empty();
}
@Override
public Optional<EditSession> copyBuild() {
return Optional.empty();
}
@Override
public Optional<EditSession> copyTestblock() {
return Optional.empty();
}
@Override
public void reset() {
}
@Override
public void resetBuild(@Nullable SchematicNode schematicNode, boolean extension) {
}
@Override
public void resetTestblock(@Nullable SchematicNode schematicNode, boolean extension) {
}
@Override
public void remember(EditSession editSession) {
}
@Override
public boolean undo() {
return false;
}
@Override
public boolean redo() {
return false;
}
}
@@ -0,0 +1,148 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew;
import com.sk89q.worldedit.EditSession;
import de.steamwar.bausystem.regionnew.flags.Flag;
import de.steamwar.sql.SchematicNode;
import lombok.NonNull;
import org.bukkit.Location;
import javax.annotation.Nullable;
import java.io.File;
import java.util.Optional;
public class FixedRegion implements Region { // TODO: Implement!
@Override
public RegionType getType() {
return RegionType.NORMAL;
}
@Override
public <T extends Enum<T> & Flag.Value<T>> RegionFlagPolicy hasFlag(@NonNull Flag<T> flag) {
return null;
}
@Override
public <T extends Enum<T> & Flag.Value<T>> boolean setFlag(@NonNull Flag<T> flag, Flag.Value<T> value) {
return false;
}
@Override
public <T extends Enum<T> & Flag.Value<T>> Optional<Flag.Value<T>> getFlag(@NonNull Flag<T> flag) {
return Optional.empty();
}
@Override
public Point getMinPoint() {
return null;
}
@Override
public Point getMaxPoint() {
return null;
}
@Override
public boolean inRegion(Location location) {
return false;
}
@Override
public Optional<Point> getBuildMinPoint(boolean extension) {
return Optional.empty();
}
@Override
public Optional<Point> getBuildMaxPoint(boolean extension) {
return Optional.empty();
}
@Override
public boolean inBuildRegion(boolean extension) {
return false;
}
@Override
public Optional<Point> getTestblockMinPoint(boolean extension) {
return Optional.empty();
}
@Override
public Optional<Point> getTestblockMaxPoint(boolean extension) {
return Optional.empty();
}
@Override
public boolean inTestblockRegion(boolean extension) {
return false;
}
@Override
public Optional<File> getGameModeConfig() {
return Optional.empty();
}
@Override
public Optional<EditSession> copy() {
return Optional.empty();
}
@Override
public Optional<EditSession> copyBuild() {
return Optional.empty();
}
@Override
public Optional<EditSession> copyTestblock() {
return Optional.empty();
}
@Override
public void reset() {
}
@Override
public void resetBuild(@Nullable SchematicNode schematicNode, boolean extension) {
}
@Override
public void resetTestblock(@Nullable SchematicNode schematicNode, boolean extension) {
}
@Override
public void remember(EditSession editSession) {
}
@Override
public boolean undo() {
return false;
}
@Override
public boolean redo() {
return false;
}
}
@@ -0,0 +1,70 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.regionnew;
import org.bukkit.Location;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Stream;
public class FixedRegionSystem implements RegionSystem {
private static final Map<String, Region> REGION_MAP = new HashMap<>();
@Override
public void load() {
// TODO: Implement
}
@Override
public void save() {
// TODO: Implement
}
@Override
public Region getGlobalRegion() {
return FixedGlobalRegion.INSTANCE;
}
@Override
public Region get(Location location) {
return REGION_MAP.values().stream()
.filter(region -> region.inRegion(location))
.findFirst()
.orElse(FixedGlobalRegion.INSTANCE);
}
@Override
public Optional<Region> getRegion(String name) {
return Optional.ofNullable(REGION_MAP.get(name));
}
@Override
public Stream<Region> getRegions() {
return REGION_MAP.values().stream();
}
@Override
public boolean isModular() {
return false;
}
}
+1
View File
@@ -27,6 +27,7 @@ tasks.build {
}
dependencies {
implementation(project(":BauSystem:BauSystem_RegionFixed"))
implementation(project(":BauSystem:BauSystem_Main"))
implementation(project(":BauSystem:BauSystem_15"))
implementation(project(":BauSystem:BauSystem_18"))
+2 -1
View File
@@ -177,7 +177,8 @@ include(
"BauSystem:BauSystem_19",
"BauSystem:BauSystem_20",
"BauSystem:BauSystem_21",
"BauSystem:BauSystem_Main"
"BauSystem:BauSystem_Main",
"BauSystem:BauSystem_RegionFixed"
)
include("CommandFramework")