    001package net.minecraft.server.gui;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import java.util.Vector;
    006import javax.swing.JList;
    007import net.minecraft.entity.player.EntityPlayerMP;
    008import net.minecraft.server.MinecraftServer;
    009
    010@SideOnly(Side.SERVER)
    011public class PlayerListBox extends JList implements IUpdatePlayerListBox
    012{
    013    /** Reference to the MinecraftServer object. */
    014    private MinecraftServer mcServer;
    015
    016    /** Counts the number of updates. */
    017    private int updateCounter = 0;
    018
    019    public PlayerListBox(MinecraftServer par1MinecraftServer)
    020    {
    021        this.mcServer = par1MinecraftServer;
    022        par1MinecraftServer.func_82010_a(this);
    023    }
    024
    025    /**
    026     * Updates the JList with a new model.
    027     */
    028    public void update()
    029    {
    030        if (this.updateCounter++ % 20 == 0)
    031        {
    032            Vector var1 = new Vector();
    033
    034            for (int var2 = 0; var2 < this.mcServer.getConfigurationManager().playerEntityList.size(); ++var2)
    035            {
    036                var1.add(((EntityPlayerMP)this.mcServer.getConfigurationManager().playerEntityList.get(var2)).username);
    037            }
    038
    039            this.setListData(var1);
    040        }
    041    }
    042}