We want to use Math.min, not max to cap displayed TPS to 20

This commit is contained in:
md_5 2014-01-26 11:04:55 +11:00
parent 71255cf140
commit 14c0d5cba9

View File

@ -1,4 +1,4 @@
From cb15a8dc8cee18a4d5b6a8ce3ccbbf28dfd0c65c Mon Sep 17 00:00:00 2001 From 21c8405f31d7d07ddd80fad5950ef608936a492c Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net> From: md_5 <git@md-5.net>
Date: Sat, 25 Jan 2014 14:08:35 +1100 Date: Sat, 25 Jan 2014 14:08:35 +1100
Subject: [PATCH] Highly Optimized Tick Loop Subject: [PATCH] Highly Optimized Tick Loop
@ -108,7 +108,7 @@ index 205249e..6634292 100755
} }
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
new file mode 100644 new file mode 100644
index 0000000..36363ee index 0000000..a101b52
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java +++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
@ -143,7 +143,7 @@ index 0000000..36363ee
+ StringBuilder sb = new StringBuilder( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " ); + StringBuilder sb = new StringBuilder( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " );
+ for ( double tps : MinecraftServer.getServer().recentTps ) + for ( double tps : MinecraftServer.getServer().recentTps )
+ { + {
+ sb.append( format( Math.max( tps, 20.0 ) ) ); + sb.append( format( Math.min( tps, 20.0 ) ) );
+ sb.append( ", " ); + sb.append( ", " );
+ } + }
+ sender.sendMessage( sb.substring( 0, sb.length() - 2 ) ); + sender.sendMessage( sb.substring( 0, sb.length() - 2 ) );