SteamWar/BauSystem2.0
Archiviert
12
0

Add BauScoreboard color chinanigans

Dieser Commit ist enthalten in:
yoyosource 2021-05-07 21:49:14 +02:00
Ursprung af49ec96d0
Commit 85d532f285
2 geänderte Dateien mit 28 neuen und 23 gelöschten Zeilen

Datei anzeigen

@ -45,22 +45,24 @@ FLAG_TNT_ONLY_TB = §7Kein §eBaurahmen
FLAG_DAMAGE_ALLOW = §aan FLAG_DAMAGE_ALLOW = §aan
FLAG_DAMAGE_DENY = §caus FLAG_DAMAGE_DENY = §caus
FLAG_COLOR_WHITE = §7Weiß FLAG_COLOR_WHITE = §fWeiß
FLAG_COLOR_ORANGE = §7Orange FLAG_COLOR_ORANGE = §6Orange
FLAG_COLOR_MAGENTA = §7Magenta FLAG_COLOR_MAGENTA = §dMagenta
FLAG_COLOR_LIGHT_BLUE = §7Hellblau FLAG_COLOR_LIGHT_BLUE = §bHellblau
FLAG_COLOR_YELLOW = §7Gelb FLAG_COLOR_YELLOW = §eGelb
FLAG_COLOR_LIME = §7Hellgrün FLAG_COLOR_LIME = §aHellgrün
FLAG_COLOR_PINK = §7Pink ## This cannot be converted
FLAG_COLOR_GRAY = §7Grau FLAG_COLOR_PINK = §ePink
FLAG_COLOR_GRAY = §8Grau
FLAG_COLOR_LIGHT_GRAY = §7Hellgrau FLAG_COLOR_LIGHT_GRAY = §7Hellgrau
FLAG_COLOR_CYAN = §7Cyan FLAG_COLOR_CYAN = §3Cyan
FLAG_COLOR_PURPLE = §7Lila FLAG_COLOR_PURPLE = §5Lila
FLAG_COLOR_BLUE = §7Blau FLAG_COLOR_BLUE = §1Blau
FLAG_COLOR_BROWN = §7Braun ## This cannot be converted
FLAG_COLOR_GREEN = §7Grün FLAG_COLOR_BROWN = §eBraun
FLAG_COLOR_RED = §7Rot FLAG_COLOR_GREEN = §2Grün
FLAG_COLOR_BLACK = §7Schwarz FLAG_COLOR_RED = §cRot
FLAG_COLOR_BLACK = §0Schwarz
# Region # Region
REGION_TYPE_NORMAL = Normal REGION_TYPE_NORMAL = Normal

Datei anzeigen

@ -47,11 +47,13 @@ public class BauScoreboard implements Listener {
private HashMap<String, Integer> sidebar(Player p) { private HashMap<String, Integer> sidebar(Player p) {
Region region = Region.getRegion(p.getLocation()); Region region = Region.getRegion(p.getLocation());
String colorCode = BauSystem.MESSAGE.parse(region.get(Flag.COLOR).getChatValue(), p).substring(0, 2);
List<String> strings = new ArrayList<>(); List<String> strings = new ArrayList<>();
strings.add("§1"); 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) { 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"); strings.add("§2");
@ -59,22 +61,23 @@ public class BauScoreboard implements Listener {
if (!flag.getRegionPredicate().test(region)) { if (!flag.getRegionPredicate().test(region)) {
continue; 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("§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); 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()) { if (RecordStateMachine.getRecordStatus().isTracing()) {
strings.add("§4"); strings.add("§4");
strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TICKS", p) + "§8: §7" + traceTicks()); strings.add(colorCode + 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_TNT_COUNT", p) + "§8: §7" + RecordStateMachine.size());
} }
strings.add("§5"); 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(); int i = strings.size();
HashMap<String, Integer> result = new HashMap<>(); HashMap<String, Integer> result = new HashMap<>();