diff --git a/BauSystem/BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java b/BauSystem/BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java index 266326e0..69872f57 100644 --- a/BauSystem/BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java +++ b/BauSystem/BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/backup/BackupCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/backup/BackupCommand.java index b7911275..6abe927a 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/backup/BackupCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/backup/BackupCommand.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/Countingwand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/Countingwand.java index fb9316b9..6c667ba7 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/Countingwand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/Countingwand.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandListener.java index 7233670a..9d811f28 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandListener.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java index 04822aa8..d7145f37 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracer.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracer.java index c1e08fcf..e4aedd0a 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracer.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracer.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionCommand.java index 6d8d6f4d..e7cedc22 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionCommand.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ColorBauGuiItem.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ColorBauGuiItem.java index a38c397f..b886e756 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ColorBauGuiItem.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ColorBauGuiItem.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/LuaLib.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/LuaLib.java index a4af0d3a..a86542df 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/LuaLib.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/LuaLib.java @@ -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.*; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/WorldEditLib.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/WorldEditLib.java index 87d1f9fb..7f0cac4d 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/WorldEditLib.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/WorldEditLib.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Cuboid.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Cuboid.java index c31653a5..e5699aaa 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Cuboid.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Cuboid.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingLaufState.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingLaufState.java index e4ed312b..369ca0d9 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingLaufState.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingLaufState.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java index 94eb6549..04c43fd3 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/team/boundary/BoundaryViewer.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/team/boundary/BoundaryViewer.java index 51bef65c..808e6398 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/team/boundary/BoundaryViewer.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/team/boundary/BoundaryViewer.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/SelectCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/SelectCommand.java index e9c2c09a..4f1df1af 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/SelectCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/SelectCommand.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/ColorReplaceCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/ColorReplaceCommand.java index 6b6659ba..3df0755c 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/ColorReplaceCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/ColorReplaceCommand.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/Color.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/Color.java deleted file mode 100644 index a50c7cb0..00000000 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/Color.java +++ /dev/null @@ -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 . - */ - -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; -} diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java index c6f8b5c7..bf8477e9 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/flags/flagvalues/ColorMode.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/flags/flagvalues/ColorMode.java index 6902a2fb..6159c959 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/flags/flagvalues/ColorMode.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/flags/flagvalues/ColorMode.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/Color.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/Color.java new file mode 100644 index 00000000..6292fbe1 --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/Color.java @@ -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 . + */ + +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; +} diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/FlagStorage.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/FlagStorage.java new file mode 100644 index 00000000..57a9523c --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/FlagStorage.java @@ -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 . + */ + +package de.steamwar.bausystem.regionnew; + +import de.steamwar.bausystem.regionnew.flags.Flag; + +public interface FlagStorage { + + & Flag.Value> boolean set(Flag flag, Flag.Value value); + + & Flag.Value> Flag.Value get(Flag flag); +} diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/Point.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/Point.java similarity index 67% rename from BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/Point.java rename to BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/Point.java index 6f8c5929..a9f3534c 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/Point.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/Point.java @@ -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 . + * 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; +package de.steamwar.bausystem.regionnew; import com.sk89q.worldedit.math.BlockVector3; import lombok.AllArgsConstructor; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/Region.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/Region.java new file mode 100644 index 00000000..8c3a61eb --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/Region.java @@ -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 . + */ + +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(); + + & Flag.Value> RegionFlagPolicy hasFlag(@NonNull Flag flag); + + & Flag.Value> boolean setFlag(@NonNull Flag flag, Flag.Value value); + + & Flag.Value> Optional> getFlag(@NonNull Flag flag); + + Point getMinPoint(); + + Point getMaxPoint(); + + boolean inRegion(Location location); + + Optional getBuildMinPoint(boolean extension); + + Optional getBuildMaxPoint(boolean extension); + + boolean inBuildRegion(boolean extension); + + Optional getTestblockMinPoint(boolean extension); + + Optional getTestblockMaxPoint(boolean extension); + + boolean inTestblockRegion(boolean extension); + + // TODO: Add forEachChunk and getChunkOutsidePredicate + + Optional getGameModeConfig(); + + Optional copy(); + + Optional copyBuild(); + + Optional 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(); +} diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/RegionFlagPolicy.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/RegionFlagPolicy.java new file mode 100644 index 00000000..7878a79a --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/RegionFlagPolicy.java @@ -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 . + */ + +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; +} diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/RegionSide.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/RegionSide.java new file mode 100644 index 00000000..6834e300 --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/RegionSide.java @@ -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 . + */ + +package de.steamwar.bausystem.regionnew; + +public enum RegionSide { + NORTH, + SOUTH +} diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/RegionSystem.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/RegionSystem.java new file mode 100644 index 00000000..b5e8d63b --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/RegionSystem.java @@ -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 . + */ + +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 getRegion(String name); + + Stream getRegions(); + + boolean isModular(); +} diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/RegionType.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/RegionType.java new file mode 100644 index 00000000..ff91fcd5 --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/RegionType.java @@ -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 . + */ + +package de.steamwar.bausystem.regionnew; + +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public enum RegionType { + + GLOBAL(true), + NORMAL(false), + ; + + private final boolean global; +} diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/ChangedMode.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/ChangedMode.java new file mode 100644 index 00000000..85e70f01 --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/ChangedMode.java @@ -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 . + */ + +package de.steamwar.bausystem.regionnew.flags; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum ChangedMode implements Flag.Value { + + 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; + } + } +} \ No newline at end of file diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/ColorMode.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/ColorMode.java new file mode 100644 index 00000000..229301c3 --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/ColorMode.java @@ -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 . + */ + +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 { + 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; + } + } +} diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/FireMode.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/FireMode.java new file mode 100644 index 00000000..f628bd47 --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/FireMode.java @@ -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 . + */ + +package de.steamwar.bausystem.regionnew.flags; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum FireMode implements Flag.Value { + + 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; + } + } +} \ No newline at end of file diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/Flag.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/Flag.java new file mode 100644 index 00000000..d915c216 --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/Flag.java @@ -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 . + */ + +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 & Flag.Value> implements EnumDisplay { + + public static final Flag COLOR = new Flag<>("COLOR", "FLAG_COLOR", ColorMode.class, ColorMode.YELLOW); + public static final Flag TNT = new Flag<>("TNT", "FLAG_TNT", TNTMode.class, TNTMode.ONLY_TB); + public static final Flag FIRE = new Flag<>("FIRE", "FLAG_FIRE", FireMode.class, FireMode.ALLOW); + public static final Flag FREEZE = new Flag<>("FREEZE", "FLAG_FREEZE", FreezeMode.class, FreezeMode.INACTIVE); + public static final Flag PROTECT = new Flag<>("PROTECT", "FLAG_PROTECT", ProtectMode.class, ProtectMode.ACTIVE); + public static final Flag ITEMS = new Flag<>("ITEMS", "FLAG_ITEMS", ItemMode.class, ItemMode.INACTIVE); + public static final Flag NO_GRAVITY = new Flag<>("NO_GRAVITY", "FLAG_NO_GRAVITY", NoGravityMode.class, NoGravityMode.INACTIVE); + public static final Flag TESTBLOCK = new Flag<>("TESTBLOCK", "FLAG_TESTBLOCK", TestblockMode.class, TestblockMode.NO_VALUE); + public static final Flag CHANGED = new Flag<>("CHANGED", "FLAG_CHANGED", ChangedMode.class, ChangedMode.NO_CHANGE); + + @Getter + private static final Set flags = new HashSet<>(); + + private static AtomicInteger counter = new AtomicInteger(0); + + private String name; + private int ordinal; + + @Getter + private String chatValue; + + @Getter + private final Class> valueType; + + @Getter + private final Flag.Value defaultValue; + + @Getter + private final Flag.Value[] values; + + private Flag(String name, String chatValue, Class> valueType, Value 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 & Flag.Value> extends EnumDisplay { + + T getValue(); + + T getValueOf(final String name); + + T[] getValues(); + + default String getName() { + return this.getValue().name().toLowerCase(); + } + } +} diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/FreezeMode.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/FreezeMode.java new file mode 100644 index 00000000..f3da631c --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/FreezeMode.java @@ -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 . + */ + +package de.steamwar.bausystem.regionnew.flags; + + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum FreezeMode implements Flag.Value { + + 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; + } + } +} \ No newline at end of file diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/ItemMode.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/ItemMode.java new file mode 100644 index 00000000..7d29899c --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/ItemMode.java @@ -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 . + */ + +package de.steamwar.bausystem.regionnew.flags; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum ItemMode implements Flag.Value { + + 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; + } + } +} diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/NoGravityMode.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/NoGravityMode.java new file mode 100644 index 00000000..68e9fa6b --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/NoGravityMode.java @@ -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 . + */ + +package de.steamwar.bausystem.regionnew.flags; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum NoGravityMode implements Flag.Value { + + 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; + } + } +} diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/ProtectMode.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/ProtectMode.java new file mode 100644 index 00000000..2f510daa --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/ProtectMode.java @@ -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 . + */ + +package de.steamwar.bausystem.regionnew.flags; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum ProtectMode implements Flag.Value { + + 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; + } + } +} diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/TNTMode.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/TNTMode.java new file mode 100644 index 00000000..e483a81b --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/TNTMode.java @@ -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 . + */ + +package de.steamwar.bausystem.regionnew.flags; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum TNTMode implements Flag.Value { + + 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; + } + } +} \ No newline at end of file diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/TestblockMode.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/TestblockMode.java new file mode 100644 index 00000000..d6d8075c --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/regionnew/flags/TestblockMode.java @@ -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 . + */ + +package de.steamwar.bausystem.regionnew.flags; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum TestblockMode implements Flag.Value { + + 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; + } + } +} \ No newline at end of file diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/FlatteningWrapper.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/FlatteningWrapper.java index 3cd96295..12b7a78a 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/FlatteningWrapper.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/FlatteningWrapper.java @@ -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; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/PasteBuilder.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/PasteBuilder.java index a4a74e17..8c3813ac 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/PasteBuilder.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/PasteBuilder.java @@ -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; diff --git a/BauSystem/BauSystem_RegionFixed/build.gradle.kts b/BauSystem/BauSystem_RegionFixed/build.gradle.kts new file mode 100644 index 00000000..bb84c063 --- /dev/null +++ b/BauSystem/BauSystem_RegionFixed/build.gradle.kts @@ -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 . + */ + +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")) +} diff --git a/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/regionnew/FixedFlagStorage.java b/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/regionnew/FixedFlagStorage.java new file mode 100644 index 00000000..1af55086 --- /dev/null +++ b/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/regionnew/FixedFlagStorage.java @@ -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 . + */ + +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.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 & Flag.Value> boolean set(Flag flag, Flag.Value value) { + return flagMap.put(flag, value) != value; + } + + @Override + public & Flag.Value> Flag.Value get(Flag flag) { + return (Flag.Value) flagMap.get(flag); + } +} diff --git a/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/regionnew/FixedGlobalRegion.java b/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/regionnew/FixedGlobalRegion.java new file mode 100644 index 00000000..8288a057 --- /dev/null +++ b/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/regionnew/FixedGlobalRegion.java @@ -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 . + */ + +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 & Flag.Value> RegionFlagPolicy hasFlag(@NonNull Flag flag) { + if (flag.oneOff(Flag.TNT, Flag.FIRE, Flag.FREEZE, Flag.ITEMS)) { + return RegionFlagPolicy.WRITABLE; + } + return RegionFlagPolicy.NOT_APPLICABLE; + } + + @Override + public & Flag.Value> boolean setFlag(@NonNull Flag flag, Flag.Value value) { + return hasFlag(flag).isWritable() && FLAG_STORAGE.set(flag, value); + } + + @Override + public & Flag.Value> Optional> getFlag(@NonNull Flag 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 getBuildMinPoint(boolean extension) { + return Optional.empty(); + } + + @Override + public Optional getBuildMaxPoint(boolean extension) { + return Optional.empty(); + } + + @Override + public boolean inBuildRegion(boolean extension) { + return false; + } + + @Override + public Optional getTestblockMinPoint(boolean extension) { + return Optional.empty(); + } + + @Override + public Optional getTestblockMaxPoint(boolean extension) { + return Optional.empty(); + } + + @Override + public boolean inTestblockRegion(boolean extension) { + return false; + } + + @Override + public Optional getGameModeConfig() { + return Optional.empty(); + } + + @Override + public Optional copy() { + return Optional.empty(); + } + + @Override + public Optional copyBuild() { + return Optional.empty(); + } + + @Override + public Optional 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; + } +} diff --git a/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/regionnew/FixedRegion.java b/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/regionnew/FixedRegion.java new file mode 100644 index 00000000..9d5bd31e --- /dev/null +++ b/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/regionnew/FixedRegion.java @@ -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 . + */ + +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 & Flag.Value> RegionFlagPolicy hasFlag(@NonNull Flag flag) { + return null; + } + + @Override + public & Flag.Value> boolean setFlag(@NonNull Flag flag, Flag.Value value) { + return false; + } + + @Override + public & Flag.Value> Optional> getFlag(@NonNull Flag 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 getBuildMinPoint(boolean extension) { + return Optional.empty(); + } + + @Override + public Optional getBuildMaxPoint(boolean extension) { + return Optional.empty(); + } + + @Override + public boolean inBuildRegion(boolean extension) { + return false; + } + + @Override + public Optional getTestblockMinPoint(boolean extension) { + return Optional.empty(); + } + + @Override + public Optional getTestblockMaxPoint(boolean extension) { + return Optional.empty(); + } + + @Override + public boolean inTestblockRegion(boolean extension) { + return false; + } + + @Override + public Optional getGameModeConfig() { + return Optional.empty(); + } + + @Override + public Optional copy() { + return Optional.empty(); + } + + @Override + public Optional copyBuild() { + return Optional.empty(); + } + + @Override + public Optional 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; + } +} diff --git a/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/regionnew/FixedRegionSystem.java b/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/regionnew/FixedRegionSystem.java new file mode 100644 index 00000000..f29b1ebc --- /dev/null +++ b/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/regionnew/FixedRegionSystem.java @@ -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 . + */ + +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 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 getRegion(String name) { + return Optional.ofNullable(REGION_MAP.get(name)); + } + + @Override + public Stream getRegions() { + return REGION_MAP.values().stream(); + } + + @Override + public boolean isModular() { + return false; + } +} diff --git a/BauSystem/build.gradle.kts b/BauSystem/build.gradle.kts index ebb9422d..5c1f2608 100644 --- a/BauSystem/build.gradle.kts +++ b/BauSystem/build.gradle.kts @@ -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")) diff --git a/settings.gradle.kts b/settings.gradle.kts index 8ab618ff..999b22ee 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -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")