SteamWar/BauSystem2.0
Archiviert
12
0

Add BauScoreboard multilingual Flags

Dieser Commit ist enthalten in:
yoyosource 2021-05-07 17:12:35 +02:00
Ursprung d24e1f2c4d
Commit daabe26f13
4 geänderte Dateien mit 41 neuen und 15 gelöschten Zeilen

Datei anzeigen

@ -13,6 +13,7 @@ PERMISSION_CHANGE_OTHER_DISABLE = §cDu kannst nun nicht mehr auf der Welt von
FLAG_COLOR = Color
FLAG_TNT = TNT
FLAG_FIRE = Fire
FLAG_DAMAGE = Damage
FLAG_FREEZE = Freeze
FLAG_PROTECT = Protect
@ -29,6 +30,26 @@ FLAG_TNT_ALLOW = §aan
FLAG_TNT_DENY = §caus
FLAG_TNT_ONLY_TB = §7Kein §eBaurahmen
FLAG_DAMAGE_ALLOW = §aan
FLAG_DAMAGE_DENY = §caus
FLAG_COLOR_WHITE = §fWeiß
FLAG_COLOR_ORANGE = §fOrange
FLAG_COLOR_MAGENTA = §fMagenta
FLAG_COLOR_LIGHT_BLUE = §fHellblau
FLAG_COLOR_YELLOW = §fGelb
FLAG_COLOR_LIME = §fHellgrün
FLAG_COLOR_PINK = §fPink
FLAG_COLOR_GRAY = §fGrau
FLAG_COLOR_LIGHT_GRAY = §fHellgrau
FLAG_COLOR_CYAN = §fCyan
FLAG_COLOR_PURPLE = §fLila
FLAG_COLOR_BLUE = §fBlau
FLAG_COLOR_BROWN = §fBraun
FLAG_COLOR_GREEN = §fGrün
FLAG_COLOR_RED = §fRot
FLAG_COLOR_BLACK = §fSchwarz
# Region
REGION_TYPE_NORMAL = Normal
REGION_TYPE_BUILD = Baubereich

Datei anzeigen

@ -1,5 +1,6 @@
package de.steamwar.bausystem.features.world;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.loader.Loader;
import de.steamwar.bausystem.features.tpslimit.TPSLimitUtils;
import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils;
@ -10,6 +11,7 @@ import de.steamwar.bausystem.region.GlobalRegion;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.core.TPSWatcher;
import de.steamwar.message.Message;
import de.steamwar.scoreboard.SWScoreboard;
import de.steamwar.scoreboard.ScoreboardCallback;
import org.bukkit.entity.Player;
@ -53,12 +55,13 @@ public class BauScoreboard implements Listener {
strings.add("§eRegion§8: §7" + region.getDisplayName());
}
strings.add("§2");
strings.add("§eTNT§8: " + region.get(Flag.TNT).getChatValue());
strings.add("§eFreeze§8: " + region.get(Flag.FREEZE).getChatValue());
strings.add("§eFire§8: " + region.get(Flag.FIRE).getChatValue());
if (region.getFloorLevel() != 0) {
strings.add("§eProtect§8: " + region.get(Flag.PROTECT).getChatValue());
for (Flag flag : Flag.getFlags()) {
if (!flag.getRegionPredicate().test(region)) {
continue;
}
strings.add("§e" + BauSystem.MESSAGE.parse(flag.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(flag).getChatValue(), p));
}
strings.add("§eTrace§8: " + RecordStateMachine.getRecordStatus().getName());
Loader loader = Loader.getLoader(p);
strings.add("§eLoader§8: " + (loader != null ? ("§a" + loader.getStage().getChatValue()) : "§caus"));

Datei anzeigen

@ -19,9 +19,11 @@
package de.steamwar.bausystem.region.flags;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.flagvalues.*;
import java.util.EnumSet;
import java.util.Set;
import java.util.function.Predicate;
import de.steamwar.bausystem.shared.EnumDisplay;
import lombok.Getter;
@ -29,12 +31,12 @@ import lombok.Getter;
@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),
DAMAGE("FLAG_DAMAGE", DamageMode.class, DamageMode.ALLOW),
FREEZE("FLAG_FREEZE", FreezeMode.class, FreezeMode.INACTIVE),
PROTECT("FLAG_PROTECT", ProtectMode.class, ProtectMode.INACTIVE);
COLOR("FLAG_COLOR", ColorMode.class, ColorMode.YELLOW, region -> false),
TNT("FLAG_TNT", TNTMode.class, TNTMode.ONLY_TB, region -> true),
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);
@Getter
private static final Set<Flag> flags;
@ -47,20 +49,20 @@ public enum Flag implements EnumDisplay {
private final Class<? extends Value<?>> valueType;
private final Flag.Value<?> defaultValue;
private final Value<?>[] values;
private final Predicate<Region> regionPredicate;
<T extends Enum<T> & Value<T>> Flag(String chatValue, final Class<? extends Value<T>> valueType, final Flag.Value<T> defaultValue) {
<T extends Enum<T> & Value<T>> Flag(String chatValue, final Class<? extends Value<T>> valueType, final Flag.Value<T> defaultValue, Predicate<Region> regionPredicate) {
this.chatValue = chatValue;
this.valueType = valueType;
this.defaultValue = defaultValue;
this.values = defaultValue.getValues();
this.regionPredicate = regionPredicate;
}
public Value<?> getFlagValueOf(final String name) {
return this.defaultValue.getValueOf(name);
}
@Override
public String toString() {
return this.name().toLowerCase();

Datei anzeigen

@ -47,7 +47,7 @@ public enum ColorMode implements Flag.Value<ColorMode> {
private static ColorMode[] values;
private final Color color;
private final String chatValue = name();
private final String chatValue = "FLAG_COLOR_" + name();
@Override
public ColorMode[] getValues() {