    001package net.minecraft.client.multiplayer;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import java.net.InetAddress;
    006import java.util.ArrayList;
    007import java.util.Collections;
    008import java.util.Iterator;
    009import java.util.List;
    010
    011@SideOnly(Side.CLIENT)
    012public class LanServerList
    013{
    014    private ArrayList listOfLanServers = new ArrayList();
    015    boolean wasUpdated;
    016
    017    public synchronized boolean getWasUpdated()
    018    {
    019        return this.wasUpdated;
    020    }
    021
    022    public synchronized void setWasNotUpdated()
    023    {
    024        this.wasUpdated = false;
    025    }
    026
    027    public synchronized List getLanServers()
    028    {
    029        return Collections.unmodifiableList(this.listOfLanServers);
    030    }
    031
    032    public synchronized void func_77551_a(String par1Str, InetAddress par2InetAddress)
    033    {
    034        String var3 = ThreadLanServerPing.getMotdFromPingResponse(par1Str);
    035        String var4 = ThreadLanServerPing.getAdFromPingResponse(par1Str);
    036
    037        if (var4 != null)
    038        {
    039            int var5 = var4.indexOf(58);
    040
    041            if (var5 > 0)
    042            {
    043                var4 = par2InetAddress.getHostAddress() + var4.substring(var5);
    044            }
    045
    046            boolean var6 = false;
    047            Iterator var7 = this.listOfLanServers.iterator();
    048
    049            while (var7.hasNext())
    050            {
    051                LanServer var8 = (LanServer)var7.next();
    052
    053                if (var8.getServerIpPort().equals(var4))
    054                {
    055                    var8.updateLastSeen();
    056                    var6 = true;
    057                    break;
    058                }
    059            }
    060
    061            if (!var6)
    062            {
    063                this.listOfLanServers.add(new LanServer(var3, var4));
    064                this.wasUpdated = true;
    065            }
    066        }
    067    }
    068}