diff options
| author | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
| commit | c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch) | |
| tree | df9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/network/OldPropertyList.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/network/OldPropertyList.java')
| -rw-r--r-- | NET/worlds/network/OldPropertyList.java | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/NET/worlds/network/OldPropertyList.java b/NET/worlds/network/OldPropertyList.java new file mode 100644 index 0000000..5cb254e --- /dev/null +++ b/NET/worlds/network/OldPropertyList.java @@ -0,0 +1,75 @@ +package NET.worlds.network; + +import java.io.IOException; +import java.util.Vector; + +public class OldPropertyList { + private Vector<netProperty> _propList = new Vector<netProperty>(); + + public void addProperty(netProperty prop) { + assert this.getProperty(prop.property()) == null; + + this._propList.addElement(prop); + } + + public int size() { + return this._propList.size(); + } + + public final netProperty elementAt(int i) { + return this._propList.elementAt(i); + } + + public netProperty getProperty(int propID) { + for (int i = this._propList.size() - 1; i >= 0; i--) { + if (this.elementAt(i).property() == propID) { + return this.elementAt(i); + } + } + + return null; + } + + void parseNetData(ServerInputStream data) throws IOException { + this._propList = new Vector<netProperty>(); + + while (!data.isEmpty()) { + netProperty tmpProp = new netProperty(); + tmpProp.parseNetData(data); + this._propList.addElement(tmpProp); + } + } + + int packetSize() { + int len = 0; + + for (int i = this._propList.size() - 1; i >= 0; i--) { + netProperty tmpProp = this._propList.elementAt(i); + len += tmpProp.packetSize(); + } + + return len; + } + + void send(ServerOutputStream o) throws IOException { + int maxidx = this._propList.size(); + + for (int i = 0; i < maxidx; i++) { + netProperty tmpProp = this._propList.elementAt(i); + tmpProp.send(o); + } + } + + @Override + public String toString() { + String out = "("; + int maxidx = this._propList.size(); + + for (int i = 0; i < maxidx; i++) { + netProperty tmpProp = this._propList.elementAt(i); + out = out + tmpProp + " "; + } + + return out + ")"; + } +} |