From c320f92ea31017f0ffb9ae3f8ce3c427c7c7b336 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 1 May 2023 12:34:22 +0200 Subject: [PATCH] Update BauScoreboard design Signed-off-by: yoyosource --- BauSystem_Main/src/BauSystem.properties | 7 +++---- BauSystem_Main/src/BauSystem_de.properties | 6 ++++-- .../features/tracer/record/Recorder.java | 4 ++-- .../bausystem/features/world/BauScoreboard.java | 15 +++++++++++---- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 82d131d2..320cd623 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -37,8 +37,8 @@ SCOREBOARD_TPS_FROZEN = §e Frozen SCOREBOARD_TRACE_TICKS = Ticks -SCOREBOARD_TECHHIDER = TechHider -SCOREBOARD_XRAY = XRay +SCOREBOARD_TECHHIDER = TechHider§8: §aOn +SCOREBOARD_XRAY = XRay§8: §aOn # Flags FLAG_COLOR = Color @@ -731,7 +731,7 @@ TPSLIMIT_INVALID_FROZEN = §c and '0' # Trace TRACE_RECORD=§aon -TRACE_IDLE=§coff +TRACE_HAS_TRACES=§ehas Traces TRACE_IDLE_SINGLE=§esingle TRACE_IDLE_AUTO_EXPLODE=§eauto §8(§7explode§8) TRACE_IDLE_AUTO_IGNITE=§eauto §8(§7ignite§8) @@ -787,7 +787,6 @@ TRACE_GUI_POSITION_SOURCE = §7Source§8: §e{0} TRACE_GUI_POSITION_EXPLODED = §7Exploded§8: §e{0} # Loader -LOADER_OFF = §coff LOADER_SETUP = §eSetup LOADER_RUNNING = §aRunning LOADER_SINGLE_SIDEBAR = §aSingle diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index ed657b0d..a4eae658 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -37,6 +37,9 @@ SCOREBOARD_TPS_FROZEN = §e Eingefroren SCOREBOARD_TRACE_TICKS = Ticks +SCOREBOARD_TECHHIDER = TechHider§8: §aAn +SCOREBOARD_XRAY = XRay§8: §aAn + # Flags FLAG_COLOR = Color FLAG_TNT = TNT @@ -701,7 +704,7 @@ TPSLIMIT_INVALID_FROZEN = §c und '0' # Trace TRACE_RECORD=§aan -TRACE_IDLE=§caus +TRACE_HAS_TRACES=§ehat Traces TRACE_IDLE_SINGLE=§esingle TRACE_IDLE_AUTO_EXPLODE=§eauto §8(§7explode§8) TRACE_IDLE_AUTO_IGNITE=§eauto §8(§7ignite§8) @@ -757,7 +760,6 @@ TRACE_GUI_POSITION_SOURCE = §7Ursprung§8: §e{0} TRACE_GUI_POSITION_EXPLODED = §7Explodiert§8: §e{0} # Loader -LOADER_OFF = §caus LOADER_SETUP = §eEinrichtung LOADER_RUNNING = §aLaufend LOADER_SINGLE_SIDEBAR = §aEiner diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java index 5d580005..85d2ef2a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java @@ -49,7 +49,7 @@ public class Recorder implements Listener { INSTANCE = this; } - private static class NoopTraceRecorder implements TraceRecorder { + public static class NoopTraceRecorder implements TraceRecorder { @Override public String scoreboard(Player player) { return null; @@ -82,7 +82,7 @@ public class Recorder implements Listener { private static class DisabledTracerRecorder implements TraceRecorder { @Override public String scoreboard(Player player) { - return BauSystem.MESSAGE.parse("TRACE_IDLE", player); + return null; } @Override 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 2d170bda..eaebc5ed 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java @@ -8,6 +8,7 @@ import de.steamwar.bausystem.features.tpslimit.FreezeUtils; import de.steamwar.bausystem.features.tpslimit.TPSLimitUtils; import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils; import de.steamwar.bausystem.features.tracer.record.Recorder; +import de.steamwar.bausystem.features.tracer.show.StoredRecords; import de.steamwar.bausystem.features.xray.XrayCommand; import de.steamwar.bausystem.region.GlobalRegion; import de.steamwar.bausystem.region.Region; @@ -17,7 +18,6 @@ import de.steamwar.linkage.Linked; import de.steamwar.linkage.LinkedInstance; import de.steamwar.scoreboard.SWScoreboard; import de.steamwar.scoreboard.ScoreboardCallback; -import de.steamwar.techhider.TechHider; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -89,22 +89,29 @@ public class BauScoreboard implements Listener { } strings.add(colorCode + BauSystem.MESSAGE.parse(flag.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(flag).getChatValue(), p).replace("§e", colorCode)); } + strings.add("§3"); + if (TechHiderCommand.isHidden(region, p)) { strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TECHHIDER", p)); } else if (XrayCommand.isHidden(region, p)) { strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_XRAY", p)); } - strings.add("§3"); String traceScore = recorder.get(region).scoreboard(p); if (traceScore != null) { strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + traceScore); + } else if (!(recorder.get(region) instanceof Recorder.NoopTraceRecorder) && !StoredRecords.getRecords(region).isEmpty()) { + strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + BauSystem.MESSAGE.parse("TRACE_HAS_TRACES", p)); } Loader loader = Loader.getLoader(p); - strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_LOADER", p) + "§8: " + BauSystem.MESSAGE.parse(loader != null ? loader.getStage().getChatValue() : "LOADER_OFF", p)); + if (loader != null) { + strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_LOADER", p) + "§8: " + BauSystem.MESSAGE.parse(loader.getStage().getChatValue(), p)); + } - strings.add("§5"); + if (!strings.get(strings.size() - 1).equals("§3")) { + strings.add("§5"); + } if (FreezeUtils.frozen()) { strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + BauSystem.MESSAGE.parse("SCOREBOARD_TPS_FROZEN", p)); } else {