diff --git a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java index 12bc7d776..570348c68 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java @@ -5,6 +5,7 @@ import java.util.HashSet; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -18,6 +19,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; +import net.minecraft.server.v1_8_R3.MinecraftServer; public class LagMeter extends MiniPlugin { @@ -128,9 +130,27 @@ public class LagMeter extends MiniPlugin sendUpdate(player); } } + + private String getPrefix(double value) + { + if (value >= 18.0) + return C.cGreen; + else if (value >= 15) + return C.cYellow; + else + return C.cRed; + } private void sendUpdate(Player player) { + double[] tps = MinecraftServer.getServer().recentTps; + String mcString = ""; + for (int i = 0; i < tps.length; i++) + { + mcString += getPrefix(tps[i]) + (double)Math.round(tps[i] * 100.0D) / 100.0D; + if (i < tps.length - 1) mcString += C.cWhite + ", "; + } + player.sendMessage(" "); player.sendMessage(" "); player.sendMessage(" "); @@ -138,6 +158,8 @@ public class LagMeter extends MiniPlugin player.sendMessage(" "); player.sendMessage(F.main(getName(), ChatColor.GRAY + "Live-------" + ChatColor.YELLOW + String.format("%.00f", _ticksPerSecond))); player.sendMessage(F.main(getName(), ChatColor.GRAY + "Avg--------" + ChatColor.YELLOW + String.format("%.00f", _ticksPerSecondAverage * 20))); + player.sendMessage(F.main(getName(), ChatColor.YELLOW + "MC Timings")); + player.sendMessage(F.main(getName(), ChatColor.GRAY + "5m, 10m, 15m Avg---" + mcString)); player.sendMessage(F.main(getName(), ChatColor.YELLOW + "MEM")); player.sendMessage(F.main(getName(), ChatColor.GRAY + "Free-------" + ChatColor.YELLOW + (Runtime.getRuntime().freeMemory() / 1048576) + "MB")); player.sendMessage(F.main(getName(), ChatColor.GRAY + "Max--------" + ChatColor.YELLOW + (Runtime.getRuntime().maxMemory() / 1048576)) + "MB");