package me.nallar.tickthreading.minecraft.commands;

import java.util.List;

import me.nallar.tickthreading.minecraft.TickThreading;
import me.nallar.tickthreading.util.TableFormatter;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;

public class TicksCommand extends Command {
	public static String name = "ticks";

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

	@Override
	public boolean canCommandSenderUseCommand(ICommandSender commandSender) {
		return !TickThreading.instance.requireOpForTicksCommand || super.canCommandSenderUseCommand(commandSender);
	}

	@Override
	public void processCommand(ICommandSender commandSender, List<String> arguments) {
		World world = null;
		if (!arguments.isEmpty()) {
			world = DimensionManager.getWorld(Integer.valueOf(arguments.get(0)));
		} else if (commandSender instanceof Entity) {
			world = ((Entity) commandSender).worldObj;
		}
		if (world == null) {
			sendChat(commandSender, "Usage: /ticks [dimensionid]");
			return;
		}
		sendChat(commandSender, String.valueOf(TickThreading.instance.getManager(world).writeDetailedStats(new TableFormatter(commandSender))));
	}
}

@@ -863,24 +863,35 @@
 Empty()) %7B%0D%0A
+%09%09%09try %7B%0D%0A%09
 %09%09%09world = D
@@ -952,16 +952,55 @@
 (0)));%0D%0A
+%09%09%09%7D catch(Exception ignored) %7B%0D%0A%09%09%09%7D%0D%0A
 %09%09%7D else

Fix error on /ticks command with invalid parameters.