mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-16 04:11:39 +01:00
Unload extensions when shutting down the server
This commit is contained in:
parent
d61a598c94
commit
6f8cbeb73b
@ -738,6 +738,8 @@ public final class MinecraftServer {
|
||||
connectionManager.shutdown();
|
||||
nettyServer.stop();
|
||||
storageManager.getLoadedLocations().forEach(StorageLocation::close);
|
||||
LOGGER.info("Unloading all extensions.");
|
||||
extensionManager.shutdown();
|
||||
LOGGER.info("Shutting down all thread pools.");
|
||||
benchmarkManager.disable();
|
||||
commandManager.stopConsoleThread();
|
||||
|
@ -622,4 +622,15 @@ public class ExtensionManager {
|
||||
// call GC to try to get rid of classes and classloader
|
||||
System.gc();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdowns all the extensions by unloading them.
|
||||
*/
|
||||
public void shutdown() {
|
||||
Iterator<Extension> extensionIterator = extensionList.iterator();
|
||||
while (extensionIterator.hasNext()) {
|
||||
final Extension extension = extensionIterator.next();
|
||||
unload(extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user