mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-21 05:44:17 +00:00
Catch exceptions per plugin in PluginMessage handling
This commit is contained in:
parent
100ab9f2dc
commit
adb9f8b5c2
1 changed files with 9 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue