summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/ForwardAttribute.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/scape/ForwardAttribute.java')
-rw-r--r--NET/worlds/scape/ForwardAttribute.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/NET/worlds/scape/ForwardAttribute.java b/NET/worlds/scape/ForwardAttribute.java
new file mode 100644
index 0000000..fd2a830
--- /dev/null
+++ b/NET/worlds/scape/ForwardAttribute.java
@@ -0,0 +1,61 @@
+package NET.worlds.scape;
+
+import NET.worlds.core.Std;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+public class ForwardAttribute extends Attribute implements NonPersister {
+ private Attribute _from;
+
+ ForwardAttribute(Attribute forwarder, int attrID) {
+ super(attrID);
+ this._from = forwarder;
+ }
+
+ @Override
+ protected void noteAddingTo(SuperRoot owner) {
+ WObject w = (WObject)owner.getOwner();
+ if ((w.getSharer().getMode() & 1) != 0) {
+ throw new ClassCastException("Must forward to unforwarded object");
+ }
+ }
+
+ @Override
+ public void detach() {
+ super.detach();
+ this._from.unforward();
+ }
+
+ @Override
+ public int getFlags() {
+ return this._from.getFlags();
+ }
+
+ @Override
+ public void setFlag(int flag, boolean onoff) {
+ this._from.setFlag(flag, onoff);
+ }
+
+ @Override
+ public void generateNetData(DataOutputStream s) throws IOException {
+ this._from.generateNetData(s);
+ }
+
+ @Override
+ public void setFromNetData(DataInputStream ds, int len) throws IOException {
+ this._from.setFromNetData(ds, len);
+ ValueEvent e = new ValueEvent(Std.getFastTime(), this._from.getOwner(), (WObject)this._from.getOwner().getOwner(), this._from);
+ this._from.trigger(e);
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + "[forwarded from " + this._from.getName() + "]";
+ }
+
+ @Override
+ public void restoreState(Restorer r) throws IOException, TooNewException {
+ assert false;
+ }
+}