summaryrefslogtreecommitdiff
path: root/NET/worlds/console/AddHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/console/AddHandler.java')
-rw-r--r--NET/worlds/console/AddHandler.java117
1 files changed, 117 insertions, 0 deletions
diff --git a/NET/worlds/console/AddHandler.java b/NET/worlds/console/AddHandler.java
new file mode 100644
index 0000000..4ecc96a
--- /dev/null
+++ b/NET/worlds/console/AddHandler.java
@@ -0,0 +1,117 @@
+/* */ package NET.worlds.console;
+/* */
+/* */ import NET.worlds.scape.BumpEventTemp;
+/* */ import NET.worlds.scape.BumpHandler;
+/* */ import NET.worlds.scape.NoSuchPropertyException;
+/* */ import NET.worlds.scape.Portal;
+/* */ import NET.worlds.scape.Restorer;
+/* */ import NET.worlds.scape.Room;
+/* */ import NET.worlds.scape.Saver;
+/* */ import NET.worlds.scape.SuperRoot;
+/* */ import NET.worlds.scape.TooNewException;
+/* */ import NET.worlds.scape.VectorProperty;
+/* */ import java.io.IOException;
+/* */ import java.util.Enumeration;
+/* */ import java.util.Vector;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class AddHandler
+/* */ extends SuperRoot
+/* */ implements BumpHandler
+/* */ {
+/* 39 */ private Vector<SuperRoot> handlers = new Vector(1);
+/* */
+/* */ public AddHandler() {}
+/* */
+/* */ public AddHandler(SuperRoot newhandler)
+/* */ {
+/* 45 */ this.handlers.addElement(newhandler);
+/* */ }
+/* */
+/* */ public boolean handle(BumpEventTemp e) {
+/* 49 */ Room sc = ((Portal)e.target).farSide().getRoom();
+/* 50 */ assert (((sc instanceof Staircase)) || ((sc instanceof Stair)));
+/* 51 */ Enumeration<SuperRoot> enh = this.handlers.elements();
+/* 52 */ while (enh.hasMoreElements()) {
+/* 53 */ sc.addHandler((SuperRoot)enh.nextElement());
+/* */ }
+/* 55 */ return true;
+/* */ }
+/* */
+/* 58 */ private static Object classCookie = new Object();
+/* */
+/* */ public void saveState(Saver s) throws IOException
+/* */ {
+/* 62 */ s.saveVersion(2, classCookie);
+/* 63 */ super.saveState(s);
+/* 64 */ s.saveVector(this.handlers);
+/* */ }
+/* */
+/* */ public void restoreState(Restorer r) throws IOException, TooNewException
+/* */ {
+/* 69 */ switch (r.restoreVersion(classCookie)) {
+/* */ case 2:
+/* 71 */ super.restoreState(r);
+/* 72 */ this.handlers = r.restoreVectorSuperRoot();
+/* 73 */ break;
+/* */ case 1:
+/* 75 */ super.restoreState(r);
+/* */
+/* */ case 0:
+/* 78 */ if (r.restoreBoolean())
+/* 79 */ this.handlers.addElement((SuperRoot)r.restore());
+/* 80 */ break;
+/* */ default:
+/* 82 */ throw new TooNewException();
+/* */ }
+/* */
+/* */ }
+/* */
+/* */
+/* */
+/* */ public Object properties(int index, int offset, int mode, Object value)
+/* */ throws NoSuchPropertyException
+/* */ {
+/* 92 */ Object ret = null;
+/* */
+/* 94 */ switch (index - offset) {
+/* */ case 0:
+/* 96 */ if (mode == 0) {
+/* 97 */ ret = new VectorProperty(this, index, "Handlers to Add");
+/* 98 */ } else if (mode == 1) {
+/* 99 */ ret = this.handlers.clone();
+/* 100 */ } else if (mode == 4) {
+/* 101 */ this.handlers.removeElement(value);
+/* 102 */ } else if (mode == 3)
+/* 103 */ this.handlers.addElement((SuperRoot)value);
+/* 104 */ break;
+/* */ default:
+/* 106 */ ret = super.properties(index, offset + 1, mode, value);
+/* */ }
+/* */
+/* 109 */ return ret;
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\AddHandler.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file