001    package net.minecraft.network.packet;
002    
003    import java.io.DataInputStream;
004    import java.io.DataOutputStream;
005    import java.io.IOException;
006    
007    public class Packet255KickDisconnect extends Packet
008    {
009        /** Displayed to the client when the connection terminates. */
010        public String reason;
011    
012        public Packet255KickDisconnect() {}
013    
014        public Packet255KickDisconnect(String par1Str)
015        {
016            this.reason = par1Str;
017        }
018    
019        /**
020         * Abstract. Reads the raw packet data from the data stream.
021         */
022        public void readPacketData(DataInputStream par1DataInputStream) throws IOException
023        {
024            this.reason = readString(par1DataInputStream, 256);
025        }
026    
027        /**
028         * Abstract. Writes the raw packet data to the data stream.
029         */
030        public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
031        {
032            writeString(this.reason, par1DataOutputStream);
033        }
034    
035        /**
036         * Passes this Packet on to the NetHandler for processing.
037         */
038        public void processPacket(NetHandler par1NetHandler)
039        {
040            par1NetHandler.handleKickDisconnect(this);
041        }
042    
043        /**
044         * Abstract. Return the size of the packet (not counting the header).
045         */
046        public int getPacketSize()
047        {
048            return this.reason.length();
049        }
050    
051        /**
052         * only false for the abstract Packet class, all real packets return true
053         */
054        public boolean isRealPacket()
055        {
056            return true;
057        }
058    
059        /**
060         * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet
061         * class
062         */
063        public boolean containsSameEntityIDAs(Packet par1Packet)
064        {
065            return true;
066        }
067    }