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