From 85d532f28548584df8123f9875ed1926df43b34d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 7 May 2021 21:49:14 +0200 Subject: [PATCH] Add BauScoreboard color chinanigans --- BauSystem_Main/src/BauSystem.properties | 32 ++++++++++--------- .../features/world/BauScoreboard.java | 19 ++++++----- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 6be4c686..de598c96 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -45,22 +45,24 @@ FLAG_TNT_ONLY_TB = §7Kein §eBaurahmen FLAG_DAMAGE_ALLOW = §aan FLAG_DAMAGE_DENY = §caus -FLAG_COLOR_WHITE = §7Weiß -FLAG_COLOR_ORANGE = §7Orange -FLAG_COLOR_MAGENTA = §7Magenta -FLAG_COLOR_LIGHT_BLUE = §7Hellblau -FLAG_COLOR_YELLOW = §7Gelb -FLAG_COLOR_LIME = §7Hellgrün -FLAG_COLOR_PINK = §7Pink -FLAG_COLOR_GRAY = §7Grau +FLAG_COLOR_WHITE = §fWeiß +FLAG_COLOR_ORANGE = §6Orange +FLAG_COLOR_MAGENTA = §dMagenta +FLAG_COLOR_LIGHT_BLUE = §bHellblau +FLAG_COLOR_YELLOW = §eGelb +FLAG_COLOR_LIME = §aHellgrün +## This cannot be converted +FLAG_COLOR_PINK = §ePink +FLAG_COLOR_GRAY = §8Grau FLAG_COLOR_LIGHT_GRAY = §7Hellgrau -FLAG_COLOR_CYAN = §7Cyan -FLAG_COLOR_PURPLE = §7Lila -FLAG_COLOR_BLUE = §7Blau -FLAG_COLOR_BROWN = §7Braun -FLAG_COLOR_GREEN = §7Grün -FLAG_COLOR_RED = §7Rot -FLAG_COLOR_BLACK = §7Schwarz +FLAG_COLOR_CYAN = §3Cyan +FLAG_COLOR_PURPLE = §5Lila +FLAG_COLOR_BLUE = §1Blau +## This cannot be converted +FLAG_COLOR_BROWN = §eBraun +FLAG_COLOR_GREEN = §2Grün +FLAG_COLOR_RED = §cRot +FLAG_COLOR_BLACK = §0Schwarz # Region REGION_TYPE_NORMAL = Normal 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 8aaa42bc..7b66cdcb 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java @@ -47,11 +47,13 @@ public class BauScoreboard implements Listener { private HashMap sidebar(Player p) { Region region = Region.getRegion(p.getLocation()); + String colorCode = BauSystem.MESSAGE.parse(region.get(Flag.COLOR).getChatValue(), p).substring(0, 2); + List strings = new ArrayList<>(); strings.add("§1"); - strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TIME", p) + "§8: §7" + new SimpleDateFormat(BauSystem.MESSAGE.parse("TIME", p)).format(Calendar.getInstance().getTime())); + strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TIME", p) + "§8: §7" + new SimpleDateFormat(BauSystem.MESSAGE.parse("TIME", p)).format(Calendar.getInstance().getTime())); if (GlobalRegion.getInstance() != region) { - strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_REGION", p) + "§8: §7" + region.getDisplayName()); + strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_REGION", p) + "§8: §7" + region.getDisplayName()); } strings.add("§2"); @@ -59,22 +61,23 @@ public class BauScoreboard implements Listener { if (!flag.getRegionPredicate().test(region)) { continue; } - strings.add("§e" + BauSystem.MESSAGE.parse(flag.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(flag).getChatValue(), p)); + String message = BauSystem.MESSAGE.parse(region.get(flag).getChatValue(), p).replace("§e", colorCode); + strings.add(colorCode + BauSystem.MESSAGE.parse(flag.getChatValue(), p) + "§8: " + message); } strings.add("§3"); - strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + BauSystem.MESSAGE.parse(RecordStateMachine.getRecordStatus().getName(), p)); + strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + BauSystem.MESSAGE.parse(RecordStateMachine.getRecordStatus().getName(), p)); Loader loader = Loader.getLoader(p); - strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_LOADER", p) + "§8: " + BauSystem.MESSAGE.parse(loader != null ? loader.getStage().getChatValue() : "LOADER_OFF", p)); + strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_LOADER", p) + "§8: " + BauSystem.MESSAGE.parse(loader != null ? loader.getStage().getChatValue() : "LOADER_OFF", p)); if (RecordStateMachine.getRecordStatus().isTracing()) { strings.add("§4"); - strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TICKS", p) + "§8: §7" + traceTicks()); - strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TNT_COUNT", p) + "§8: §7" + RecordStateMachine.size()); + strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TICKS", p) + "§8: §7" + traceTicks()); + strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TNT_COUNT", p) + "§8: §7" + RecordStateMachine.size()); } strings.add("§5"); - strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8 " + tpsColor() + TPSWarpUtils.getTps(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit()); + strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8 " + tpsColor() + TPSWarpUtils.getTps(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit()); int i = strings.size(); HashMap result = new HashMap<>();