/*
 * SilentLib - ChatHelper
 * Copyright (C) 2018 SilentChaos512
 *
 * This library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package net.silentchaos512.lib.util;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;

public class ChatHelper {
    /**
     * Creates a {@link TextComponentString} and sends it to the player's chat log.
     * <em>Use with care:</em> if this is called on the server, the player may not receive text in
     * their local language.
     *
     * @param message The raw string passed to {@link TextComponentString}
     */
    public static void sendMessage(EntityPlayer player, String message) {
        player.sendMessage(new TextComponentString(message));
    }

    public static void sendMessage(EntityPlayer player, ITextComponent component) {
        player.sendMessage(component);
    }

    /**
     * Creates a {@link TextComponentString} and sends it to the player's action bar or chat log.
     * <em>Use with care:</em> if this is called on the server, the player may not receive text in
     * their local language.
     *
     * @param message   The raw string passed to {@link TextComponentString}
     * @param actionBar If true, sends to action bar, chat log otherwise
     */
    public static void sendStatusMessage(EntityPlayer player, String message, boolean actionBar) {
        player.sendStatusMessage(new TextComponentString(message), actionBar);
    }

    /**
     * Sends the {@link ITextComponent} to the player's action bar or chat log. Not recommended, use
     * {@link #translate(EntityPlayer, String, boolean)} instead.
     *
     * @param component The text component.
     * @param actionBar If true, sends to action bar, chat log otherwise
     */
    public static void sendStatusMessage(EntityPlayer player, ITextComponent component, boolean actionBar) {
        player.sendStatusMessage(component, actionBar);
    }

    /**
     * Creates a {@link TextComponentTranslation} and sends a message to the player's chat log.
     *
     * @param translationKey Translation key that the client will translate
     * @since 2.3.13
     */
    public static void translate(EntityPlayer player, String translationKey) {
        sendMessage(player, new TextComponentTranslation(translationKey));
    }

    /**
     * Creates a {@link TextComponentTranslation} and sends a message to the player's action bar or
     * chat log.
     *
     * @param translationKey Translation key that the client will translate
     * @param actionBar      If true, sends to action bar, chat log otherwise
     * @since 2.3.13
     */
    public static void translate(EntityPlayer player, String translationKey, boolean actionBar) {
        sendStatusMessage(player, new TextComponentTranslation(translationKey), actionBar);
    }
}

@@ -2998,32 +2998,477 @@
 onKey));%0A    %7D%0A%0A
+    /**%0A     * Creates a %7B@link TextComponentTranslation%7D and sends a message to the player's chat log.%0A     *%0A     * @param translationKey Translation key that the client will translate%0A     * @param args           Format arguments%0A     * @since 2.3.17%0A     */%0A    public static void translate(EntityPlayer player, String translationKey, Object... args) %7B%0A        sendMessage(player, new TextComponentTranslation(translationKey, args));%0A    %7D%0A%0A
     /**%0A     * C
@@ -3790,32 +3790,38 @@
 c void translate
+Status
 (EntityPlayer pl
@@ -3967,11 +3967,597 @@
 );%0A    %7D
+%0A%0A    /**%0A     * Creates a %7B@link TextComponentTranslation%7D and sends a message to the player's action bar or%0A     * chat log.%0A     *%0A     * @param translationKey Translation key that the client will translate%0A     * @param actionBar      If true, sends to action bar, chat log otherwise%0A     * @param args           Format arguments%0A     * @since 2.3.17%0A     */%0A    public static void translateStatus(EntityPlayer player, String translationKey, boolean actionBar, Object... args) %7B%0A        sendStatusMessage(player, new TextComponentTranslation(translationKey, args), actionBar);%0A    %7D
 %0A%7D%0A

Improve ChatHelper translate methods