// Copyright (c) 2015, Christopher "blay09" Baker
// Some rights reserved.

package net.blay09.mods.eiramoticons;

import net.blay09.mods.eiramoticons.emoticon.EmoticonGroup;
import net.blay09.mods.eiramoticons.emoticon.EmoticonHandler;
import net.blay09.mods.eiramoticons.emoticon.EmoticonRegistry;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.event.ClickEvent;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;

public class CommandEmoticons extends CommandBase {

	@Override
	public String getCommandName() {
		return "emoticons";
	}

	@Override
	public String getCommandUsage(ICommandSender sender) {
		return "/emoticons reload";
	}

	@Override
	public int getRequiredPermissionLevel() {
		return 0;
	}

	@Override
	public void processCommand(ICommandSender sender, String[] args) {
		if(args.length != 1) {
			throw new WrongUsageException(getCommandUsage(sender));
		}
		if(args[0].equals("reload")) {
			EmoticonConfig.hardReload();
			EmoticonRegistry.reloadEmoticons();
		} else if(args[0].equals("help")) {
			IChatComponent linkComponent = new ChatComponentTranslation("eiramoticons:command.help.clickHere");
			linkComponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://blay09.net/?page_id=347"));
			linkComponent.getChatStyle().setColor(EnumChatFormatting.GOLD);
			linkComponent.getChatStyle().setBold(true);
			linkComponent.getChatStyle().setUnderlined(true);
			sender.addChatMessage(new ChatComponentTranslation("eiramoticons:command.help", linkComponent));
		} else if(args[0].equals("list")) {
			for(EmoticonGroup group : EmoticonRegistry.getGroups()) {
				sender.addChatMessage(group.listComponent);
			}
		} else {
			throw new WrongUsageException(getCommandUsage(sender));
		}
	}

}

@@ -293,16 +293,118 @@
 gistry;%0A
+import net.blay09.mods.eiramoticons.gui.GuiEiraMoticonsConfig;%0Aimport net.minecraft.client.Minecraft;%0A
 import n
@@ -757,16 +757,68 @@
 onent;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 public c
@@ -1027,16 +1027,33 @@
 s reload
+%7Chelp%7Clist%7Cconfig
 %22;%0A%09%7D%0A%0A%09
@@ -1973,16 +1973,17 @@
 %7B%0A%09%09%09for
+ 
 (Emotico
@@ -2095,75 +2095,481 @@
 lse 
-%7B%0A%09%09%09throw new WrongUsageException(getCommandUsage(sender));%0A%09%09%7D%0A%09%7D%0A
+if(args%5B0%5D.equals(%22config%22)) %7B%0A%09%09%09Minecraft.getMinecraft().displayGuiScreen(new GuiEiraMoticonsConfig(null));%0A%09%09%7D else %7B%0A%09%09%09throw new WrongUsageException(getCommandUsage(sender));%0A%09%09%7D%0A%09%7D%0A%0A%09@Override%0A%09public List addTabCompletionOptions(ICommandSender sender, String%5B%5D args) %7B%0A%09%09if(args.length == 0) %7B%0A%09%09%09List%3CString%3E list = new ArrayList%3CString%3E();%0A%09%09%09list.add(%22reload%22);%0A%09%09%09list.add(%22help%22);%0A%09%09%09list.add(%22list%22);%0A%09%09%09list.add(%22config%22);%0A%09%09%09return list;%0A%09%09%7D%0A%09%09return null;%0A%09%7D
 %0A%7D%0A

Add /emoticons config command.