Add BackupMode
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
4d80a3b0d1
Commit
2941616487
@ -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<Flag> flags;
|
||||
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.region.flags.other;
|
||||
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
|
||||
public enum BackupMode implements Flag.Value<BackupMode> {
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren