package me.nallar.tickthreading.minecraft.commands;

import java.util.List;

import me.nallar.tickthreading.minecraft.TickManager;
import me.nallar.tickthreading.minecraft.TickThreading;
import me.nallar.tickthreading.util.TableFormatter;
import me.nallar.tickthreading.util.VersionUtil;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;

public class TPSCommand extends Command {
	public static String name = "tps";

	@Override
	public String getCommandName() {
		return name;
	}

	@Override
	public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender) {
		return true;
	}

	@Override
	public void processCommand(ICommandSender commandSender, List<String> arguments) {
		TableFormatter tf = new TableFormatter(commandSender);
		StringBuilder tpsReport = tf.sb;
		tpsReport.append(VersionUtil.versionString()).append('\n');
		tf
				.heading("World")
				.heading("TPS")
				.heading("Entities")
				.heading("Tiles")
				.heading("Chunks")
				.heading("Load");
		for (TickManager tickManager : TickThreading.instance.getManagers()) {
			tickManager.writeStats(tf);
		}
		tf.finishTable();
		float usedTime = MinecraftServer.getTickTime();
		tpsReport.append("\nUsed time per tick: ").append(usedTime).append("ms")
				.append("\nOverall TPS: ").append(MinecraftServer.getTPS())
				.append("\nOverall load: ").append(usedTime * 2).append('%');
		sendChat(commandSender, tpsReport.toString());
	}
}

@@ -1247,71 +1247,8 @@
 port
-.append(%22%5CnUsed time per tick: %22).append(usedTime).append(%22ms%22)
 %0D%0A%09%09

Remove duplicate data from /tps, used time tells no more than overall load.