@@ -0,0 +1,3033 @@
+/*%0A * This file is part of GenericsLib for Bukkit, licensed under the MIT License (MIT).%0A *%0A * Copyright (c) JCThePants (www.jcwhatever.com)%0A *%0A * Permission is hereby granted, free of charge, to any person obtaining a copy%0A * of this software and associated documentation files (the %22Software%22), to deal%0A * in the Software without restriction, including without limitation the rights%0A * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell%0A * copies of the Software, and to permit persons to whom the Software is%0A * furnished to do so, subject to the following conditions:%0A *%0A * The above copyright notice and this permission notice shall be included in%0A * all copies or substantial portions of the Software.%0A *%0A * THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR%0A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,%0A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE%0A * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER%0A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,%0A * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN%0A * THE SOFTWARE.%0A */%0A%0Apackage com.jcwhatever.bukkit.generic.utils.text;%0A%0Aimport com.jcwhatever.bukkit.generic.utils.PreCon;%0A%0Aimport javax.annotation.Nullable;%0A%0A/**%0A * A segment of text that begins with a color/format.%0A */%0Apublic class TextComponent %7B%0A%0A    private final TextColor _textColor;%0A    private final String _text;%0A    private String _formatted;%0A    private int _hash;%0A%0A    /**%0A     * Constructor.%0A     *%0A     * %3Cp%3ENo color/formatting.%3C/p%3E%0A     *%0A     * @param text  The text of the component.%0A     */%0A    public TextComponent(String text) %7B%0A        this(null, text);%0A    %7D%0A%0A    /**%0A     * Constructor.%0A     *%0A     * @param textColor  The text color/format.%0A     * @param text       The text of the component.%0A     */%0A    public TextComponent(@Nullable TextColor textColor, String text) %7B%0A        PreCon.notNull(text);%0A%0A        _textColor = textColor;%0A        _text = text;%0A%0A        _hash = text.hashCode();%0A%0A        if (textColor != null) %7B%0A            _hash %5E= textColor.hashCode();%0A        %7D%0A    %7D%0A%0A    /**%0A     * Get the text color.%0A     */%0A    @Nullable%0A    public TextColor getTextColor() %7B%0A        return _textColor;%0A    %7D%0A%0A    /**%0A     * Get the raw text.%0A     */%0A    public String getText() %7B%0A        return _text;%0A    %7D%0A%0A    /**%0A     * Get the formatted text.%0A     */%0A    public String getFormatted() %7B%0A        if (_formatted == null) %7B%0A            _formatted = %22%22;%0A            if (_textColor != null) %7B%0A                _formatted += _textColor.getColorCode();%0A            %7D%0A            _formatted += TextUtils.format(_text);%0A        %7D%0A%0A        return _formatted;%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        return _hash;%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object obj) %7B%0A        return obj == this;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return getFormatted();%0A    %7D%0A%7D%0A

add TextComponent