summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDevin Ryan <devin@forairan.com>2014-02-22 21:18:44 -0600
committerTravis Watkins <amaranth@ubuntu.com>2014-04-18 12:33:56 -0500
commitd0be633ed97707435e5c397efb4e4f6b2c8e21a0 (patch)
tree64285252831880f202b847265302fdff7c8a4ddd /src
parent8a6ed3a88b8cd8c08320157b605a63f56e9c4c88 (diff)
downloadcraftbukkit-d0be633ed97707435e5c397efb4e4f6b2c8e21a0.tar
craftbukkit-d0be633ed97707435e5c397efb4e4f6b2c8e21a0.tar.gz
craftbukkit-d0be633ed97707435e5c397efb4e4f6b2c8e21a0.tar.lz
craftbukkit-d0be633ed97707435e5c397efb4e4f6b2c8e21a0.tar.xz
craftbukkit-d0be633ed97707435e5c397efb4e4f6b2c8e21a0.zip
Catch exceptions when abandoning conversions. Fixes BUKKIT-5436
If a conversation is abandoned due to a player disconnecting and an exception is thrown in a ConversationAbandonedListener, the server will crash. This commit prevents the exception from propagating further up the stack and instead just logs the error.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/conversations/ConversationTracker.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/conversations/ConversationTracker.java b/src/main/java/org/bukkit/craftbukkit/conversations/ConversationTracker.java
index 1d770a59..30ef7d9a 100644
--- a/src/main/java/org/bukkit/craftbukkit/conversations/ConversationTracker.java
+++ b/src/main/java/org/bukkit/craftbukkit/conversations/ConversationTracker.java
@@ -1,11 +1,13 @@
package org.bukkit.craftbukkit.conversations;
+import java.util.LinkedList;
+import java.util.logging.Level;
+
+import org.bukkit.Bukkit;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.conversations.ManuallyAbandonedConversationCanceller;
-import java.util.LinkedList;
-
/**
*/
public class ConversationTracker {
@@ -42,8 +44,12 @@ public class ConversationTracker {
LinkedList<Conversation> oldQueue = conversationQueue;
conversationQueue = new LinkedList<Conversation>();
- for(Conversation conversation : oldQueue) {
- conversation.abandon(new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
+ for (Conversation conversation : oldQueue) {
+ try {
+ conversation.abandon(new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
+ } catch (Throwable t) {
+ Bukkit.getLogger().log(Level.SEVERE, "Unexpected exception while abandoning a conversation", t);
+ }
}
}