Dieser Commit ist enthalten in:
Ursprung
4d576da03d
Commit
5c13b8bde5
@ -53,7 +53,7 @@ dependencies {
|
|||||||
// compileOnly swdep('Spigot-1.20')
|
// compileOnly swdep('Spigot-1.20')
|
||||||
compileOnly swdep('SpigotCore')
|
compileOnly swdep('SpigotCore')
|
||||||
|
|
||||||
// compileOnly swdep('FastAsyncWorldEdit-1.18')
|
compileOnly swdep('FastAsyncWorldEdit-1.18')
|
||||||
// compileOnly swdep('AxiomPaper')
|
// compileOnly swdep('AxiomPaper')
|
||||||
|
|
||||||
// implementation 'org.luaj:luaj-jse:3.0.1'
|
// implementation 'org.luaj:luaj-jse:3.0.1'
|
||||||
|
79
BauSystem_PluginBase/src/de/steamwar/bausystem/region/Flag.java
Normale Datei
79
BauSystem_PluginBase/src/de/steamwar/bausystem/region/Flag.java
Normale Datei
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* 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.region;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.region.flags.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum Flag {
|
||||||
|
|
||||||
|
COLOR(ColorMode.class, ColorMode.YELLOW),
|
||||||
|
TNT(TNTMode.class, TNTMode.ONLY_TB),
|
||||||
|
FIRE(FireMode.class, FireMode.ALLOW),
|
||||||
|
FREEZE(FreezeMode.class, FreezeMode.INACTIVE),
|
||||||
|
PROTECT(ProtectMode.class, ProtectMode.ACTIVE),
|
||||||
|
ITEMS(ItemMode.class, ItemMode.INACTIVE),
|
||||||
|
TESTBLOCK(TestblockMode.class, TestblockMode.NO_VALUE),
|
||||||
|
CHANGED(ChangedMode.class, ChangedMode.NO_CHANGE),
|
||||||
|
;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static final Set<Flag> flags;
|
||||||
|
|
||||||
|
static {
|
||||||
|
flags = EnumSet.allOf(Flag.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Class<? extends Value<?>> valueType;
|
||||||
|
private final Flag.Value<?> defaultValue;
|
||||||
|
private final Value<?>[] values;
|
||||||
|
|
||||||
|
<T extends Enum<T> & Value<T>> Flag(final Class<? extends Value<T>> valueType, final Flag.Value<T> defaultValue) {
|
||||||
|
this.valueType = valueType;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.values = defaultValue.getValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Value<?> getFlagValueOf(final String name) {
|
||||||
|
return this.defaultValue.getValueOf(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.name().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Value<T extends Enum<T> & Value<T>> {
|
||||||
|
|
||||||
|
T getValue();
|
||||||
|
|
||||||
|
T getValueOf(final String name);
|
||||||
|
|
||||||
|
T[] getValues();
|
||||||
|
|
||||||
|
default String getName() {
|
||||||
|
return this.getValue().name().toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
174
BauSystem_PluginBase/src/de/steamwar/bausystem/region/GlobalRegion.java
Normale Datei
174
BauSystem_PluginBase/src/de/steamwar/bausystem/region/GlobalRegion.java
Normale Datei
@ -0,0 +1,174 @@
|
|||||||
|
/*
|
||||||
|
* 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.region;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import de.steamwar.sql.SchematicNode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class GlobalRegion implements Region {
|
||||||
|
|
||||||
|
public static final Region GLOBAL_REGION = new GlobalRegion();
|
||||||
|
|
||||||
|
private GlobalRegion() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RegionType getRegionType() {
|
||||||
|
return RegionType.GLOBAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HasFlagResult hasFlag(Flag flag) {
|
||||||
|
return switch (flag) {
|
||||||
|
case TNT, FIRE, FREEZE, ITEMS -> HasFlagResult.WRITABLE;
|
||||||
|
default -> HasFlagResult.NOT_APPLICABLE;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFlag(Flag flag, Flag.Value<?> value) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Flag.Value<?> getFlag(Flag flagType) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Point getMinPoint() {
|
||||||
|
return new Point(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Point getMaxPoint() {
|
||||||
|
return new Point(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(Location location, 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(Location location, boolean extension) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forEachChunk(ChunkCoordinatesConsumer consumer) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ChunkCoordinatePredicate getChunkOutsidePredicate() {
|
||||||
|
return (chunkX, chunkZ) -> false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<ChunkCoordinatePredicate> getBuildChunkOutsidePredicate(boolean extension) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<ChunkCoordinatePredicate> getTestblockChunkOutsidePredicate(boolean extension) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<File> getGameModeConfig() {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<EditSession> copy() {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<EditSession> copyBuild(boolean extension) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<EditSession> copyTestblock(boolean extension) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetBuild(@Nullable SchematicNode schematicNode, boolean extension) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetBuildWireframe(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;
|
||||||
|
}
|
||||||
|
}
|
76
BauSystem_PluginBase/src/de/steamwar/bausystem/region/Point.java
Normale Datei
76
BauSystem_PluginBase/src/de/steamwar/bausystem/region/Point.java
Normale Datei
@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@ToString
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class Point {
|
||||||
|
|
||||||
|
private final int x;
|
||||||
|
private final int y;
|
||||||
|
private final int z;
|
||||||
|
|
||||||
|
public static Point fromLocation(final Location location) {
|
||||||
|
return new Point(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Point fromBlockVector3(final BlockVector3 blockVector3) {
|
||||||
|
return new Point(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point add(int x, int y, int z) {
|
||||||
|
return new Point(this.x + x, this.y + y, this.z + z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point subtract(int x, int y, int z) {
|
||||||
|
return new Point(this.x - x, this.y - y, this.z - z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point divide(int factor) {
|
||||||
|
return new Point(x / factor, y / factor, z / factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location toLocation(World world) {
|
||||||
|
return new Location(world, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location toLocation(World world, double dx, double dy, double dz) {
|
||||||
|
return new Location(world, x + dx, y + dy, z + dz);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location toLocation(Player player) {
|
||||||
|
return new Location(player.getWorld(), x, y, z, player.getLocation().getYaw(), player.getLocation().getPitch());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location toLocation(Player player, double dx, double dy, double dz) {
|
||||||
|
return new Location(player.getWorld(), x + dx, y + dy, z + dz, player.getLocation().getYaw(), player.getLocation().getPitch());
|
||||||
|
}
|
||||||
|
}
|
147
BauSystem_PluginBase/src/de/steamwar/bausystem/region/Region.java
Normale Datei
147
BauSystem_PluginBase/src/de/steamwar/bausystem/region/Region.java
Normale Datei
@ -0,0 +1,147 @@
|
|||||||
|
/*
|
||||||
|
* 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.region;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import de.steamwar.sql.SchematicNode;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface Region {
|
||||||
|
|
||||||
|
RegionSystem REGION_SYSTEM = null; // TODO: Add Loading of Implementation
|
||||||
|
|
||||||
|
static Region get(Location location) {
|
||||||
|
return REGION_SYSTEM.get(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum HasFlagResult {
|
||||||
|
NOT_APPLICABLE,
|
||||||
|
READ_ONLY,
|
||||||
|
WRITABLE
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
enum RegionType {
|
||||||
|
GLOBAL(false, false, false, true),
|
||||||
|
WATER(true, false, false, false),
|
||||||
|
WATER_CONNECTING(true, false, false, false),
|
||||||
|
LAND(false, true, false, false),
|
||||||
|
LAND_CONNECTING(false, true, false, false),
|
||||||
|
WALL(false, false, true, false),
|
||||||
|
OLD(false, false, false, false),
|
||||||
|
;
|
||||||
|
|
||||||
|
public final boolean water;
|
||||||
|
public final boolean land;
|
||||||
|
public final boolean wall;
|
||||||
|
public final boolean global;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ChunkCoordinatesConsumer {
|
||||||
|
void accept(int chunkX, int chunkZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ChunkCoordinatePredicate {
|
||||||
|
boolean test(int chunkX, int chunkZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
RegionType getRegionType();
|
||||||
|
|
||||||
|
HasFlagResult hasFlag(Flag flag);
|
||||||
|
|
||||||
|
void setFlag(Flag flag, Flag.Value<?> value);
|
||||||
|
|
||||||
|
Flag.Value<?> getFlag(Flag flagType);
|
||||||
|
|
||||||
|
default <T extends Enum<T> & Flag.Value<T>> T getFlagValue(Flag flagType) {
|
||||||
|
Flag.Value<?> value = getFlag(flagType);
|
||||||
|
if (value == null) return null;
|
||||||
|
return (T) value.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T extends Enum<T> & Flag.Value<T>> T getFlagValue(Flag flagType, Class<T> type) {
|
||||||
|
return getFlagValue(flagType);
|
||||||
|
}
|
||||||
|
|
||||||
|
Point getMinPoint();
|
||||||
|
|
||||||
|
Point getMaxPoint();
|
||||||
|
|
||||||
|
boolean inRegion(Location location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can return {@link Optional#empty()} if {@link #hasFlag(Flag)} returns false for the TestblockFlag
|
||||||
|
*/
|
||||||
|
Optional<Point> getBuildMinPoint(boolean extension);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can return {@link Optional#empty()} if {@link #hasFlag(Flag)} returns false for the TestblockFlag
|
||||||
|
*/
|
||||||
|
Optional<Point> getBuildMaxPoint(boolean extension);
|
||||||
|
|
||||||
|
boolean inBuildRegion(Location location, boolean extension);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can return {@link Optional#empty()} if {@link #hasFlag(Flag)} returns false for the TestblockFlag
|
||||||
|
*/
|
||||||
|
Optional<Point> getTestblockMinPoint(boolean extension);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can return {@link Optional#empty()} if {@link #hasFlag(Flag)} returns false for the TestblockFlag
|
||||||
|
*/
|
||||||
|
Optional<Point> getTestblockMaxPoint(boolean extension);
|
||||||
|
|
||||||
|
boolean inTestblockRegion(Location location, boolean extension);
|
||||||
|
|
||||||
|
void forEachChunk(ChunkCoordinatesConsumer consumer);
|
||||||
|
|
||||||
|
ChunkCoordinatePredicate getChunkOutsidePredicate();
|
||||||
|
|
||||||
|
Optional<ChunkCoordinatePredicate> getBuildChunkOutsidePredicate(boolean extension);
|
||||||
|
|
||||||
|
Optional<ChunkCoordinatePredicate> getTestblockChunkOutsidePredicate(boolean extension);
|
||||||
|
|
||||||
|
Optional<File> getGameModeConfig();
|
||||||
|
|
||||||
|
Optional<EditSession> copy();
|
||||||
|
|
||||||
|
Optional<EditSession> copyBuild(boolean extension);
|
||||||
|
|
||||||
|
Optional<EditSession> copyTestblock(boolean extension);
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
void resetBuild(@Nullable SchematicNode schematicNode, boolean extension);
|
||||||
|
|
||||||
|
void resetBuildWireframe(boolean extension);
|
||||||
|
|
||||||
|
void resetTestblock(@Nullable SchematicNode schematicNode, boolean extension);
|
||||||
|
|
||||||
|
void remember(EditSession editSession);
|
||||||
|
|
||||||
|
boolean undo();
|
||||||
|
|
||||||
|
boolean redo();
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* 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.region;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public interface RegionSystem {
|
||||||
|
|
||||||
|
void load();
|
||||||
|
|
||||||
|
void save();
|
||||||
|
|
||||||
|
Region get(Location location);
|
||||||
|
|
||||||
|
Optional<Region> get(String name);
|
||||||
|
|
||||||
|
Stream<Region> getRegions();
|
||||||
|
|
||||||
|
boolean isModular();
|
||||||
|
// TODO: Add creating and removing of Regions as well as moving
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* 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.region.flags;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.region.Flag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum ChangedMode implements Flag.Value<ChangedMode> {
|
||||||
|
|
||||||
|
NO_CHANGE,
|
||||||
|
HAS_CHANGE;
|
||||||
|
|
||||||
|
private static ChangedMode[] values;
|
||||||
|
|
||||||
|
@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 null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* 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.flags;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.region.Flag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum ColorMode implements Flag.Value<ColorMode> {
|
||||||
|
|
||||||
|
WHITE,
|
||||||
|
ORANGE,
|
||||||
|
MAGENTA,
|
||||||
|
LIGHT_BLUE,
|
||||||
|
YELLOW,
|
||||||
|
LIME,
|
||||||
|
PINK,
|
||||||
|
GRAY,
|
||||||
|
LIGHT_GRAY,
|
||||||
|
CYAN,
|
||||||
|
PURPLE,
|
||||||
|
BLUE,
|
||||||
|
BROWN,
|
||||||
|
GREEN,
|
||||||
|
RED,
|
||||||
|
BLACK;
|
||||||
|
|
||||||
|
private static ColorMode[] values;
|
||||||
|
|
||||||
|
@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) 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.flags;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.region.Flag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum FireMode implements Flag.Value<FireMode> {
|
||||||
|
|
||||||
|
ALLOW,
|
||||||
|
DENY;
|
||||||
|
|
||||||
|
private static FireMode[] values;
|
||||||
|
|
||||||
|
@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,60 @@
|
|||||||
|
/*
|
||||||
|
* 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.flags;
|
||||||
|
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.region.Flag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum FreezeMode implements Flag.Value<FreezeMode> {
|
||||||
|
|
||||||
|
ACTIVE,
|
||||||
|
INACTIVE;
|
||||||
|
|
||||||
|
private static FreezeMode[] values;
|
||||||
|
|
||||||
|
@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) 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.flags;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.region.Flag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum ItemMode implements Flag.Value<ItemMode> {
|
||||||
|
|
||||||
|
ACTIVE,
|
||||||
|
INACTIVE;
|
||||||
|
|
||||||
|
private static ItemMode[] values;
|
||||||
|
|
||||||
|
@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) 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.flags;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.region.Flag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum ProtectMode implements Flag.Value<ProtectMode> {
|
||||||
|
|
||||||
|
ACTIVE,
|
||||||
|
INACTIVE;
|
||||||
|
|
||||||
|
private static ProtectMode[] values;
|
||||||
|
|
||||||
|
@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) 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.flags;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.region.Flag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum TNTMode implements Flag.Value<TNTMode> {
|
||||||
|
|
||||||
|
ALLOW,
|
||||||
|
DENY,
|
||||||
|
ONLY_TB,
|
||||||
|
ONLY_BUILD;
|
||||||
|
|
||||||
|
private static TNTMode[] values;
|
||||||
|
|
||||||
|
@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.region.flags;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.region.Flag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum TestblockMode implements Flag.Value<TestblockMode> {
|
||||||
|
|
||||||
|
NO_VALUE(false, false),
|
||||||
|
NORTH(false, true),
|
||||||
|
SOUTH(false, false),
|
||||||
|
FIXED_NORTH(true, true),
|
||||||
|
FIXED_SOUTH(true, false);
|
||||||
|
|
||||||
|
private static TestblockMode[] values;
|
||||||
|
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 null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren