From dea1fa0651b8d0b6b5a2282e59cb615d66faa209 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 19 Apr 2021 19:57:11 +0200 Subject: [PATCH] Add EnumDisplay Add Loader.Stage.chatValue --- .../bausystem/features/loader/Loader.java | 16 +++++++++++----- .../bausystem/features/world/BauScoreboard.java | 2 +- .../de/steamwar/bausystem/region/flags/Flag.java | 6 +++--- .../steamwar/bausystem/shared/EnumDisplay.java | 5 +++++ 4 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/shared/EnumDisplay.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java index bc3d26e1..e3f28435 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java @@ -25,7 +25,9 @@ import de.steamwar.bausystem.config.ColorConfig; import de.steamwar.bausystem.features.loader.activations.AbstractLoaderActivation; import de.steamwar.bausystem.features.loader.activations.BlockPlaceLoaderActivation; import de.steamwar.bausystem.features.loader.activations.InteractionActivation; +import de.steamwar.bausystem.shared.EnumDisplay; import lombok.AccessLevel; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -204,10 +206,14 @@ public class Loader implements Listener { stop(); } - public enum Stage { - SETUP, - RUNNING, - PAUSE, - END + @AllArgsConstructor + public enum Stage implements EnumDisplay { + SETUP("§esetup"), + RUNNING("§arunning"), + PAUSE("§7pause"), + END("§8finished"); + + @Getter + private String chatValue; } } 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 1c9ee224..5c5651e4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java @@ -58,7 +58,7 @@ public class BauScoreboard implements Listener { strings.add("§eFire§8: " + region.get(Flag.FIRE).getChatValue()); strings.add("§eTrace§8: " + RecordStateMachine.getRecordStatus().getName()); Loader loader = Loader.getLoader(p); - strings.add("§eLoader§8: " + (loader != null ? ("§a" + loader.getStage().name().toLowerCase()) : "§caus")); + strings.add("§eLoader§8: " + (loader != null ? ("§a" + loader.getStage().getChatValue()) : "§caus")); if (region.getFloorLevel() != 0) { strings.add("§eProtect§8: " + region.get(Flag.PROTECT).getChatValue()); } 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 65dd981e..6e6ba124 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java @@ -22,6 +22,8 @@ package de.steamwar.bausystem.region.flags; import de.steamwar.bausystem.region.flags.flagvalues.*; import java.util.EnumSet; import java.util.Set; + +import de.steamwar.bausystem.shared.EnumDisplay; import lombok.Getter; @Getter @@ -59,7 +61,7 @@ public enum Flag { return this.name().toLowerCase(); } - public interface Value & Value> { + public interface Value & Value> extends EnumDisplay { T getValue(); @@ -67,8 +69,6 @@ public enum Flag { T[] getValues(); - String getChatValue(); - default String getName() { return this.getValue().name().toLowerCase(); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/shared/EnumDisplay.java b/BauSystem_Main/src/de/steamwar/bausystem/shared/EnumDisplay.java new file mode 100644 index 00000000..b9cf839c --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/shared/EnumDisplay.java @@ -0,0 +1,5 @@ +package de.steamwar.bausystem.shared; + +public interface EnumDisplay { + String getChatValue(); +}