package common.packet;

import java.io.IOException;

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

public class SPacketUpdateHealth implements Packet<IClientPlayer> {
	private int health;

	public SPacketUpdateHealth() {
	}

	public SPacketUpdateHealth(int health) {
		this.health = health;
	}

	public void readPacketData(PacketBuffer buf) throws IOException {
		this.health = buf.readInt();
	}

	public void writePacketData(PacketBuffer buf) throws IOException {
		buf.writeInt(this.health);
	}

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

	public int getHealth() {
		return this.health;
	}
}
