diff options
Diffstat (limited to 'NET/worlds/network/PropertySetCmd.java')
| -rw-r--r-- | NET/worlds/network/PropertySetCmd.java | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/NET/worlds/network/PropertySetCmd.java b/NET/worlds/network/PropertySetCmd.java new file mode 100644 index 0000000..50f7850 --- /dev/null +++ b/NET/worlds/network/PropertySetCmd.java @@ -0,0 +1,58 @@ +package NET.worlds.network; + +import java.io.IOException; + +public class PropertySetCmd extends receivedNetPacket { + public static final byte PROPSETCMD = 15; + private PropertyList _propList; + private String _fromUser; + + public PropertySetCmd() { + this._commandType = 15; + } + + public PropertySetCmd(PropertyList propList) { + super(null, 15); + this._propList = propList; + this._fromUser = new String(""); + } + + public PropertySetCmd(ObjID objID, PropertyList propList) { + super(objID, 15); + this._propList = propList; + this._fromUser = new String(""); + } + + @Override + void parseNetData(ServerInputStream data) throws IOException { + this._fromUser = data.readUTF(); + this._propList = new PropertyList(); + this._propList.parseNetData(data); + } + + @Override + int packetSize() { + int len = super.packetSize(); + + assert this._fromUser != null; + + len += 1 + ServerOutputStream.utfLength(this._fromUser); + return len + this._propList.packetSize(); + } + + @Override + void send(ServerOutputStream o) throws IOException { + super.send(o); + o.writeUTF(this._fromUser); + this._propList.send(o); + } + + @Override + void process(WorldServer _serv) throws Exception { + } + + @Override + public String toString(WorldServer serv) { + return "PROPSET \"" + this._fromUser + "\"->" + this._objID.toString(serv) + " " + this._propList; + } +} |