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(); + } }