package com.forgeessentials.chat.command;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.PlayerNotFoundException;
import net.minecraft.command.WrongUsageException;
import net.minecraft.command.server.CommandMessage;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.IChatComponent;
import com.forgeessentials.chat.ModuleChat;
public class CommandMessageReplacement extends CommandMessage
{
@Override
public void processCommand(ICommandSender sender, String[] args)
{
if (args.length < 2)
{
throw new WrongUsageException("commands.message.usage");
}
else
{
EntityPlayerMP target = getPlayer(sender, args[0]);
if (target == null)
{
throw new PlayerNotFoundException();
}
else if (target == sender)
{
throw new PlayerNotFoundException("commands.message.sameTarget");
}
else
{
IChatComponent message = func_147176_a(sender, args, 1, !(sender instanceof EntityPlayer));
ModuleChat.tell(sender, message, target);
}
}
}
}