diff --git a/src/java/com/threerings/presents/dobj/ObjectDeathListener.java b/src/java/com/threerings/presents/dobj/ObjectDeathListener.java new file mode 100644 index 000000000..d285d70ff --- /dev/null +++ b/src/java/com/threerings/presents/dobj/ObjectDeathListener.java @@ -0,0 +1,21 @@ +// +// $Id: ObjectDeathListener.java,v 1.1 2001/10/23 23:56:12 mdb Exp $ + +package com.threerings.presents.dobj; + +/** + * Implemented by entites which wish to hear about object destruction + * events. + * + * @see DObject#addListener + */ +public interface ObjectDeathListener +{ + /** + * Called when this object has been destroyed. This will be called + * after the event has been applied to the object. + * + * @param event The event that was dispatched on the object. + */ + public void objectDestroyed (ObjectDestroyedEvent event); +} diff --git a/src/java/com/threerings/presents/dobj/ObjectDestroyedEvent.java b/src/java/com/threerings/presents/dobj/ObjectDestroyedEvent.java index 468084890..725b33539 100644 --- a/src/java/com/threerings/presents/dobj/ObjectDestroyedEvent.java +++ b/src/java/com/threerings/presents/dobj/ObjectDestroyedEvent.java @@ -1,5 +1,5 @@ // -// $Id: ObjectDestroyedEvent.java,v 1.2 2001/10/11 04:07:52 mdb Exp $ +// $Id: ObjectDestroyedEvent.java,v 1.3 2001/10/23 23:56:12 mdb Exp $ package com.threerings.presents.dobj; @@ -39,9 +39,7 @@ public class ObjectDestroyedEvent extends TypedEvent { } - /** - * Applies this attribute change to the object. - */ + // documentation inherited public boolean applyToObject (DObject target) throws ObjectAccessException { @@ -50,11 +48,21 @@ public class ObjectDestroyedEvent extends TypedEvent return true; } + // documentation inherited public short getType () { return TYPE; } + // documentation inherited + protected void notifyListener (Object listener) + { + if (listener instanceof ObjectDeathListener) { + ((ObjectDeathListener)listener).objectDestroyed(this); + } + } + + // documentation inherited protected void toString (StringBuffer buf) { buf.append("DESTROY:");