001    package net.minecraft.src;
002    
003    import cpw.mods.fml.common.Side;
004    import cpw.mods.fml.common.asm.SideOnly;
005    
006    @SideOnly(Side.CLIENT)
007    public class ServerData
008    {
009        public String serverName;
010        public String serverIP;
011    
012        /**
013         * the string indicating number of players on and capacity of the server that is shown on the server browser (i.e.
014         * "5/20" meaning 5 slots used out of 20 slots total)
015         */
016        public String populationInfo;
017    
018        /**
019         * (better variable name would be 'hostname') server name as displayed in the server browser's second line (grey
020         * text)
021         */
022        public String serverMOTD;
023    
024        /** last server ping that showed up in the server browser */
025        public long pingToServer;
026        public int field_82821_f = 47;
027    
028        /** Game version for this server. */
029        public String gameVersion = "1.4.2";
030        public boolean field_78841_f = false;
031        private boolean field_78842_g = true;
032        private boolean acceptsTextures = false;
033    
034        /** Whether to hide the IP address for this server. */
035        private boolean hideAddress = false;
036    
037        public ServerData(String par1Str, String par2Str)
038        {
039            this.serverName = par1Str;
040            this.serverIP = par2Str;
041        }
042    
043        /**
044         * Returns an NBTTagCompound with the server's name, IP and maybe acceptTextures.
045         */
046        public NBTTagCompound getNBTCompound()
047        {
048            NBTTagCompound var1 = new NBTTagCompound();
049            var1.setString("name", this.serverName);
050            var1.setString("ip", this.serverIP);
051            var1.setBoolean("hideAddress", this.hideAddress);
052    
053            if (!this.field_78842_g)
054            {
055                var1.setBoolean("acceptTextures", this.acceptsTextures);
056            }
057    
058            return var1;
059        }
060    
061        public boolean getAcceptsTextures()
062        {
063            return this.acceptsTextures;
064        }
065    
066        public boolean func_78840_c()
067        {
068            return this.field_78842_g;
069        }
070    
071        public void setAcceptsTextures(boolean par1)
072        {
073            this.acceptsTextures = par1;
074            this.field_78842_g = false;
075        }
076    
077        public boolean func_82820_d()
078        {
079            return this.hideAddress;
080        }
081    
082        public void func_82819_b(boolean par1)
083        {
084            this.hideAddress = par1;
085        }
086    
087        /**
088         * Takes an NBTTagCompound with 'name' and 'ip' keys, returns a ServerData instance.
089         */
090        public static ServerData getServerDataFromNBTCompound(NBTTagCompound par0NBTTagCompound)
091        {
092            ServerData var1 = new ServerData(par0NBTTagCompound.getString("name"), par0NBTTagCompound.getString("ip"));
093            var1.hideAddress = par0NBTTagCompound.getBoolean("hideAddress");
094    
095            if (par0NBTTagCompound.hasKey("acceptTextures"))
096            {
097                var1.setAcceptsTextures(par0NBTTagCompound.getBoolean("acceptTextures"));
098            }
099    
100            return var1;
101        }
102    }