Guarded against plugins throwing exceptions on enable and disable to prevent potential corruption issues on server start and stop
This commit is contained in:
parent
e0c9b44db9
commit
f3b752c5d9
@ -246,7 +246,11 @@ public final class SimplePluginManager implements PluginManager {
|
||||
|
||||
public void enablePlugin(final Plugin plugin) {
|
||||
if (!plugin.isEnabled()) {
|
||||
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()) {
|
||||
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…
x
Reference in New Issue
Block a user