SteamWar/BauSystem2.0
Archiviert
12
0

Add ProtectMode

Dieser Commit ist enthalten in:
yoyosource 2021-04-17 21:06:37 +02:00
Ursprung 300aa30f12
Commit 7ca44c0795
6 geänderte Dateien mit 101 neuen und 41 gelöschten Zeilen

Datei anzeigen

@ -28,9 +28,10 @@ import lombok.Getter;
public enum Flag {
TNT(TNTMode.class, TNTMode.ALLOW),
FIRE(FIREMode.class, FIREMode.ALLOW),
FREEZE(FREEZEMode.class, FREEZEMode.INACTIVE),
DAMAGE(DAMAGEMode.class, DAMAGEMode.ALLOW);
FIRE(FireMode.class, FireMode.ALLOW),
FREEZE(FreezeMode.class, FreezeMode.INACTIVE),
PROTECT(ProtectMode.class, ProtectMode.INACTIVE),
DAMAGE(DamageMode.class, DamageMode.ALLOW);
@Getter
private static final Set<Flag> flags;

Datei anzeigen

@ -26,35 +26,33 @@ import net.md_5.bungee.api.ChatColor;
@Getter
@AllArgsConstructor
public enum FIREMode implements Flag.Value<FIREMode> {
public enum DamageMode implements Flag.Value<DamageMode> {
ALLOW(ChatColor.RED + "an"),
DENY(ChatColor.GREEN + "aus");
private static FIREMode[] values;
private static DamageMode[] values;
private final String chatValue;
@Override
public FIREMode[] getValues() {
if (FIREMode.values == null) {
FIREMode.values = FIREMode.values(); //NOSONAR
public DamageMode[] getValues() {
if (DamageMode.values == null) {
DamageMode.values = DamageMode.values(); //NOSONAR
}
return FIREMode.values;
return DamageMode.values;
}
@Override
public FIREMode getValue() {
public DamageMode getValue() {
return this;
}
@Override
public FIREMode getValueOf(final String name) {
public DamageMode getValueOf(final String name) {
try {
return FIREMode.valueOf(name);
return DamageMode.valueOf(name);
} catch (IllegalArgumentException e) {
return FIREMode.ALLOW;
return DamageMode.ALLOW;
}
}
}

Datei anzeigen

@ -26,35 +26,36 @@ import net.md_5.bungee.api.ChatColor;
@Getter
@AllArgsConstructor
public enum DAMAGEMode implements Flag.Value<DAMAGEMode> {
public enum FireMode implements Flag.Value<FireMode> {
ALLOW(ChatColor.RED + "an"),
DENY(ChatColor.GREEN + "aus");
private static DAMAGEMode[] values;
private static FireMode[] values;
private final String chatValue;
@Override
public DAMAGEMode[] getValues() {
if (DAMAGEMode.values == null) {
DAMAGEMode.values = DAMAGEMode.values(); //NOSONAR
public FireMode[] getValues() {
if (FireMode.values == null) {
FireMode.values = FireMode.values(); //NOSONAR
}
return DAMAGEMode.values;
return FireMode.values;
}
@Override
public DAMAGEMode getValue() {
public FireMode getValue() {
return this;
}
@Override
public DAMAGEMode getValueOf(final String name) {
public FireMode getValueOf(final String name) {
try {
return DAMAGEMode.valueOf(name);
return FireMode.valueOf(name);
} catch (IllegalArgumentException e) {
return DAMAGEMode.ALLOW;
if (name.equalsIgnoreCase("false")) {
return FireMode.DENY;
}
return FireMode.ALLOW;
}
}
}

Datei anzeigen

@ -27,36 +27,37 @@ import net.md_5.bungee.api.ChatColor;
@Getter
@AllArgsConstructor
public enum FREEZEMode implements Flag.Value<FREEZEMode> {
public enum FreezeMode implements Flag.Value<FreezeMode> {
ACTIVE("activate", ChatColor.GREEN + "an"),
INACTIVE("deactivate", ChatColor.RED + "aus");
private static FREEZEMode[] values;
private static FreezeMode[] values;
private final String descriptor;
private final String chatValue;
@Override
public FREEZEMode[] getValues() {
if (FREEZEMode.values == null) {
FREEZEMode.values = FREEZEMode.values(); //NOSONAR
public FreezeMode[] getValues() {
if (FreezeMode.values == null) {
FreezeMode.values = FreezeMode.values(); //NOSONAR
}
return FREEZEMode.values;
return FreezeMode.values;
}
@Override
public FREEZEMode getValue() {
public FreezeMode getValue() {
return this;
}
@Override
public FREEZEMode getValueOf(final String name) {
public FreezeMode getValueOf(final String name) {
try {
return FREEZEMode.valueOf(name);
return FreezeMode.valueOf(name);
} catch (IllegalArgumentException e) {
return FREEZEMode.INACTIVE;
if (name.equalsIgnoreCase("false")) {
return FreezeMode.INACTIVE;
}
return FreezeMode.INACTIVE;
}
}

Datei anzeigen

@ -0,0 +1,61 @@
/*
* 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.flagvalues;
import de.steamwar.bausystem.region.flags.Flag;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.md_5.bungee.api.ChatColor;
@Getter
@AllArgsConstructor
public enum ProtectMode implements Flag.Value<ProtectMode> {
ACTIVE(ChatColor.GREEN + "an"),
INACTIVE(ChatColor.RED + "aus");
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);
} catch (IllegalArgumentException e) {
if (name.equalsIgnoreCase("false")) {
return ProtectMode.INACTIVE;
}
return ProtectMode.ACTIVE;
}
}
}

Datei anzeigen

@ -32,11 +32,9 @@ public enum TNTMode implements Flag.Value<TNTMode> {
DENY(ChatColor.RED + "aus"),
ONLY_TB(ChatColor.GRAY + "Kein " + ChatColor.YELLOW + "Baurahmen");
private static TNTMode[] values;
private final String chatValue;
@Override
public TNTMode[] getValues() {
if (TNTMode.values == null) {