Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
ConversationAbandonedEvent.java
1 package org.bukkit.conversations;
2 
3 import java.util.EventObject;
4 
5 /**
6  * ConversationAbandonedEvent contains information about an abandoned
7  * conversation.
8  */
9 public class ConversationAbandonedEvent extends EventObject {
10 
11  private ConversationContext context;
12  private ConversationCanceller canceller;
13 
14  public ConversationAbandonedEvent(Conversation conversation) {
15  this(conversation, null);
16  }
17 
18  public ConversationAbandonedEvent(Conversation conversation, ConversationCanceller canceller) {
19  super(conversation);
20  this.context = conversation.getContext();
21  this.canceller = canceller;
22  }
23 
24  /**
25  * Gets the object that caused the conversation to be abandoned.
26  *
27  * @return The object that abandoned the conversation.
28  */
30  return canceller;
31  }
32 
33  /**
34  * Gets the abandoned conversation's conversation context.
35  *
36  * @return The abandoned conversation's conversation context.
37  */
39  return context;
40  }
41 
42  /**
43  * Indicates how the conversation was abandoned - naturally as part of the
44  * prompt chain or prematurely via a {@link ConversationCanceller}.
45  *
46  * @return True if the conversation is abandoned gracefully by a {@link
47  * Prompt} returning null or the next prompt. False of the
48  * conversations is abandoned prematurely by a ConversationCanceller.
49  */
50  public boolean gracefulExit() {
51  return canceller == null;
52  }
53 }