mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-20 07:34:48 +01:00
Guarded against plugins throwing exceptions on enable and disable to prevent potential corruption issues on server start and stop
By: stevenh <steven.hartland@multiplay.co.uk>
This commit is contained in:
parent
4af56e3d16
commit
94aac786c6
1 changed files with 12 additions and 4 deletions
|
@ -246,7 +246,11 @@ public final class SimplePluginManager implements PluginManager {
|
|||
|
||||
public void enablePlugin(final Plugin plugin) {
|
||||
if (!plugin.isEnabled()) {
|
||||
plugin.getPluginLoader().enablePlugin(plugin);
|
||||
try {
|
||||
plugin.getPluginLoader().enablePlugin(plugin);
|
||||
} catch (Throwable ex) {
|
||||
server.getLogger().log(Level.SEVERE, ex.getMessage() + " enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -258,9 +262,13 @@ public final class SimplePluginManager implements PluginManager {
|
|||
|
||||
public void disablePlugin(final Plugin plugin) {
|
||||
if (plugin.isEnabled()) {
|
||||
plugin.getPluginLoader().disablePlugin(plugin);
|
||||
server.getScheduler().cancelTasks(plugin);
|
||||
server.getServicesManager().unregisterAll(plugin);
|
||||
try {
|
||||
plugin.getPluginLoader().disablePlugin(plugin);
|
||||
server.getScheduler().cancelTasks(plugin);
|
||||
server.getServicesManager().unregisterAll(plugin);
|
||||
} catch (Throwable ex) {
|
||||
server.getLogger().log(Level.SEVERE, ex.getMessage() + " disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue