package ch.spacebase.mcprotocol.standard.packet;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import ch.spacebase.mcprotocol.net.Client;
import ch.spacebase.mcprotocol.net.ServerConnection;
import ch.spacebase.mcprotocol.packet.Packet;
import ch.spacebase.mcprotocol.util.IOUtils;

public class PacketUpdateScoreboard extends Packet {

	public String item;
	public byte action;
	public String scoreboard;
	public int value;

	public PacketUpdateScoreboard() {
	}

	public PacketUpdateScoreboard(String item, byte action, String scoreboard, int value) {
		this.item = item;
		this.action = action;
		this.scoreboard = scoreboard;
		this.value = value;
	}

	@Override
	public void read(DataInputStream in) throws IOException {
		this.item = IOUtils.readString(in);
		this.action = in.readByte();
		this.scoreboard = IOUtils.readString(in);
		this.value = in.readInt();
	}

	@Override
	public void write(DataOutputStream out) throws IOException {
		IOUtils.writeString(out, this.item);
		out.writeByte(this.action);
		IOUtils.writeString(out, this.scoreboard);
		out.writeInt(this.value);
	}

	@Override
	public void handleClient(Client conn) {
	}

	@Override
	public void handleServer(ServerConnection conn) {
	}

	@Override
	public int getId() {
		return 207;
	}

}

@@ -836,16 +836,43 @@
 Byte();%0A
+%09%09if (this.action != 1) %7B%0A%09
 %09%09this.s
@@ -905,24 +905,25 @@
 ring(in);%0A%09%09
+%09
 this.value =
@@ -937,16 +937,20 @@
 dInt();%0A
+%09%09%7D%0A
 %09%7D%0A%0A%09@Ov
@@ -1087,16 +1087,43 @@
 ction);%0A
+%09%09if (this.action != 1) %7B%0A%09
 %09%09IOUtil
@@ -1157,24 +1157,25 @@
 reboard);%0A%09%09
+%09
 out.writeInt
@@ -1188,16 +1188,20 @@
 value);%0A
+%09%09%7D%0A
 %09%7D%0A%0A%09@Ov

Fix packet error