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