package common.packet;

import java.io.IOException;

import common.network.IClientPlayer;
import common.network.Packet;
import common.network.PacketBuffer;

public class SPacketDisconnect implements Packet<IClientPlayer> {
	private String message;

	public SPacketDisconnect() {
	}

	public SPacketDisconnect(String message) {
		this.message = message;
	}

	public void readPacketData(PacketBuffer buf) throws IOException {
		this.message = buf.readString(2048);
	}

	public void writePacketData(PacketBuffer buf) throws IOException {
		buf.writeString(this.message);
	}

	public void processPacket(IClientPlayer handler) {
		handler.handleDisconnect(this);
	}

	public String getMessage() {
		return this.message;
	}
}
