diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/bau/InfoCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/bau/InfoCommand.java index dd98229c..eb7a1d33 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/bau/InfoCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/bau/InfoCommand.java @@ -41,9 +41,14 @@ public class InfoCommand extends SWCommand { public void sendBauInfo(Player p) { p.sendMessage(BauSystem.PREFIX + "Besitzer: §e" + SteamwarUser.get(bauServer.getOwnerID()).getUserName()); Region region = Region.getRegion(p.getLocation()); - p.sendMessage(BauSystem.PREFIX + "§eTNT§8: " + region.get(Flag.TNT).getChatValue().toUpperCase() + " §eFire§8: " + region.get(Flag.FIRE).getChatValue().toUpperCase() + " §eFreeze§8: " + region.get(Flag.FREEZE).getChatValue().toUpperCase()); - if (region.getFloorLevel() != 0) { - p.sendMessage(BauSystem.PREFIX + "§eProtect§8: " + region.get(Flag.PROTECT).getChatValue().toUpperCase()); + for (Flag flag : Flag.getFlags()) { + if (flag == Flag.PROTECT && region.getFloorLevel() == 0) { + continue; + } + Flag.Value value = region.get(flag); + if (value != null) { + p.sendMessage(BauSystem.PREFIX + "§e" + flag.getChatValue() + "§8: §7" + value.getChatValue()); + } } List members = BauweltMember.getMembers(bauServer.getOwnerID()); 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 6e6ba124..c56dff91 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java @@ -27,13 +27,13 @@ import de.steamwar.bausystem.shared.EnumDisplay; import lombok.Getter; @Getter -public enum Flag { +public enum Flag implements EnumDisplay { - COLOR(ColorMode.class, ColorMode.YELLOW), - TNT(TNTMode.class, TNTMode.ONLY_TB), - FIRE(FireMode.class, FireMode.ALLOW), - FREEZE(FreezeMode.class, FreezeMode.INACTIVE), - PROTECT(ProtectMode.class, ProtectMode.INACTIVE); + COLOR("Color", ColorMode.class, ColorMode.YELLOW), + TNT("TNT", TNTMode.class, TNTMode.ONLY_TB), + FIRE("Fire", FireMode.class, FireMode.ALLOW), + FREEZE("Freeze", FreezeMode.class, FreezeMode.INACTIVE), + PROTECT("Protect", ProtectMode.class, ProtectMode.INACTIVE); @Getter private static final Set flags; @@ -42,11 +42,13 @@ public enum Flag { flags = EnumSet.allOf(Flag.class); } + private final String chatValue; private final Class> valueType; private final Flag.Value defaultValue; private final Value[] values; - & Value> Flag(final Class> valueType, final Flag.Value defaultValue) { + & Value> Flag(String chatValue, final Class> valueType, final Flag.Value defaultValue) { + this.chatValue = chatValue; this.valueType = valueType; this.defaultValue = defaultValue; this.values = defaultValue.getValues(); @@ -56,11 +58,18 @@ public enum Flag { return this.defaultValue.getValueOf(name); } + + @Override public String toString() { return this.name().toLowerCase(); } + @Override + public String getChatValue() { + return chatValue; + } + public interface Value & Value> extends EnumDisplay { T getValue();