diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/backup/.gitkeep b/BauSystem_Main/src/de/steamwar/bausystem/features/backup/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java b/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java index ca45eca0..e9ce3486 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java @@ -20,14 +20,15 @@ package de.steamwar.bausystem.region.flags; import de.steamwar.bausystem.region.Region; +import de.steamwar.bausystem.region.flags.other.BackupMode; import de.steamwar.bausystem.region.flags.flagvalues.*; +import de.steamwar.bausystem.shared.EnumDisplay; +import lombok.Getter; + import java.util.EnumSet; import java.util.Set; import java.util.function.Predicate; -import de.steamwar.bausystem.shared.EnumDisplay; -import lombok.Getter; - @Getter public enum Flag implements EnumDisplay { @@ -36,7 +37,8 @@ public enum Flag implements EnumDisplay { FIRE("FLAG_FIRE", FireMode.class, FireMode.ALLOW, region -> true), DAMAGE("FLAG_DAMAGE", DamageMode.class, DamageMode.ALLOW, region -> false), FREEZE("FLAG_FREEZE", FreezeMode.class, FreezeMode.INACTIVE, region -> true), - PROTECT("FLAG_PROTECT", ProtectMode.class, ProtectMode.INACTIVE, region -> region.getFloorLevel() != 0); + PROTECT("FLAG_PROTECT", ProtectMode.class, ProtectMode.INACTIVE, region -> region.getFloorLevel() != 0), + BACKUP("", BackupMode.class, BackupMode.UNCHANGED, region -> false); @Getter private static final Set flags; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/flags/other/BackupMode.java b/BauSystem_Main/src/de/steamwar/bausystem/region/flags/other/BackupMode.java new file mode 100644 index 00000000..43ab9115 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/flags/other/BackupMode.java @@ -0,0 +1,57 @@ +/* + * 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.flags.other; + +import de.steamwar.bausystem.region.flags.Flag; + +public enum BackupMode implements Flag.Value { + + CHANGED, + UNCHANGED; + + private static BackupMode[] values; + + @Override + public BackupMode[] getValues() { + if (BackupMode.values == null) { + BackupMode.values = BackupMode.values(); //NOSONAR + } + return BackupMode.values; + } + + @Override + public BackupMode getValue() { + return this; + } + + @Override + public BackupMode getValueOf(final String name) { + try { + return BackupMode.valueOf(name.toUpperCase()); + } catch (IllegalArgumentException e) { + return BackupMode.UNCHANGED; + } + } + + @Override + public String getChatValue() { + throw new UnsupportedOperationException(); + } +}