implement Remove All

This commit is contained in:
Downforce Agent 2024-06-29 04:47:55 -05:00
parent 45fbe80f9f
commit 2e1fe95670

View File

@ -31,6 +31,7 @@ import java.io.IOException;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.nio.file.*; import java.nio.file.*;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Random; import java.util.Random;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -343,7 +344,18 @@ public class MissPiggy implements ActionListener {
public void removeAllGUI() { public void removeAllGUI() {
// todo warning dialog that nukes list when Yes is clicked // todo warning dialog that nukes list when Yes is clicked
throwUnimplemented(); int result = JOptionPane.showConfirmDialog(frame, "Do you really want to delete all mods?", "Remove All", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
if (result == JOptionPane.YES_OPTION) {
for (Main.Mod entry : Main.Mods) {
new File(System.getProperty("user.home") + "/.firestar/mods/" + entry.path).delete();
}
}
new File(System.getProperty("user.home") + "/.firestar/mods/index").delete();
Main.Mods.clear();
InitializeModListStructure();
InitializeModListInGUI();
} }
public void optionsGUI() { public void optionsGUI() {
@ -361,11 +373,6 @@ public class MissPiggy implements ActionListener {
throwUnimplemented(); throwUnimplemented();
} }
public void aboutGUI() {
// todo about page
throwUnimplemented();
}
public void throwUnimplemented() { public void throwUnimplemented() {
JOptionPane.showMessageDialog(frame, "Unimplemented.\nSee README at https://git.worlio.com/bonkmaykr/firestar", "Unimplemented", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(frame, "Unimplemented.\nSee README at https://git.worlio.com/bonkmaykr/firestar", "Unimplemented", JOptionPane.INFORMATION_MESSAGE);
} }