diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index b0dddcee..3ff66bb6 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -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 diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java index 2e9fe6c3..d56ce65f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java @@ -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")); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java b/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java index 96f9ed5a..ca45eca0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java @@ -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 flags; @@ -47,20 +49,20 @@ public enum Flag implements EnumDisplay { private final Class> valueType; private final Flag.Value defaultValue; private final Value[] values; + private final Predicate regionPredicate; - & Value> Flag(String chatValue, final Class> valueType, final Flag.Value defaultValue) { + & Value> Flag(String chatValue, final Class> valueType, final Flag.Value defaultValue, Predicate 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(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/flags/flagvalues/ColorMode.java b/BauSystem_Main/src/de/steamwar/bausystem/region/flags/flagvalues/ColorMode.java index f37ba21a..846bd9fe 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/flags/flagvalues/ColorMode.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/flags/flagvalues/ColorMode.java @@ -47,7 +47,7 @@ public enum ColorMode implements Flag.Value { private static ColorMode[] values; private final Color color; - private final String chatValue = name(); + private final String chatValue = "FLAG_COLOR_" + name(); @Override public ColorMode[] getValues() {