// 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/wrapper/settings/Setting.java
// public abstract class Setting {
// 	
// 	public String display;
// 	
// 	protected Setting() { }
// 	
// 	public Setting(String display) {
// 		this.display = display;
// 	}
// 	
// 	public abstract Object getValue();
// 	
// 	protected void write(DataOutput out) throws IOException {
// 		out.writeUTF(display);
// 	}
// 	
// 	protected Setting read(DataInput in) throws IOException {
// 		display = in.readUTF();
// 		return this;
// 	}
// 	
// 	public static Setting readSetting(DataInput in) throws IOException {
// 		switch(in.readByte()) {
// 		case 0: return new SettingBoolean().read(in);
// 		case 1: return new SettingInt().read(in);
// 		case 2: return new SettingFloat().read(in);
// 		case 3: return new SettingString().read(in);
// 		case 4: return new SettingList().read(in);
// 		case 5: return new SettingBlock().read(in);
// 		case 6: return new SettingItem().read(in);
// 		default: return null;
// 		}
// 	}
// 	
// 	public static void write(Setting setting, DataOutput out) throws IOException {
// 		if (setting == null) 
// 			return;
// 		if (setting instanceof SettingBoolean) 
// 			out.write(0);
// 		if (setting instanceof SettingInt) 
// 			out.write(1);
// 		if (setting instanceof SettingFloat) 
// 			out.write(2);
// 		if (setting instanceof SettingString) 
// 			out.write(3);
// 		if (setting instanceof SettingList)
// 			out.write(4);
// 		if (setting instanceof SettingBlock)
// 			out.write(5);
// 		if (setting instanceof SettingItem)
// 			out.write(6);
// 		setting.write(out);
// 	}
// 	
// 	/**
// 	 * Helper method for filters
// 	 */
// 	public static Setting[] toArray(Setting... settings) {
// 		return settings;
// 	}
// 	
// }


import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
import io.netty.buffer.ByteBufOutputStream;
import io.netty.channel.ChannelHandlerContext;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import scripting.network.ScriptPacketHandler;
import scripting.wrapper.settings.Setting;
package scripting.packet;




public class SettingsPacket extends ScriptPacket {

	public String script;
	public Setting[] settings;

	@Override
	public ScriptPacket readData(Object... data) {
		script = (String) data[0];
		settings = (Setting[]) data[1];
		return this;
	}
	
	@Override
	public void encodeInto(ChannelHandlerContext ctx, ByteBuf to) throws IOException {
		ByteBufOutputStream bos = new ByteBufOutputStream(to);
		bos.writeUTF(script);
		bos.writeInt(settings.length);
		for (Setting s : settings)
			Setting.write(s, bos);
	}

	@Override
	public void decodeFrom(ChannelHandlerContext ctx, ByteBuf from) throws IOException { 
		ByteBufInputStream bis = new ByteBufInputStream(from);
		script = bis.readUTF();
		settings = new Setting[bis.readInt()];
		for (int i = 0; i < settings.length; ++i)
			settings[i] = Setting.readSetting(bis);
	}

	@Override
// 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/wrapper/settings/Setting.java
// public abstract class Setting {
// 	
// 	public String display;
// 	
// 	protected Setting() { }
// 	
// 	public Setting(String display) {
// 		this.display = display;
// 	}
// 	
// 	public abstract Object getValue();
// 	
// 	protected void write(DataOutput out) throws IOException {
// 		out.writeUTF(display);
// 	}
// 	
// 	protected Setting read(DataInput in) throws IOException {
// 		display = in.readUTF();
// 		return this;
// 	}
// 	
// 	public static Setting readSetting(DataInput in) throws IOException {
// 		switch(in.readByte()) {
// 		case 0: return new SettingBoolean().read(in);
// 		case 1: return new SettingInt().read(in);
// 		case 2: return new SettingFloat().read(in);
// 		case 3: return new SettingString().read(in);
// 		case 4: return new SettingList().read(in);
// 		case 5: return new SettingBlock().read(in);
// 		case 6: return new SettingItem().read(in);
// 		default: return null;
// 		}
// 	}
// 	
// 	public static void write(Setting setting, DataOutput out) throws IOException {
// 		if (setting == null) 
// 			return;
// 		if (setting instanceof SettingBoolean) 
// 			out.write(0);
// 		if (setting instanceof SettingInt) 
// 			out.write(1);
// 		if (setting instanceof SettingFloat) 
// 			out.write(2);
// 		if (setting instanceof SettingString) 
// 			out.write(3);
// 		if (setting instanceof SettingList)
// 			out.write(4);
// 		if (setting instanceof SettingBlock)
// 			out.write(5);
// 		if (setting instanceof SettingItem)
// 			out.write(6);
// 		setting.write(out);
// 	}
// 	
// 	/**
// 	 * Helper method for filters
// 	 */
// 	public static Setting[] toArray(Setting... settings) {
// 		return settings;
// 	}
// 	
// }


// Path: scripting/packet/SettingsPacket.java
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
import io.netty.buffer.ByteBufOutputStream;
import io.netty.channel.ChannelHandlerContext;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import scripting.network.ScriptPacketHandler;
import scripting.wrapper.settings.Setting;

package scripting.packet;




public class SettingsPacket extends ScriptPacket {

	public String script;
	public Setting[] settings;

	@Override
	public ScriptPacket readData(Object... data) {
		script = (String) data[0];
		settings = (Setting[]) data[1];
		return this;
	}
	
	@Override
	public void encodeInto(ChannelHandlerContext ctx, ByteBuf to) throws IOException {
		ByteBufOutputStream bos = new ByteBufOutputStream(to);
		bos.writeUTF(script);
		bos.writeInt(settings.length);
		for (Setting s : settings)
			Setting.write(s, bos);
	}

	@Override
	public void decodeFrom(ChannelHandlerContext ctx, ByteBuf from) throws IOException { 
		ByteBufInputStream bis = new ByteBufInputStream(from);
		script = bis.readUTF();
		settings = new Setting[bis.readInt()];
		for (int i = 0; i < settings.length; ++i)
			settings[i] = Setting.readSetting(bis);
	}

	@Override
	public void execute(ScriptPacketHandler handler, EntityPlayer player) {