Fix double comparison issues.

This commit is contained in:
md_5 2014-01-25 16:18:32 +11:00
parent 53f2f7499c
commit 3d6f241c12

View file

@ -1,4 +1,4 @@
From ad6ccb8e038d440644721c1d4e586875230ad444 Mon Sep 17 00:00:00 2001 From cb15a8dc8cee18a4d5b6a8ce3ccbbf28dfd0c65c 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..0f73608 index 0000000..36363ee
--- /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..0f73608
+ 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 ) ) ); + sb.append( format( Math.max( tps, 20.0 ) ) );
+ sb.append( ", " ); + sb.append( ", " );
+ } + }
+ sender.sendMessage( sb.substring( 0, sb.length() - 2 ) ); + sender.sendMessage( sb.substring( 0, sb.length() - 2 ) );
@ -153,7 +153,7 @@ index 0000000..0f73608
+ +
+ private String format(double tps) + private String format(double tps)
+ { + {
+ return ( ( tps > 18 ) ? ChatColor.GREEN : ( tps > 16 ) ? ChatColor.YELLOW : ChatColor.RED ).toString() + tps; + return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString() + tps;
+ } + }
+} +}
-- --