Add BauSystem module

Fix ci java version
Fix LinkageProcessor
This commit is contained in:
2024-08-05 13:28:50 +02:00
parent 41d31e6c9c
commit 3366a30b0c
526 changed files with 43550 additions and 149479 deletions
@@ -0,0 +1,86 @@
/*
* 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.flags.flagvalues.*;
import de.steamwar.bausystem.shared.EnumDisplay;
import lombok.Getter;
import java.util.EnumSet;
import java.util.Set;
@Getter
public enum Flag implements EnumDisplay {
COLOR("FLAG_COLOR", ColorMode.class, ColorMode.YELLOW),
TNT("FLAG_TNT", TNTMode.class, TNTMode.ONLY_TB),
FIRE("FLAG_FIRE", FireMode.class, FireMode.ALLOW),
FREEZE("FLAG_FREEZE", FreezeMode.class, FreezeMode.INACTIVE),
PROTECT("FLAG_PROTECT", ProtectMode.class, ProtectMode.ACTIVE),
ITEMS("FLAG_ITEMS", ItemMode.class, ItemMode.INACTIVE),
NO_GRAVITY("FLAG_NO_GRAVITY", NoGravityMode.class, NoGravityMode.INACTIVE),
;
@Getter
private static final Set<Flag> flags;
static {
flags = EnumSet.allOf(Flag.class);
}
private final String chatValue;
private final Class<? extends Value<?>> valueType;
private final Flag.Value<?> defaultValue;
private final Value<?>[] values;
<T extends Enum<T> & Value<T>> Flag(String chatValue, final Class<? extends Value<T>> valueType, final Flag.Value<T> defaultValue) {
this.chatValue = chatValue;
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();
}
@Override
public String getChatValue() {
return chatValue;
}
public interface Value<T extends Enum<T> & Value<T>> extends EnumDisplay {
T getValue();
T getValueOf(final String name);
T[] getValues();
default String getName() {
return this.getValue().name().toLowerCase();
}
}
}
@@ -0,0 +1,72 @@
/*
* 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.Color;
import de.steamwar.bausystem.region.flags.Flag;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ColorMode implements Flag.Value<ColorMode> {
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;
}
}
}
@@ -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.flagvalues;
import de.steamwar.bausystem.region.flags.Flag;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum FireMode implements Flag.Value<FireMode> {
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;
}
}
}
@@ -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;
@Getter
@AllArgsConstructor
public enum FreezeMode implements Flag.Value<FreezeMode> {
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;
}
}
}
@@ -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.flagvalues;
import de.steamwar.bausystem.region.flags.Flag;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ItemMode implements Flag.Value<ItemMode> {
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;
}
}
}
@@ -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.flagvalues;
import de.steamwar.bausystem.region.flags.Flag;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum NoGravityMode implements Flag.Value<NoGravityMode> {
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;
}
}
}
@@ -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.flagvalues;
import de.steamwar.bausystem.region.flags.Flag;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ProtectMode implements Flag.Value<ProtectMode> {
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;
}
}
}
@@ -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.flagvalues;
import de.steamwar.bausystem.region.flags.Flag;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum TNTMode implements Flag.Value<TNTMode> {
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;
}
}
}