From 179632cd21744890f10c05a7e52c65fae6c7fb27 Mon Sep 17 00:00:00 2001 From: jojo Date: Sun, 15 Nov 2020 13:54:00 +0100 Subject: [PATCH] Fix BauScoreboard --- .../bausystem/world/BauScoreboard.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/BauScoreboard.java b/BauSystem_Main/src/de/steamwar/bausystem/world/BauScoreboard.java index 3c05bdd..117a4ee 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/BauScoreboard.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/BauScoreboard.java @@ -73,11 +73,7 @@ public class BauScoreboard implements Listener { } strings.add("§4"); - if (CommandTPSLimiter.getCurrentTPSLimit() == 20) { - strings.add("§eTPS§8: §7" + TPSWatcher.getTPS()); - } else { - strings.add("§eTPS§8: §7" + TPSWatcher.getTPS() + "§8/§7" + CommandTPSLimiter.getCurrentTPSLimit()); - } + strings.add("§eTPS§8: " + tpsColor() + TPSWatcher.getTPS() + tpsLimit()); int i = strings.size(); HashMap result = new HashMap<>(); @@ -89,4 +85,22 @@ public class BauScoreboard implements Listener { private long traceTicks() { return (System.currentTimeMillis() - TNTRecorder.recordStart) / 50; } + + private String tpsColor() { + double tps = TPSWatcher.getTPS(); + if (tps > CommandTPSLimiter.getCurrentTPSLimit() * 0.9) { + return "§a"; + } + if (tps > CommandTPSLimiter.getCurrentTPSLimit() * 0.5) { + return "§e"; + } + return "§c"; + } + + private String tpsLimit() { + if (CommandTPSLimiter.getCurrentTPSLimit() == 20) { + return ""; + } + return "§8/§7" + CommandTPSLimiter.getCurrentTPSLimit(); + } }