Use main thread for shutdown deletion so it completes in time

This commit is contained in:
Govindas 2021-06-12 15:10:37 +03:00
parent 780f95c09f
commit c10677ee98

View File

@ -19,12 +19,12 @@ public class AutomaticLogDeleter extends JavaPlugin {
@Override @Override
public void onDisable() { public void onDisable() {
FileConfiguration config = getConfig(); FileConfiguration config = getConfig();
if (config.getBoolean("also-delete-logs-on-shutdown")) { if (config.getBoolean("also-delete-logs-on-shutdown")) {
new Thread(() -> {
deleteLogs(); //we aren't using separate thread here, so it has time to finish before server shutdowns
}).start();
deleteLogs();
} }
} }