diff options
author | md_5 <git@md-5.net> | 2017-11-10 10:47:12 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2017-11-10 10:47:12 +1100 |
commit | adb9f8b5c2519f1d1b1c1c2564ee4573edad5534 (patch) | |
tree | b4124fb34f93fb1fb35057e5b6762a09c8543b96 | |
parent | 100ab9f2dc90cb717ab9a8c61e555a6618eccdb8 (diff) | |
download | bukkit-adb9f8b5c2519f1d1b1c1c2564ee4573edad5534.tar bukkit-adb9f8b5c2519f1d1b1c1c2564ee4573edad5534.tar.gz bukkit-adb9f8b5c2519f1d1b1c1c2564ee4573edad5534.tar.lz bukkit-adb9f8b5c2519f1d1b1c1c2564ee4573edad5534.tar.xz bukkit-adb9f8b5c2519f1d1b1c1c2564ee4573edad5534.zip |
Catch exceptions per plugin in PluginMessage handling
-rw-r--r-- | src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java index 29bcb39c..c7ecc9d9 100644 --- a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java +++ b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java @@ -6,6 +6,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.logging.Level; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -421,7 +422,14 @@ public class StandardMessenger implements Messenger { Set<PluginMessageListenerRegistration> registrations = getIncomingChannelRegistrations(channel); for (PluginMessageListenerRegistration registration : registrations) { - registration.getListener().onPluginMessageReceived(channel, source, message); + try { + registration.getListener().onPluginMessageReceived(channel, source, message); + } catch (Throwable t) { + registration.getPlugin().getLogger().log(Level.WARNING, + String.format("Plugin %s generated an exception whilst handling plugin message", + registration.getPlugin().getDescription().getFullName() + ), t); + } } } |