    001package net.minecraft.client.mco;
    002
    003import argo.jdom.JdomParser;
    004import argo.jdom.JsonNode;
    005import argo.saj.InvalidSyntaxException;
    006import cpw.mods.fml.relauncher.Side;
    007import cpw.mods.fml.relauncher.SideOnly;
    008import java.io.UnsupportedEncodingException;
    009import java.net.URLDecoder;
    010import java.util.ArrayList;
    011import java.util.Iterator;
    012import java.util.List;
    013import net.minecraft.util.ValueObject;
    014
    015@SideOnly(Side.CLIENT)
    016public class McoServer extends ValueObject
    017{
    018    public long field_96408_a;
    019    public String field_96406_b;
    020    public String field_96407_c;
    021    public String field_96404_d;
    022    public String field_96405_e;
    023    public List field_96402_f;
    024    public String field_96403_g;
    025    public boolean field_98166_h;
    026    public int field_96415_h;
    027    public String field_96413_j = "";
    028    public String field_96414_k = "";
    029    public boolean field_96411_l;
    030    public boolean field_102022_m = false;
    031    public long field_96412_m;
    032    private String field_96409_n = null;
    033    private String field_96410_o = null;
    034
    035    public String func_96397_a()
    036    {
    037        if (this.field_96409_n == null)
    038        {
    039            try
    040            {
    041                this.field_96409_n = URLDecoder.decode(this.field_96407_c, "UTF-8");
    042            }
    043            catch (UnsupportedEncodingException unsupportedencodingexception)
    044            {
    045                this.field_96409_n = this.field_96407_c;
    046            }
    047        }
    048
    049        return this.field_96409_n;
    050    }
    051
    052    public String func_96398_b()
    053    {
    054        if (this.field_96410_o == null)
    055        {
    056            try
    057            {
    058                this.field_96410_o = URLDecoder.decode(this.field_96406_b, "UTF-8");
    059            }
    060            catch (UnsupportedEncodingException unsupportedencodingexception)
    061            {
    062                this.field_96410_o = this.field_96406_b;
    063            }
    064        }
    065
    066        return this.field_96410_o;
    067    }
    068
    069    public void func_96399_a(String par1Str)
    070    {
    071        this.field_96406_b = par1Str;
    072        this.field_96410_o = null;
    073    }
    074
    075    public void func_96400_b(String par1Str)
    076    {
    077        this.field_96407_c = par1Str;
    078        this.field_96409_n = null;
    079    }
    080
    081    public void func_96401_a(McoServer par1McoServer)
    082    {
    083        this.field_96414_k = par1McoServer.field_96414_k;
    084        this.field_96413_j = par1McoServer.field_96413_j;
    085        this.field_96412_m = par1McoServer.field_96412_m;
    086        this.field_96411_l = par1McoServer.field_96411_l;
    087        this.field_96415_h = par1McoServer.field_96415_h;
    088        this.field_102022_m = true;
    089    }
    090
    091    public static McoServer func_98163_a(JsonNode par0JsonNode)
    092    {
    093        McoServer mcoserver = new McoServer();
    094
    095        try
    096        {
    097            mcoserver.field_96408_a = Long.parseLong(par0JsonNode.getNumberValue(new Object[] {"id"}));
    098            mcoserver.field_96406_b = par0JsonNode.getStringValue(new Object[] {"name"});
    099            mcoserver.field_96407_c = par0JsonNode.getStringValue(new Object[] {"motd"});
    100            mcoserver.field_96404_d = par0JsonNode.getStringValue(new Object[] {"state"});
    101            mcoserver.field_96405_e = par0JsonNode.getStringValue(new Object[] {"owner"});
    102
    103            if (par0JsonNode.isArrayNode(new Object[] {"invited"}))
    104            {
    105                mcoserver.field_96402_f = func_98164_a(par0JsonNode.getArrayNode(new Object[] {"invited"}));
    106            }
    107            else
    108            {
    109                mcoserver.field_96402_f = new ArrayList();
    110            }
    111
    112            mcoserver.field_96403_g = par0JsonNode.getStringValue(new Object[] {"ip"});
    113            mcoserver.field_98166_h = par0JsonNode.getBooleanValue(new Object[] {"expired"}).booleanValue();
    114        }
    115        catch (IllegalArgumentException illegalargumentexception)
    116        {
    117            ;
    118        }
    119
    120        return mcoserver;
    121    }
    122
    123    private static List func_98164_a(List par0List)
    124    {
    125        ArrayList arraylist = new ArrayList();
    126        Iterator iterator = par0List.iterator();
    127
    128        while (iterator.hasNext())
    129        {
    130            JsonNode jsonnode = (JsonNode)iterator.next();
    131            arraylist.add(jsonnode.getStringValue(new Object[0]));
    132        }
    133
    134        return arraylist;
    135    }
    136
    137    public static McoServer func_98165_c(String par0Str)
    138    {
    139        McoServer mcoserver = new McoServer();
    140
    141        try
    142        {
    143            mcoserver = func_98163_a((new JdomParser()).parse(par0Str));
    144        }
    145        catch (InvalidSyntaxException invalidsyntaxexception)
    146        {
    147            ;
    148        }
    149
    150        return mcoserver;
    151    }
    152}