    001package net.minecraft.util;
    002
    003import java.util.ArrayList;
    004import java.util.Collection;
    005import java.util.HashMap;
    006import java.util.Map;
    007import java.util.regex.Pattern;
    008
    009public enum EnumChatFormatting
    010{
    011    BLACK('0'),
    012    DARK_BLUE('1'),
    013    DARK_GREEN('2'),
    014    DARK_AQUA('3'),
    015    DARK_RED('4'),
    016    DARK_PURPLE('5'),
    017    GOLD('6'),
    018    GRAY('7'),
    019    DARK_GRAY('8'),
    020    BLUE('9'),
    021    GREEN('a'),
    022    AQUA('b'),
    023    RED('c'),
    024    LIGHT_PURPLE('d'),
    025    YELLOW('e'),
    026    WHITE('f'),
    027    OBFUSCATED('k', true),
    028    BOLD('l', true),
    029    STRIKETHROUGH('m', true),
    030    UNDERLINE('n', true),
    031    ITALIC('o', true),
    032    RESET('r');
    033    private static final Map field_96321_w = new HashMap();
    034    private static final Map field_96331_x = new HashMap();
    035    private static final Pattern field_96330_y = Pattern.compile("(?i)" + String.valueOf('\u00a7') + "[0-9A-FK-OR]");
    036    private final char field_96329_z;
    037    private final boolean field_96303_A;
    038    private final String field_96304_B;
    039
    040    private EnumChatFormatting(char par3)
    041    {
    042        this(par3, false);
    043    }
    044
    045    private EnumChatFormatting(char par3, boolean par4)
    046    {
    047        this.field_96329_z = par3;
    048        this.field_96303_A = par4;
    049        this.field_96304_B = "\u00a7" + par3;
    050    }
    051
    052    public char func_96298_a()
    053    {
    054        return this.field_96329_z;
    055    }
    056
    057    public boolean func_96301_b()
    058    {
    059        return this.field_96303_A;
    060    }
    061
    062    public boolean func_96302_c()
    063    {
    064        return !this.field_96303_A && this != RESET;
    065    }
    066
    067    public String func_96297_d()
    068    {
    069        return this.name().toLowerCase();
    070    }
    071
    072    public String toString()
    073    {
    074        return this.field_96304_B;
    075    }
    076
    077    public static EnumChatFormatting func_96300_b(String par0Str)
    078    {
    079        return par0Str == null ? null : (EnumChatFormatting)field_96331_x.get(par0Str.toLowerCase());
    080    }
    081
    082    public static Collection func_96296_a(boolean par0, boolean par1)
    083    {
    084        ArrayList arraylist = new ArrayList();
    085        EnumChatFormatting[] aenumchatformatting = values();
    086        int i = aenumchatformatting.length;
    087
    088        for (int j = 0; j < i; ++j)
    089        {
    090            EnumChatFormatting enumchatformatting = aenumchatformatting[j];
    091
    092            if ((!enumchatformatting.func_96302_c() || par0) && (!enumchatformatting.func_96301_b() || par1))
    093            {
    094                arraylist.add(enumchatformatting.func_96297_d());
    095            }
    096        }
    097
    098        return arraylist;
    099    }
    100
    101    static {
    102        EnumChatFormatting[] var0 = values();
    103        int var1 = var0.length;
    104
    105        for (int var2 = 0; var2 < var1; ++var2)
    106        {
    107            EnumChatFormatting var3 = var0[var2];
    108            field_96321_w.put(Character.valueOf(var3.func_96298_a()), var3);
    109            field_96331_x.put(var3.func_96297_d(), var3);
    110        }
    111    }
    112}