Added pop-up notification on update success

This commit is contained in:
coolGi
2023-08-06 18:57:38 +09:30
parent e5dcc4189d
commit 260358be93
@@ -10,6 +10,7 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants;
import org.apache.logging.log4j.Logger;
import javax.swing.*;
import java.io.File;
import java.net.URL;
import java.nio.file.Files;
@@ -107,6 +108,10 @@ public class SelfUpdater {
deleteOldOnClose = true;
LOGGER.info(ModInfo.READABLE_NAME + " successfully updated. It will apply on game's relaunch");
new Thread(() -> {
System.setProperty("java.awt.headless", "false"); // Required to make it work
JOptionPane.showMessageDialog(null, ModInfo.READABLE_NAME+ " updated, this will be applied on game restart.", ModInfo.READABLE_NAME, JOptionPane.INFORMATION_MESSAGE);
}).start();
return true;
} catch (Exception e) {
LOGGER.warn("Failed to update "+ModInfo.READABLE_NAME+" to version "+ModrinthGetter.getLatestNameForVersion(minecraftVersion));