SteamWar/BauSystem2.0
Archiviert
12
0
Implement ColorMode
Dieser Commit ist enthalten in:
yoyosource 2021-04-18 00:54:46 +02:00
Ursprung f101c4aaa0
Commit 9fb8b4e446
3 geänderte Dateien mit 91 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,39 @@
/*
* 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;
public enum Color {
WHITE,
ORANGE,
MAGENTA,
LIGHT_BLUE,
YELLOW,
LIME,
PINK,
GRAY,
LIGHT_GRAY,
CYAN,
PURPLE,
BLUE,
BROWN,
GREEN,
RED,
BLACK;
}

Datei anzeigen

@ -27,6 +27,7 @@ import lombok.Getter;
@Getter
public enum Flag {
COLOR(ColorMode.class, ColorMode.YELLOW),
TNT(TNTMode.class, TNTMode.ALLOW),
FIRE(FireMode.class, FireMode.ALLOW),
FREEZE(FreezeMode.class, FreezeMode.INACTIVE),

Datei anzeigen

@ -19,5 +19,55 @@
package de.steamwar.bausystem.region.flags.flagvalues;
public enum ColorMode {
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(Color.WHITE),
ORANGE(Color.ORANGE),
MAGENTA(Color.MAGENTA),
LIGHT_BLUE(Color.LIGHT_BLUE),
YELLOW(Color.YELLOW),
LIME(Color.LIME),
PINK(Color.PINK),
GRAY(Color.GRAY),
LIGHT_GRAY(Color.LIGHT_GRAY),
CYAN(Color.CYAN),
PURPLE(Color.PURPLE),
BLUE(Color.BLUE),
BROWN(Color.BROWN),
GREEN(Color.GREEN),
RED(Color.RED),
BLACK(Color.BLACK);
private static ColorMode[] values;
private final Color color;
private final String chatValue = name();
@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);
} catch (IllegalArgumentException e) {
return ColorMode.YELLOW;
}
}
}