mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 19:34:09 +01:00
Catch exceptions per plugin in PluginMessage handling
By: md_5 <git@md-5.net>
This commit is contained in:
parent
48b1b91373
commit
5f4b9e502d
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…
Reference in a new issue