Add BauScoreboard multilingual Flags
Dieser Commit ist enthalten in:
Ursprung
d24e1f2c4d
Commit
daabe26f13
@ -13,6 +13,7 @@ PERMISSION_CHANGE_OTHER_DISABLE = §cDu kannst nun nicht mehr auf der Welt von
|
|||||||
FLAG_COLOR = Color
|
FLAG_COLOR = Color
|
||||||
FLAG_TNT = TNT
|
FLAG_TNT = TNT
|
||||||
FLAG_FIRE = Fire
|
FLAG_FIRE = Fire
|
||||||
|
FLAG_DAMAGE = Damage
|
||||||
FLAG_FREEZE = Freeze
|
FLAG_FREEZE = Freeze
|
||||||
FLAG_PROTECT = Protect
|
FLAG_PROTECT = Protect
|
||||||
|
|
||||||
@ -29,6 +30,26 @@ FLAG_TNT_ALLOW = §aan
|
|||||||
FLAG_TNT_DENY = §caus
|
FLAG_TNT_DENY = §caus
|
||||||
FLAG_TNT_ONLY_TB = §7Kein §eBaurahmen
|
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
|
||||||
REGION_TYPE_NORMAL = Normal
|
REGION_TYPE_NORMAL = Normal
|
||||||
REGION_TYPE_BUILD = Baubereich
|
REGION_TYPE_BUILD = Baubereich
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package de.steamwar.bausystem.features.world;
|
package de.steamwar.bausystem.features.world;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.features.loader.Loader;
|
import de.steamwar.bausystem.features.loader.Loader;
|
||||||
import de.steamwar.bausystem.features.tpslimit.TPSLimitUtils;
|
import de.steamwar.bausystem.features.tpslimit.TPSLimitUtils;
|
||||||
import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils;
|
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.Region;
|
||||||
import de.steamwar.bausystem.region.flags.Flag;
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
import de.steamwar.core.TPSWatcher;
|
import de.steamwar.core.TPSWatcher;
|
||||||
|
import de.steamwar.message.Message;
|
||||||
import de.steamwar.scoreboard.SWScoreboard;
|
import de.steamwar.scoreboard.SWScoreboard;
|
||||||
import de.steamwar.scoreboard.ScoreboardCallback;
|
import de.steamwar.scoreboard.ScoreboardCallback;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -53,12 +55,13 @@ public class BauScoreboard implements Listener {
|
|||||||
strings.add("§eRegion§8: §7" + region.getDisplayName());
|
strings.add("§eRegion§8: §7" + region.getDisplayName());
|
||||||
}
|
}
|
||||||
strings.add("§2");
|
strings.add("§2");
|
||||||
strings.add("§eTNT§8: " + region.get(Flag.TNT).getChatValue());
|
for (Flag flag : Flag.getFlags()) {
|
||||||
strings.add("§eFreeze§8: " + region.get(Flag.FREEZE).getChatValue());
|
if (!flag.getRegionPredicate().test(region)) {
|
||||||
strings.add("§eFire§8: " + region.get(Flag.FIRE).getChatValue());
|
continue;
|
||||||
if (region.getFloorLevel() != 0) {
|
|
||||||
strings.add("§eProtect§8: " + region.get(Flag.PROTECT).getChatValue());
|
|
||||||
}
|
}
|
||||||
|
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());
|
strings.add("§eTrace§8: " + RecordStateMachine.getRecordStatus().getName());
|
||||||
Loader loader = Loader.getLoader(p);
|
Loader loader = Loader.getLoader(p);
|
||||||
strings.add("§eLoader§8: " + (loader != null ? ("§a" + loader.getStage().getChatValue()) : "§caus"));
|
strings.add("§eLoader§8: " + (loader != null ? ("§a" + loader.getStage().getChatValue()) : "§caus"));
|
||||||
|
@ -19,9 +19,11 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.region.flags;
|
package de.steamwar.bausystem.region.flags;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.region.flags.flagvalues.*;
|
import de.steamwar.bausystem.region.flags.flagvalues.*;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import de.steamwar.bausystem.shared.EnumDisplay;
|
import de.steamwar.bausystem.shared.EnumDisplay;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@ -29,12 +31,12 @@ import lombok.Getter;
|
|||||||
@Getter
|
@Getter
|
||||||
public enum Flag implements EnumDisplay {
|
public enum Flag implements EnumDisplay {
|
||||||
|
|
||||||
COLOR("FLAG_COLOR", ColorMode.class, ColorMode.YELLOW),
|
COLOR("FLAG_COLOR", ColorMode.class, ColorMode.YELLOW, region -> false),
|
||||||
TNT("FLAG_TNT", TNTMode.class, TNTMode.ONLY_TB),
|
TNT("FLAG_TNT", TNTMode.class, TNTMode.ONLY_TB, region -> true),
|
||||||
FIRE("FLAG_FIRE", FireMode.class, FireMode.ALLOW),
|
FIRE("FLAG_FIRE", FireMode.class, FireMode.ALLOW, region -> true),
|
||||||
DAMAGE("FLAG_DAMAGE", DamageMode.class, DamageMode.ALLOW),
|
DAMAGE("FLAG_DAMAGE", DamageMode.class, DamageMode.ALLOW, region -> false),
|
||||||
FREEZE("FLAG_FREEZE", FreezeMode.class, FreezeMode.INACTIVE),
|
FREEZE("FLAG_FREEZE", FreezeMode.class, FreezeMode.INACTIVE, region -> true),
|
||||||
PROTECT("FLAG_PROTECT", ProtectMode.class, ProtectMode.INACTIVE);
|
PROTECT("FLAG_PROTECT", ProtectMode.class, ProtectMode.INACTIVE, region -> region.getFloorLevel() != 0);
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static final Set<Flag> flags;
|
private static final Set<Flag> flags;
|
||||||
@ -47,20 +49,20 @@ public enum Flag implements EnumDisplay {
|
|||||||
private final Class<? extends Value<?>> valueType;
|
private final Class<? extends Value<?>> valueType;
|
||||||
private final Flag.Value<?> defaultValue;
|
private final Flag.Value<?> defaultValue;
|
||||||
private final Value<?>[] values;
|
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.chatValue = chatValue;
|
||||||
this.valueType = valueType;
|
this.valueType = valueType;
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
this.values = defaultValue.getValues();
|
this.values = defaultValue.getValues();
|
||||||
|
this.regionPredicate = regionPredicate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Value<?> getFlagValueOf(final String name) {
|
public Value<?> getFlagValueOf(final String name) {
|
||||||
return this.defaultValue.getValueOf(name);
|
return this.defaultValue.getValueOf(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.name().toLowerCase();
|
return this.name().toLowerCase();
|
||||||
|
@ -47,7 +47,7 @@ public enum ColorMode implements Flag.Value<ColorMode> {
|
|||||||
private static ColorMode[] values;
|
private static ColorMode[] values;
|
||||||
private final Color color;
|
private final Color color;
|
||||||
|
|
||||||
private final String chatValue = name();
|
private final String chatValue = "FLAG_COLOR_" + name();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ColorMode[] getValues() {
|
public ColorMode[] getValues() {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren