    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import java.net.SocketAddress;
    006    import net.minecraft.server.MinecraftServer;
    007
    008    @SideOnly(Side.CLIENT)
    009    public class IntegratedPlayerList extends ServerConfigurationManager
    010    {
    011        private NBTTagCompound tagsForLastWrittenPlayer = null;
    012
    013        public IntegratedPlayerList(IntegratedServer par1IntegratedServer)
    014        {
    015            super(par1IntegratedServer);
    016            this.viewDistance = 10;
    017        }
    018
    019        /**
    020         * also stores the NBTTags if this is an intergratedPlayerList
    021         */
    022        protected void writePlayerData(EntityPlayerMP par1EntityPlayerMP)
    023        {
    024            if (par1EntityPlayerMP.getCommandSenderName().equals(this.getIntegratedServer().getServerOwner()))
    025            {
    026                this.tagsForLastWrittenPlayer = new NBTTagCompound();
    027                par1EntityPlayerMP.writeToNBT(this.tagsForLastWrittenPlayer);
    028            }
    029
    030            super.writePlayerData(par1EntityPlayerMP);
    031        }
    032
    033        /**
    034         * checks ban-lists, then white-lists, then space for the server. Returns null on success, or an error message
    035         */
    036        public String allowUserToConnect(SocketAddress par1SocketAddress, String par2Str)
    037        {
    038            return par2Str.equalsIgnoreCase(this.getIntegratedServer().getServerOwner()) ? "That name is already taken." : super.allowUserToConnect(par1SocketAddress, par2Str);
    039        }
    040
    041        /**
    042         * get the associated Integrated Server
    043         */
    044        public IntegratedServer getIntegratedServer()
    045        {
    046            return (IntegratedServer)super.getServerInstance();
    047        }
    048
    049        /**
    050         * gets the tags created in the last writePlayerData call
    051         */
    052        public NBTTagCompound getTagsFromLastWrite()
    053        {
    054            return this.tagsForLastWrittenPlayer;
    055        }
    056
    057        public MinecraftServer getServerInstance()
    058        {
    059            return this.getIntegratedServer();
    060        }
    061    }