// Path: scripting/core/ScriptCore.java
// public static final class State implements Comparable<State> {
// 	public final String script;
// 	public final boolean running;
// 		
// 	public State(String script, boolean running) {
// 		this.script = script;
// 		this.running = running;
// 	}
// 
// 	@Override
// 	public int compareTo(State obj) {
// 		return this.script.compareTo(obj.script);
// 	}
// }
// 
// Path: scripting/network/ScriptPacketHandler.java
// public abstract class ScriptPacketHandler {
// 
// 	public abstract void handleSelection(SelectionPacket pkt, EntityPlayer player);
// 	public abstract void handleHasScripts(HasScriptsPacket pkt, EntityPlayer player);
// 	public abstract void handleState(StatePacket pkt, EntityPlayer player);
// 
// 	public abstract void handleSettings(SettingsPacket pkt, EntityPlayer player);
// 
// 	public abstract void handleEntityNBT(EntityNBTPacket pkt, EntityPlayer player);
// 	public abstract void handleTileNBT(TileNBTPacket pkt, EntityPlayer player);
// 
// 	public abstract void handleCloseGUI(CloseGUIPacket pkt, EntityPlayer player);
// 	public abstract void handleRequest(PacketType type, String info, EntityPlayer player);
// 
// 	protected abstract boolean hasPermission(EntityPlayer player);
// 
// 	public final void handlePacket(ScriptPacket packet, EntityPlayer player) {
// 		if (hasPermission(player))
// 			packet.execute(this, player);
// 	}
// }


import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import scripting.core.ScriptCore.State;
import scripting.network.ScriptPacketHandler;
package scripting.packet;




public class StatePacket extends ScriptPacket {
	
	public State[] states;

	@Override
	public ScriptPacket readData(Object... data) {
		states = (State[]) data[0];
		return this;
	}
	
	@Override
	public void encodeInto(ChannelHandlerContext ctx, ByteBuf to) throws IOException {
		to.writeInt(states.length);
		for (State s : states) {
			writeString(s.script, to);
			to.writeBoolean(s.running);
		}
	}

	@Override
	public void decodeFrom(ChannelHandlerContext ctx, ByteBuf from) throws IOException { 
		states = new State[from.readInt()];
		for (int i = 0; i < states.length; ++i)
			states[i] = new State(readString(from), from.readBoolean());
	}
	
	@Override
// Path: scripting/core/ScriptCore.java
// public static final class State implements Comparable<State> {
// 	public final String script;
// 	public final boolean running;
// 		
// 	public State(String script, boolean running) {
// 		this.script = script;
// 		this.running = running;
// 	}
// 
// 	@Override
// 	public int compareTo(State obj) {
// 		return this.script.compareTo(obj.script);
// 	}
// }
// 
// Path: scripting/network/ScriptPacketHandler.java
// public abstract class ScriptPacketHandler {
// 
// 	public abstract void handleSelection(SelectionPacket pkt, EntityPlayer player);
// 	public abstract void handleHasScripts(HasScriptsPacket pkt, EntityPlayer player);
// 	public abstract void handleState(StatePacket pkt, EntityPlayer player);
// 
// 	public abstract void handleSettings(SettingsPacket pkt, EntityPlayer player);
// 
// 	public abstract void handleEntityNBT(EntityNBTPacket pkt, EntityPlayer player);
// 	public abstract void handleTileNBT(TileNBTPacket pkt, EntityPlayer player);
// 
// 	public abstract void handleCloseGUI(CloseGUIPacket pkt, EntityPlayer player);
// 	public abstract void handleRequest(PacketType type, String info, EntityPlayer player);
// 
// 	protected abstract boolean hasPermission(EntityPlayer player);
// 
// 	public final void handlePacket(ScriptPacket packet, EntityPlayer player) {
// 		if (hasPermission(player))
// 			packet.execute(this, player);
// 	}
// }


// Path: scripting/packet/StatePacket.java
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import scripting.core.ScriptCore.State;
import scripting.network.ScriptPacketHandler;

package scripting.packet;




public class StatePacket extends ScriptPacket {
	
	public State[] states;

	@Override
	public ScriptPacket readData(Object... data) {
		states = (State[]) data[0];
		return this;
	}
	
	@Override
	public void encodeInto(ChannelHandlerContext ctx, ByteBuf to) throws IOException {
		to.writeInt(states.length);
		for (State s : states) {
			writeString(s.script, to);
			to.writeBoolean(s.running);
		}
	}

	@Override
	public void decodeFrom(ChannelHandlerContext ctx, ByteBuf from) throws IOException { 
		states = new State[from.readInt()];
		for (int i = 0; i < states.length; ++i)
			states[i] = new State(readString(from), from.readBoolean());
	}
	
	@Override
	public void execute(ScriptPacketHandler handler, EntityPlayer player) {